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

Unified Diff: Source/bindings/core/v8/ScriptValue.cpp

Issue 1130763006: IDL: Add any support to IDL dictionary and use it in CustomEventInit (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 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 | « Source/bindings/core/v8/ScriptValue.h ('k') | Source/bindings/core/v8/custom/V8CustomEventCustom.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/ScriptValue.cpp
diff --git a/Source/bindings/core/v8/ScriptValue.cpp b/Source/bindings/core/v8/ScriptValue.cpp
index 0371f67bad8694b2590b9413eea650bd6309864b..94716750ebaa06dda614e3cc44af42ef0b0f1283 100644
--- a/Source/bindings/core/v8/ScriptValue.cpp
+++ b/Source/bindings/core/v8/ScriptValue.cpp
@@ -32,6 +32,7 @@
#include "bindings/core/v8/ScriptValue.h"
#include "bindings/core/v8/ScriptState.h"
+#include "bindings/core/v8/SerializedScriptValueFactory.h"
#include "bindings/core/v8/V8Binding.h"
#include "platform/JSONValues.h"
@@ -61,6 +62,20 @@ v8::Local<v8::Value> ScriptValue::v8ValueUnsafe() const
return m_value->newLocal(isolate());
}
+v8::Local<v8::Value> ScriptValue::v8ValueFor(ScriptState* targetScriptState)
+{
+ if (isEmpty())
+ return v8::Local<v8::Value>();
+ v8::Isolate* isolate = targetScriptState->isolate();
+ if (&m_scriptState->world() == &targetScriptState->world())
+ return m_value->newLocal(isolate);
+
+ ASSERT(isolate->InContext());
+ v8::Local<v8::Value> value = m_value->newLocal(isolate);
+ RefPtr<SerializedScriptValue> serialized = SerializedScriptValueFactory::instance().createAndSwallowExceptions(isolate, value);
+ return serialized->deserialize();
+}
+
bool ScriptValue::toString(String& result) const
{
if (isEmpty())
« no previous file with comments | « Source/bindings/core/v8/ScriptValue.h ('k') | Source/bindings/core/v8/custom/V8CustomEventCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698