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

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

Issue 2642643002: Remove CallWith=ScriptState from window/self/frames getters on Window.
Patch Set: Created 3 years, 11 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 "bindings/core/v8/DOMDataStore.h" 11 #include "bindings/core/v8/DOMDataStore.h"
12 #include "bindings/core/v8/IDLDictionaryBase.h" 12 #include "bindings/core/v8/IDLDictionaryBase.h"
13 #include "bindings/core/v8/ScriptState.h" 13 #include "bindings/core/v8/ScriptState.h"
14 #include "bindings/core/v8/ScriptValue.h" 14 #include "bindings/core/v8/ScriptValue.h"
15 #include "bindings/core/v8/ScriptWrappable.h" 15 #include "bindings/core/v8/ScriptWrappable.h"
16 #include "bindings/core/v8/V8Binding.h" 16 #include "bindings/core/v8/V8Binding.h"
17 #include "core/CoreExport.h" 17 #include "core/CoreExport.h"
18 #include "platform/heap/Handle.h" 18 #include "platform/heap/Handle.h"
19 #include "wtf/Forward.h" 19 #include "wtf/Forward.h"
20 #include <utility> 20 #include <utility>
21 #include <v8.h> 21 #include <v8.h>
22 22
23 namespace blink { 23 namespace blink {
24 24
25 class DOMWindow; 25 class DOMWindow;
26 class Dictionary; 26 class Dictionary;
27 class EventTarget; 27 class EventTarget;
28 class WindowProxyManagerBase;
28 29
29 // ScriptWrappable 30 // ScriptWrappable
30 31
31 inline v8::Local<v8::Value> ToV8(ScriptWrappable* impl, 32 inline v8::Local<v8::Value> ToV8(ScriptWrappable* impl,
32 v8::Local<v8::Object> creationContext, 33 v8::Local<v8::Object> creationContext,
33 v8::Isolate* isolate) { 34 v8::Isolate* isolate) {
34 if (UNLIKELY(!impl)) 35 if (UNLIKELY(!impl))
35 return v8::Null(isolate); 36 return v8::Null(isolate);
36 v8::Local<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate); 37 v8::Local<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
37 if (!wrapper.IsEmpty()) 38 if (!wrapper.IsEmpty())
(...skipping 16 matching lines...) Expand all
54 wrapper = ScriptWrappable::fromNode(impl)->wrap(isolate, creationContext); 55 wrapper = ScriptWrappable::fromNode(impl)->wrap(isolate, creationContext);
55 DCHECK(!wrapper.IsEmpty()); 56 DCHECK(!wrapper.IsEmpty());
56 return wrapper; 57 return wrapper;
57 } 58 }
58 59
59 // Special versions for DOMWindow and EventTarget 60 // Special versions for DOMWindow and EventTarget
60 61
61 CORE_EXPORT v8::Local<v8::Value> ToV8(DOMWindow*, 62 CORE_EXPORT v8::Local<v8::Value> ToV8(DOMWindow*,
62 v8::Local<v8::Object> creationContext, 63 v8::Local<v8::Object> creationContext,
63 v8::Isolate*); 64 v8::Isolate*);
65
64 CORE_EXPORT v8::Local<v8::Value> ToV8(EventTarget*, 66 CORE_EXPORT v8::Local<v8::Value> ToV8(EventTarget*,
65 v8::Local<v8::Object> creationContext, 67 v8::Local<v8::Object> creationContext,
66 v8::Isolate*); 68 v8::Isolate*);
67 69
70 // Special version for DOMWindow when it needs to return a value even when
71 // detached.
72
73 CORE_EXPORT v8::Local<v8::Value> ToV8(WindowProxyManagerBase*,
74 v8::Local<v8::Object> creationContext,
75 v8::Isolate*);
76
68 // Primitives 77 // Primitives
69 78
70 inline v8::Local<v8::Value> ToV8(const String& value, 79 inline v8::Local<v8::Value> ToV8(const String& value,
71 v8::Local<v8::Object> creationContext, 80 v8::Local<v8::Object> creationContext,
72 v8::Isolate* isolate) { 81 v8::Isolate* isolate) {
73 return v8String(isolate, value); 82 return v8String(isolate, value);
74 } 83 }
75 84
76 inline v8::Local<v8::Value> ToV8(const char* value, 85 inline v8::Local<v8::Value> ToV8(const char* value,
77 v8::Local<v8::Object> creationContext, 86 v8::Local<v8::Object> creationContext,
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 // Cannot define in ScriptValue because of the circular dependency between toV8 308 // Cannot define in ScriptValue because of the circular dependency between toV8
300 // and ScriptValue 309 // and ScriptValue
301 template <typename T> 310 template <typename T>
302 inline ScriptValue ScriptValue::from(ScriptState* scriptState, T&& value) { 311 inline ScriptValue ScriptValue::from(ScriptState* scriptState, T&& value) {
303 return ScriptValue(scriptState, ToV8(std::forward<T>(value), scriptState)); 312 return ScriptValue(scriptState, ToV8(std::forward<T>(value), scriptState));
304 } 313 }
305 314
306 } // namespace blink 315 } // namespace blink
307 316
308 #endif // ToV8_h 317 #endif // ToV8_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698