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". |