1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: set ts=8 sts=2 et sw=2 tw=80:
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef vm_ArrayBufferObject_inl_h
8 #define vm_ArrayBufferObject_inl_h
10 // Utilities and common inline code for ArrayBufferObject and
11 // SharedArrayBufferObject.
13 #include "vm/ArrayBufferObject.h"
15 #include "vm/SharedArrayObject.h"
16 #include "vm/SharedMem.h"
20 inline SharedMem
<uint8_t*> ArrayBufferObjectMaybeShared::dataPointerEither() {
21 if (this->is
<ArrayBufferObject
>()) {
22 return this->as
<ArrayBufferObject
>().dataPointerShared();
24 return this->as
<SharedArrayBufferObject
>().dataPointerShared();
27 inline bool ArrayBufferObjectMaybeShared::isDetached() const {
28 if (this->is
<ArrayBufferObject
>()) {
29 return this->as
<ArrayBufferObject
>().isDetached();
34 inline size_t ArrayBufferObjectMaybeShared::byteLength() const {
35 if (this->is
<ArrayBufferObject
>()) {
36 return this->as
<ArrayBufferObject
>().byteLength();
38 return this->as
<SharedArrayBufferObject
>().byteLength();
41 inline bool ArrayBufferObjectMaybeShared::isPreparedForAsmJS() const {
42 if (this->is
<ArrayBufferObject
>()) {
43 return this->as
<ArrayBufferObject
>().isPreparedForAsmJS();
48 inline bool ArrayBufferObjectMaybeShared::isWasm() const {
49 if (this->is
<ArrayBufferObject
>()) {
50 return this->as
<ArrayBufferObject
>().isWasm();
52 return this->as
<SharedArrayBufferObject
>().isWasm();
57 #endif // vm_ArrayBufferObject_inl_h