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

Unified Diff: public/platform/WebMessagePortChannelClient.h

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: dispose context in MessagePort destructor 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.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: public/platform/WebMessagePortChannelClient.h
diff --git a/public/platform/WebMessagePortChannelClient.h b/public/platform/WebMessagePortChannelClient.h
index 9389338bc37d6c01d478ca50332773e55574cf69..08a476649cd8511085ce4bfe2b3123df5b2a177f 100644
--- a/public/platform/WebMessagePortChannelClient.h
+++ b/public/platform/WebMessagePortChannelClient.h
@@ -31,10 +31,17 @@
#ifndef WebMessagePortChannelClient_h
#define WebMessagePortChannelClient_h
+namespace v8 {
haraken 2015/02/25 18:49:59 We conventionally just include <v8.h> instead of u
Marijn Kruisselbrink 2015/02/25 19:08:51 Done.
+class Context;
+template<typename T> class Handle;
+class Isolate;
+}
+
namespace blink {
// Provides an interface for users of WebMessagePortChannel to be notified
-// when messages are available.
+// when messages are available. This also gives users of WebMessagePortChannel
+// access to the V8 Context this message port lives in.
class WebMessagePortChannelClient {
public:
// Alerts that new messages have arrived, which are retrieved by calling
@@ -42,6 +49,19 @@ public:
// on any thread.
virtual void messageAvailable() = 0;
+ // Returns the V8 isolate this message port lives in.
+ // Do not rely on this API, it is only exposed so content code can convert
+ // messages to base::Value, and will be removed when this conversion can be
+ // integrated into blink itself.
+ virtual v8::Isolate* scriptIsolate() = 0;
+
+ // Returns a V8 context messages sent to this port can be (de)serialized in.
haraken 2015/02/25 18:49:59 Add a FIXME to remove this.
Marijn Kruisselbrink 2015/02/25 19:08:51 Done (and filed a bug as well).
+ // Can return null if no valid V8 context could be determined.
+ // Do not rely on this API, it is only exposed so content code can convert
+ // messages to base::Value, and will be removed when this conversion can be
+ // integrated into blink itself.
+ virtual v8::Handle<v8::Context> scriptContextForMessageConversion() = 0;
+
protected:
~WebMessagePortChannelClient() { }
};
« no previous file with comments | « Source/core/dom/MessagePort.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698