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

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

Issue 1591033002: Add toV8(value, scriptState) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/ToV8Test.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/core/v8/ToV8.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/ToV8.h b/third_party/WebKit/Source/bindings/core/v8/ToV8.h
index 5c8c07cf37e40afb087e23746658b8a75048d55e..f077b389b6d8691a081520f66f58e42c19a18ef9 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ToV8.h
+++ b/third_party/WebKit/Source/bindings/core/v8/ToV8.h
@@ -9,6 +9,7 @@
// handle. Call sites must check IsEmpty() before using return value.
#include "bindings/core/v8/DOMDataStore.h"
+#include "bindings/core/v8/ScriptState.h"
#include "bindings/core/v8/ScriptValue.h"
#include "bindings/core/v8/ScriptWrappable.h"
#include "bindings/core/v8/V8Binding.h"
@@ -241,6 +242,15 @@ inline v8::Local<v8::Value> toV8(const Vector<std::pair<String, T>>& value, v8::
return object;
}
+// In all cases allow script state instead of creation context + isolate.
+// Only use if your function does not otherwise need the global, as
+// v8::Context::Global() is not simply a getter.
haraken 2016/01/16 03:51:22 What do you mean by "v8::Context::Global() is not
+template<typename T>
+inline v8::Local<v8::Value> toV8(T value, ScriptState* scriptState)
yhirano 2016/01/17 23:51:38 Is "T&&" better for avoiding copy?
+{
+ return toV8(value, scriptState->context()->Global(), scriptState->isolate());
+}
+
// Only declare toV8(void*,...) for checking function overload mismatch.
// This toV8(void*,...) should be never used. So we will find mismatch
// because of "unresolved external symbol".
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/ToV8Test.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698