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

Side by Side Diff: webkit/plugins/ppapi/message_channel.h

Issue 6745015: Make PPAPI PostMessage behave asynchronously. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/tests/test_post_message.cc ('k') | webkit/plugins/ppapi/message_channel.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef WEBKIT_PLUGINS_PPAPI_MESSAGE_CHANNEL_H_ 5 #ifndef WEBKIT_PLUGINS_PPAPI_MESSAGE_CHANNEL_H_
6 #define WEBKIT_PLUGINS_PPAPI_MESSAGE_CHANNEL_H_ 6 #define WEBKIT_PLUGINS_PPAPI_MESSAGE_CHANNEL_H_
7 7
8 #include "base/task.h"
8 #include "third_party/npapi/bindings/npruntime.h" 9 #include "third_party/npapi/bindings/npruntime.h"
9 #include "webkit/plugins/ppapi/resource.h" 10 #include "webkit/plugins/ppapi/resource.h"
10 11
11 struct PP_Var; 12 struct PP_Var;
12 13
13 namespace webkit { 14 namespace webkit {
14 namespace ppapi { 15 namespace ppapi {
15 16
16 class PluginInstance; 17 class PluginInstance;
17 18
(...skipping 19 matching lines...) Expand all
37 struct MessageChannelNPObject : public NPObject { 38 struct MessageChannelNPObject : public NPObject {
38 MessageChannelNPObject(); 39 MessageChannelNPObject();
39 ~MessageChannelNPObject(); 40 ~MessageChannelNPObject();
40 41
41 MessageChannel* message_channel; 42 MessageChannel* message_channel;
42 }; 43 };
43 44
44 explicit MessageChannel(PluginInstance* instance); 45 explicit MessageChannel(PluginInstance* instance);
45 ~MessageChannel(); 46 ~MessageChannel();
46 47
48 // Post a message to the onmessage handler for this channel's instance
49 // asynchronously.
47 void PostMessageToJavaScript(PP_Var message_data); 50 void PostMessageToJavaScript(PP_Var message_data);
51 // Post a message to the PPP_Instance HandleMessage function for this
52 // channel's instance.
48 void PostMessageToNative(PP_Var message_data); 53 void PostMessageToNative(PP_Var message_data);
49 54
50 // Return the NPObject* to which we should forward any calls which aren't 55 // Return the NPObject* to which we should forward any calls which aren't
51 // related to postMessage. Note that this can be NULL; it only gets set if 56 // related to postMessage. Note that this can be NULL; it only gets set if
52 // there is a scriptable 'InstanceObject' associated with this channel's 57 // there is a scriptable 'InstanceObject' associated with this channel's
53 // instance. 58 // instance.
54 NPObject* passthrough_object() { 59 NPObject* passthrough_object() {
55 return passthrough_object_; 60 return passthrough_object_;
56 } 61 }
57 void set_passthrough_object(NPObject* passthrough) { 62 void set_passthrough_object(NPObject* passthrough) {
(...skipping 16 matching lines...) Expand all
74 // scripting. 79 // scripting.
75 NPObject* passthrough_object_; 80 NPObject* passthrough_object_;
76 81
77 // The NPObject we use to expose postMessage to JavaScript. 82 // The NPObject we use to expose postMessage to JavaScript.
78 MessageChannelNPObject* np_object_; 83 MessageChannelNPObject* np_object_;
79 84
80 // An NPVariant referring to the JavaScript function we use to send a message 85 // An NPVariant referring to the JavaScript function we use to send a message
81 // to a JavaScript target. 86 // to a JavaScript target.
82 NPVariant onmessage_invoker_; 87 NPVariant onmessage_invoker_;
83 88
89 // Evaluates the JavaScript code for onmessage_invoker_ and makes
90 // it a callable NPVariant for that function. Returns true on success, false
91 // otherwise.
84 bool EvaluateOnMessageInvoker(); 92 bool EvaluateOnMessageInvoker();
85 93
94 // Post a message to the onmessage handler for this channel's instance
95 // synchronously. This is used by PostMessageToJavaScript.
96 void PostMessageToJavaScriptImpl(PP_Var message_data);
97 // Post a message to the PPP_Instance HandleMessage function for this
98 // channel's instance. This is used by PostMessageToNative.
99 void PostMessageToNativeImpl(PP_Var message_data);
100
101 // Ensure pending tasks will not fire after this object is destroyed.
102 ScopedRunnableMethodFactory<MessageChannel> method_factory_;
103
86 DISALLOW_COPY_AND_ASSIGN(MessageChannel); 104 DISALLOW_COPY_AND_ASSIGN(MessageChannel);
87 }; 105 };
88 106
89 } // namespace ppapi 107 } // namespace ppapi
90 } // namespace webkit 108 } // namespace webkit
91 109
92 #endif // WEBKIT_PLUGINS_PPAPI_MESSAGE_CHANNEL_H_ 110 #endif // WEBKIT_PLUGINS_PPAPI_MESSAGE_CHANNEL_H_
93 111
OLDNEW
« no previous file with comments | « ppapi/tests/test_post_message.cc ('k') | webkit/plugins/ppapi/message_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698