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

Unified Diff: Source/core/dom/MessagePort.cpp

Issue 924983002: Expose v8 context a MessagePort lives in to give content side code a valid context to (de)serialize… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: use v8::Local instead of v8::Handle Created 5 years, 10 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/core/dom/MessagePort.h ('k') | public/platform/WebMessagePortChannelClient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/MessagePort.cpp
diff --git a/Source/core/dom/MessagePort.cpp b/Source/core/dom/MessagePort.cpp
index 46b53945e60a5e66b66a90cbbb99b8b99db19088..da4fa3b35c033a8a2c8b70e001f8f96f521e732d 100644
--- a/Source/core/dom/MessagePort.cpp
+++ b/Source/core/dom/MessagePort.cpp
@@ -61,6 +61,8 @@ MessagePort::MessagePort(ExecutionContext& executionContext)
MessagePort::~MessagePort()
{
close();
+ if (m_scriptStateForConversion)
+ m_scriptStateForConversion->disposePerContextData();
}
void MessagePort::postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> message, const MessagePortArray* ports, ExceptionState& exceptionState)
@@ -266,4 +268,20 @@ DEFINE_TRACE(MessagePort)
EventTargetWithInlineData::trace(visitor);
}
+v8::Isolate* MessagePort::scriptIsolate()
+{
+ ASSERT(executionContext());
+ return toIsolate(executionContext());
+}
+
+v8::Local<v8::Context> MessagePort::scriptContextForMessageConversion()
+{
+ ASSERT(executionContext());
+ if (!m_scriptStateForConversion) {
+ v8::Isolate* isolate = scriptIsolate();
+ m_scriptStateForConversion = ScriptState::create(v8::Context::New(isolate), DOMWrapperWorld::create(isolate));
+ }
+ return m_scriptStateForConversion->context();
+}
+
} // namespace blink
« no previous file with comments | « Source/core/dom/MessagePort.h ('k') | public/platform/WebMessagePortChannelClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698