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

Unified Diff: webkit/plugins/ppapi/message_channel.h

Issue 11490014: PPAPI: Make Messaging not PostTask and copy when out-of-process. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years 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
Index: webkit/plugins/ppapi/message_channel.h
diff --git a/webkit/plugins/ppapi/message_channel.h b/webkit/plugins/ppapi/message_channel.h
index 12f4c0b7c3c8935021339ef43f63e3fa60007cb0..b0ee40f10255da035b18bcc5b524270a6884ee4b 100644
--- a/webkit/plugins/ppapi/message_channel.h
+++ b/webkit/plugins/ppapi/message_channel.h
@@ -5,14 +5,14 @@
#ifndef WEBKIT_PLUGINS_PPAPI_MESSAGE_CHANNEL_H_
#define WEBKIT_PLUGINS_PPAPI_MESSAGE_CHANNEL_H_
+#include <deque>
+
#include "base/memory/weak_ptr.h"
#include "ppapi/shared_impl/resource.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerializedScriptValue.h"
#include "third_party/npapi/bindings/npruntime.h"
struct PP_Var;
-namespace WebKit {
-class WebSerializedScriptValue;
-}
namespace webkit {
namespace ppapi {
@@ -70,6 +70,12 @@ class MessageChannel {
return instance_;
}
+ // Messages sent to JavaScript are queued by default. After the DOM is
+ // set up for the plugin, users of MessageChannel should call
+ // StopQueueingJavaScriptMessages to start dispatching messages to JavaScript.
+ void QueueJavaScriptMessages();
+ void StopQueueingJavaScriptMessages();
+
private:
PluginInstance* instance_;
@@ -91,10 +97,21 @@ class MessageChannel {
// channel's instance. This is used by PostMessageToNative.
void PostMessageToNativeImpl(PP_Var message_data);
+ void DrainEarlyMessageQueue();
+
// This is used to ensure pending tasks will not fire after this object is
// destroyed.
base::WeakPtrFactory<MessageChannel> weak_ptr_factory_;
+ std::deque<WebKit::WebSerializedScriptValue> early_message_queue_;
+ enum EarlyMessageQueueState {
+ QUEUE, // Queue JS messages.
dmichael (off chromium) 2012/12/11 22:35:30 I think it might be easier to understand with slig
teravest 2012/12/11 22:43:39 Done.
+ DIRECT, // Post JS messages directly.
+ DRAIN, // Drain queue, then transition to DIRECT.
+ DRAIN_CANCEL // Preempt drain, go back to QUEUE.
+ };
+ EarlyMessageQueueState early_message_queue_state_;
dmichael (off chromium) 2012/12/11 22:35:30 Can you add a TODO or file a bug to remove this st
teravest 2012/12/11 22:43:39 Done.
+
DISALLOW_COPY_AND_ASSIGN(MessageChannel);
};
« no previous file with comments | « no previous file | webkit/plugins/ppapi/message_channel.cc » ('j') | webkit/plugins/ppapi/ppapi_plugin_instance.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698