Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(409)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ToV8.h

Issue 2707243006: [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: update comment, add TODO Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ToV8_h 5 #ifndef ToV8_h
6 #define ToV8_h 6 #define ToV8_h
7 7
8 // ToV8() provides C++ -> V8 conversion. Note that ToV8() can return an empty 8 // ToV8() provides C++ -> V8 conversion. Note that ToV8() can return an empty
9 // handle. Call sites must check IsEmpty() before using return value. 9 // handle. Call sites must check IsEmpty() before using return value.
10 10
11 #include <utility> 11 #include <utility>
12 12
13 #include "bindings/core/v8/DOMDataStore.h" 13 #include "bindings/core/v8/DOMDataStore.h"
14 #include "bindings/core/v8/IDLDictionaryBase.h" 14 #include "bindings/core/v8/IDLDictionaryBase.h"
15 #include "bindings/core/v8/ScriptState.h" 15 #include "bindings/core/v8/ScriptState.h"
16 #include "bindings/core/v8/ScriptValue.h" 16 #include "bindings/core/v8/ScriptValue.h"
17 #include "bindings/core/v8/ScriptWrappable.h" 17 #include "bindings/core/v8/ScriptWrappable.h"
18 #include "bindings/core/v8/V8Binding.h" 18 #include "bindings/core/v8/V8Binding.h"
19 #include "core/CoreExport.h" 19 #include "core/CoreExport.h"
20 #include "core/dom/NotShared.h"
20 #include "platform/heap/Handle.h" 21 #include "platform/heap/Handle.h"
21 #include "platform/wtf/Forward.h" 22 #include "platform/wtf/Forward.h"
22 #include "v8/include/v8.h" 23 #include "v8/include/v8.h"
23 24
24 namespace blink { 25 namespace blink {
25 26
26 class DOMWindow; 27 class DOMWindow;
27 class Dictionary; 28 class Dictionary;
28 class EventTarget; 29 class EventTarget;
29 30
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 if (v8_value.IsEmpty()) 269 if (v8_value.IsEmpty())
269 v8_value = v8::Undefined(isolate); 270 v8_value = v8::Undefined(isolate);
270 if (!V8CallBoolean(object->CreateDataProperty( 271 if (!V8CallBoolean(object->CreateDataProperty(
271 isolate->GetCurrentContext(), V8String(isolate, value[i].first), 272 isolate->GetCurrentContext(), V8String(isolate, value[i].first),
272 v8_value))) 273 v8_value)))
273 return v8::Local<v8::Value>(); 274 return v8::Local<v8::Value>();
274 } 275 }
275 return object; 276 return object;
276 } 277 }
277 278
279 template <typename T>
280 inline v8::Local<v8::Value> ToV8(NotShared<T> value,
281 v8::Local<v8::Object> creation_context,
282 v8::Isolate* isolate) {
283 return ToV8(value.View(), creation_context, isolate);
284 }
285
278 template <typename Sequence> 286 template <typename Sequence>
279 inline v8::Local<v8::Value> ToV8SequenceInternal( 287 inline v8::Local<v8::Value> ToV8SequenceInternal(
280 const Sequence& sequence, 288 const Sequence& sequence,
281 v8::Local<v8::Object> creation_context, 289 v8::Local<v8::Object> creation_context,
282 v8::Isolate* isolate) { 290 v8::Isolate* isolate) {
283 v8::Local<v8::Array> array; 291 v8::Local<v8::Array> array;
284 { 292 {
285 v8::Context::Scope context_scope(creation_context->CreationContext()); 293 v8::Context::Scope context_scope(creation_context->CreationContext());
286 array = v8::Array::New(isolate, sequence.size()); 294 array = v8::Array::New(isolate, sequence.size());
287 } 295 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 // Cannot define in ScriptValue because of the circular dependency between toV8 331 // Cannot define in ScriptValue because of the circular dependency between toV8
324 // and ScriptValue 332 // and ScriptValue
325 template <typename T> 333 template <typename T>
326 inline ScriptValue ScriptValue::From(ScriptState* script_state, T&& value) { 334 inline ScriptValue ScriptValue::From(ScriptState* script_state, T&& value) {
327 return ScriptValue(script_state, ToV8(std::forward<T>(value), script_state)); 335 return ScriptValue(script_state, ToV8(std::forward<T>(value), script_state));
328 } 336 }
329 337
330 } // namespace blink 338 } // namespace blink
331 339
332 #endif // ToV8_h 340 #endif // ToV8_h
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/webmidi/send-messages.html ('k') | third_party/WebKit/Source/bindings/core/v8/V8Binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698