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 "platform/heap/Handle.h" | 51 #include "platform/heap/Handle.h" |
51 #include "v8/include/v8.h" | 52 #include "v8/include/v8.h" |
52 #include "wtf/text/AtomicString.h" | 53 #include "wtf/text/AtomicString.h" |
53 #include "wtf/text/StringView.h" | 54 #include "wtf/text/StringView.h" |
54 | 55 |
55 namespace blink { | 56 namespace blink { |
56 | 57 |
57 class DOMWindow; | 58 class DOMWindow; |
58 class EventListener; | 59 class EventListener; |
59 class EventTarget; | 60 class EventTarget; |
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 | 1146 |
1146 // Freeze a V8 object. The type of the first parameter and the return value is | 1147 // Freeze a V8 object. The type of the first parameter and the return value is |
1147 // intentionally v8::Value so that this function can wrap ToV8(). | 1148 // intentionally v8::Value so that this function can wrap ToV8(). |
1148 // If the argument isn't an object, this will crash. | 1149 // If the argument isn't an object, this will crash. |
1149 CORE_EXPORT v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>, | 1150 CORE_EXPORT v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>, |
1150 v8::Isolate*); | 1151 v8::Isolate*); |
1151 | 1152 |
1152 CORE_EXPORT v8::Local<v8::Value> fromJSONString(v8::Isolate*, | 1153 CORE_EXPORT v8::Local<v8::Value> fromJSONString(v8::Isolate*, |
1153 const String& stringifiedJSON, | 1154 const String& stringifiedJSON, |
1154 ExceptionState&); | 1155 ExceptionState&); |
| 1156 |
| 1157 // TODO(binji) : document |
| 1158 template <typename NotSharedType> |
| 1159 CORE_EXPORT NotSharedType toNotShared(v8::Isolate* isolate, |
| 1160 v8::Local<v8::Value> value, |
| 1161 ExceptionState& exceptionState) { |
| 1162 using DOMTypedArray = typename NotSharedType::TypedArrayType; |
| 1163 DOMTypedArray* domTypedArray = |
| 1164 V8TypeOf<DOMTypedArray>::Type::toImplWithTypeCheck(isolate, value); |
| 1165 if (domTypedArray->isShared()) { |
| 1166 exceptionState.throwTypeError( |
| 1167 "The provided ArrayBufferView value must not be shared."); |
| 1168 return NotSharedType(); |
| 1169 } |
| 1170 return NotSharedType(domTypedArray); |
| 1171 } |
| 1172 |
1155 } // namespace blink | 1173 } // namespace blink |
1156 | 1174 |
1157 #endif // V8Binding_h | 1175 #endif // V8Binding_h |
OLD | NEW |