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

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
« no previous file with comments | « no previous file | webkit/plugins/ppapi/message_channel.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..c433365857c752fd544bf063fe8c4ed91d6b272d 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,23 @@ 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_;
+ // TODO(teravest): Remove all the tricky DRAIN_CANCELLED logic once
+ // webkit::ppapi::PluginInstance::ResetAsProxied() is gone.
+ std::deque<WebKit::WebSerializedScriptValue> early_message_queue_;
+ enum EarlyMessageQueueState {
+ QUEUE_MESSAGES, // Queue JS messages.
+ SEND_DIRECTLY, // Post JS messages directly.
+ DRAIN_PENDING, // Drain queue, then transition to DIRECT.
+ DRAIN_CANCELLED // Preempt drain, go back to QUEUE.
+ };
+ EarlyMessageQueueState early_message_queue_state_;
+
DISALLOW_COPY_AND_ASSIGN(MessageChannel);
};
« no previous file with comments | « no previous file | webkit/plugins/ppapi/message_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698