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

Side by Side Diff: content/renderer/pepper/message_channel.h

Issue 225903006: PPAPI: Run clang_format.py on content/renderer/pepper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 6 years, 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_RENDERER_PEPPER_MESSAGE_CHANNEL_H_ 5 #ifndef CONTENT_RENDERER_PEPPER_MESSAGE_CHANNEL_H_
6 #define CONTENT_RENDERER_PEPPER_MESSAGE_CHANNEL_H_ 6 #define CONTENT_RENDERER_PEPPER_MESSAGE_CHANNEL_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 // asynchronously. 61 // asynchronously.
62 void PostMessageToJavaScript(PP_Var message_data); 62 void PostMessageToJavaScript(PP_Var message_data);
63 // Post a message to the PPP_Instance HandleMessage function for this 63 // Post a message to the PPP_Instance HandleMessage function for this
64 // channel's instance. 64 // channel's instance.
65 void PostMessageToNative(PP_Var message_data); 65 void PostMessageToNative(PP_Var message_data);
66 66
67 // Return the NPObject* to which we should forward any calls which aren't 67 // Return the NPObject* to which we should forward any calls which aren't
68 // related to postMessage. Note that this can be NULL; it only gets set if 68 // related to postMessage. Note that this can be NULL; it only gets set if
69 // there is a scriptable 'InstanceObject' associated with this channel's 69 // there is a scriptable 'InstanceObject' associated with this channel's
70 // instance. 70 // instance.
71 NPObject* passthrough_object() { 71 NPObject* passthrough_object() { return passthrough_object_; }
72 return passthrough_object_;
73 }
74 void SetPassthroughObject(NPObject* passthrough); 72 void SetPassthroughObject(NPObject* passthrough);
75 73
76 NPObject* np_object() { return np_object_; } 74 NPObject* np_object() { return np_object_; }
77 75
78 PepperPluginInstanceImpl* instance() { 76 PepperPluginInstanceImpl* instance() { return instance_; }
79 return instance_;
80 }
81 77
82 // Messages sent to JavaScript are queued by default. After the DOM is 78 // Messages sent to JavaScript are queued by default. After the DOM is
83 // set up for the plugin, users of MessageChannel should call 79 // set up for the plugin, users of MessageChannel should call
84 // StopQueueingJavaScriptMessages to start dispatching messages to JavaScript. 80 // StopQueueingJavaScriptMessages to start dispatching messages to JavaScript.
85 void QueueJavaScriptMessages(); 81 void QueueJavaScriptMessages();
86 void StopQueueingJavaScriptMessages(); 82 void StopQueueingJavaScriptMessages();
87 83
88 bool GetReadOnlyProperty(NPIdentifier key, NPVariant* value) const; 84 bool GetReadOnlyProperty(NPIdentifier key, NPVariant* value) const;
89 void SetReadOnlyProperty(PP_Var key, PP_Var value); 85 void SetReadOnlyProperty(PP_Var key, PP_Var value);
90 86
(...skipping 28 matching lines...) Expand all
119 // Post a message to the PPP_Instance HandleMessage function for this 115 // Post a message to the PPP_Instance HandleMessage function for this
120 // channel's instance. This is used by PostMessageToNative. 116 // channel's instance. This is used by PostMessageToNative.
121 void PostMessageToNativeImpl(PP_Var message_data); 117 void PostMessageToNativeImpl(PP_Var message_data);
122 118
123 void DrainEarlyMessageQueue(); 119 void DrainEarlyMessageQueue();
124 120
125 // TODO(teravest): Remove all the tricky DRAIN_CANCELLED logic once 121 // TODO(teravest): Remove all the tricky DRAIN_CANCELLED logic once
126 // PluginInstance::ResetAsProxied() is gone. 122 // PluginInstance::ResetAsProxied() is gone.
127 std::deque<blink::WebSerializedScriptValue> early_message_queue_; 123 std::deque<blink::WebSerializedScriptValue> early_message_queue_;
128 enum EarlyMessageQueueState { 124 enum EarlyMessageQueueState {
129 QUEUE_MESSAGES, // Queue JS messages. 125 QUEUE_MESSAGES, // Queue JS messages.
130 SEND_DIRECTLY, // Post JS messages directly. 126 SEND_DIRECTLY, // Post JS messages directly.
131 DRAIN_PENDING, // Drain queue, then transition to DIRECT. 127 DRAIN_PENDING, // Drain queue, then transition to DIRECT.
132 DRAIN_CANCELLED // Preempt drain, go back to QUEUE. 128 DRAIN_CANCELLED // Preempt drain, go back to QUEUE.
133 }; 129 };
134 EarlyMessageQueueState early_message_queue_state_; 130 EarlyMessageQueueState early_message_queue_state_;
135 131
136 // This queue stores vars that have been converted from NPVariants. Because 132 // This queue stores vars that have been converted from NPVariants. Because
137 // conversion can happen asynchronously, the queue stores the var until all 133 // conversion can happen asynchronously, the queue stores the var until all
138 // previous vars have been converted before calling PostMessage to ensure that 134 // previous vars have been converted before calling PostMessage to ensure that
139 // the order in which messages are processed is preserved. 135 // the order in which messages are processed is preserved.
140 std::list<VarConversionResult> converted_var_queue_; 136 std::list<VarConversionResult> converted_var_queue_;
141 137
142 std::map<NPIdentifier, ppapi::ScopedPPVar> internal_properties_; 138 std::map<NPIdentifier, ppapi::ScopedPPVar> internal_properties_;
143 139
144 // This is used to ensure pending tasks will not fire after this object is 140 // This is used to ensure pending tasks will not fire after this object is
145 // destroyed. 141 // destroyed.
146 base::WeakPtrFactory<MessageChannel> weak_ptr_factory_; 142 base::WeakPtrFactory<MessageChannel> weak_ptr_factory_;
147 143
148 DISALLOW_COPY_AND_ASSIGN(MessageChannel); 144 DISALLOW_COPY_AND_ASSIGN(MessageChannel);
149 }; 145 };
150 146
151 } // namespace content 147 } // namespace content
152 148
153 #endif // CONTENT_RENDERER_PEPPER_MESSAGE_CHANNEL_H_ 149 #endif // CONTENT_RENDERER_PEPPER_MESSAGE_CHANNEL_H_
OLDNEW
« no previous file with comments | « content/renderer/pepper/host_var_tracker_unittest.cc ('k') | content/renderer/pepper/message_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698