| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Ericsson AB. All rights reserved. | 3 * Copyright (C) 2012 Ericsson AB. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 #include "bindings/core/v8/ScriptState.h" | 40 #include "bindings/core/v8/ScriptState.h" |
| 41 #include "bindings/core/v8/ScriptValue.h" | 41 #include "bindings/core/v8/ScriptValue.h" |
| 42 #include "bindings/core/v8/ScriptWrappable.h" | 42 #include "bindings/core/v8/ScriptWrappable.h" |
| 43 #include "bindings/core/v8/V8BindingMacros.h" | 43 #include "bindings/core/v8/V8BindingMacros.h" |
| 44 #include "bindings/core/v8/V8PerIsolateData.h" | 44 #include "bindings/core/v8/V8PerIsolateData.h" |
| 45 #include "bindings/core/v8/V8ScriptRunner.h" | 45 #include "bindings/core/v8/V8ScriptRunner.h" |
| 46 #include "bindings/core/v8/V8StringResource.h" | 46 #include "bindings/core/v8/V8StringResource.h" |
| 47 #include "bindings/core/v8/V8ThrowException.h" | 47 #include "bindings/core/v8/V8ThrowException.h" |
| 48 #include "bindings/core/v8/V8ValueCache.h" | 48 #include "bindings/core/v8/V8ValueCache.h" |
| 49 #include "core/CoreExport.h" | 49 #include "core/CoreExport.h" |
| 50 #include "core/dom/NotShared.h" | 50 #include "core/dom/ArrayBufferViewHelpers.h" |
| 51 #include "platform/heap/Handle.h" | 51 #include "platform/heap/Handle.h" |
| 52 #include "platform/wtf/text/AtomicString.h" | 52 #include "platform/wtf/text/AtomicString.h" |
| 53 #include "platform/wtf/text/StringView.h" | 53 #include "platform/wtf/text/StringView.h" |
| 54 #include "v8/include/v8.h" | 54 #include "v8/include/v8.h" |
| 55 | 55 |
| 56 namespace blink { | 56 namespace blink { |
| 57 | 57 |
| 58 class DOMWindow; | 58 class DOMWindow; |
| 59 class EventListener; | 59 class EventListener; |
| 60 class ExceptionState; | 60 class ExceptionState; |
| (...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 DOMTypedArray* dom_typed_array = | 1114 DOMTypedArray* dom_typed_array = |
| 1115 V8TypeOf<DOMTypedArray>::Type::toImplWithTypeCheck(isolate, value); | 1115 V8TypeOf<DOMTypedArray>::Type::toImplWithTypeCheck(isolate, value); |
| 1116 if (dom_typed_array && dom_typed_array->IsShared()) { | 1116 if (dom_typed_array && dom_typed_array->IsShared()) { |
| 1117 exception_state.ThrowTypeError( | 1117 exception_state.ThrowTypeError( |
| 1118 "The provided ArrayBufferView value must not be shared."); | 1118 "The provided ArrayBufferView value must not be shared."); |
| 1119 return NotSharedType(); | 1119 return NotSharedType(); |
| 1120 } | 1120 } |
| 1121 return NotSharedType(dom_typed_array); | 1121 return NotSharedType(dom_typed_array); |
| 1122 } | 1122 } |
| 1123 | 1123 |
| 1124 // Wrap a typed array value in MaybeShared<>, to signify that it may be backed |
| 1125 // by a SharedArrayBuffer. |
| 1126 template <typename MaybeSharedType> |
| 1127 MaybeSharedType ToMaybeShared(v8::Isolate* isolate, |
| 1128 v8::Local<v8::Value> value, |
| 1129 ExceptionState& exception_state) { |
| 1130 using DOMTypedArray = typename MaybeSharedType::TypedArrayType; |
| 1131 DOMTypedArray* dom_typed_array = |
| 1132 V8TypeOf<DOMTypedArray>::Type::toImplWithTypeCheck(isolate, value); |
| 1133 return MaybeSharedType(dom_typed_array); |
| 1134 } |
| 1135 |
| 1124 } // namespace blink | 1136 } // namespace blink |
| 1125 | 1137 |
| 1126 #endif // V8Binding_h | 1138 #endif // V8Binding_h |
| OLD | NEW |