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

Side by Side Diff: ppapi/proxy/plugin_resource.h

Issue 11437038: Revert 171408 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/plugin_dispatcher.cc ('k') | ppapi/proxy/plugin_resource.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) 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 PPAPI_PROXY_PLUGIN_RESOURCE_H_ 5 #ifndef PPAPI_PROXY_PLUGIN_RESOURCE_H_
6 #define PPAPI_PROXY_PLUGIN_RESOURCE_H_ 6 #define PPAPI_PROXY_PLUGIN_RESOURCE_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 int32_t SyncCall(Destination dest, const IPC::Message& msg, A* a, B* b); 119 int32_t SyncCall(Destination dest, const IPC::Message& msg, A* a, B* b);
120 template <class ReplyMsgClass, class A, class B, class C> 120 template <class ReplyMsgClass, class A, class B, class C>
121 int32_t SyncCall(Destination dest, const IPC::Message& msg, A* a, B* b, C* c); 121 int32_t SyncCall(Destination dest, const IPC::Message& msg, A* a, B* b, C* c);
122 template <class ReplyMsgClass, class A, class B, class C, class D> 122 template <class ReplyMsgClass, class A, class B, class C, class D>
123 int32_t SyncCall( 123 int32_t SyncCall(
124 Destination dest, const IPC::Message& msg, A* a, B* b, C* c, D* d); 124 Destination dest, const IPC::Message& msg, A* a, B* b, C* c, D* d);
125 template <class ReplyMsgClass, class A, class B, class C, class D, class E> 125 template <class ReplyMsgClass, class A, class B, class C, class D, class E>
126 int32_t SyncCall( 126 int32_t SyncCall(
127 Destination dest, const IPC::Message& msg, A* a, B* b, C* c, D* d, E* e); 127 Destination dest, const IPC::Message& msg, A* a, B* b, C* c, D* d, E* e);
128 128
129 int32_t GenericSyncCall(Destination dest,
130 const IPC::Message& msg,
131 IPC::Message* reply_msg,
132 ResourceMessageReplyParams* reply_params);
133
134 private: 129 private:
135 IPC::Sender* GetSender(Destination dest) { 130 IPC::Sender* GetSender(Destination dest) {
136 return dest == RENDERER ? connection_.renderer_sender : 131 return dest == RENDERER ? connection_.renderer_sender :
137 connection_.browser_sender; 132 connection_.browser_sender;
138 } 133 }
139 134
140 // Helper function to send a |PpapiHostMsg_ResourceCall| to the given 135 // Helper function to send a |PpapiHostMsg_ResourceCall| to the given
141 // destination with |nested_msg| and |call_params|. 136 // destination with |nested_msg| and |call_params|.
142 bool SendResourceCall(Destination dest, 137 bool SendResourceCall(Destination dest,
143 const ResourceMessageCallParams& call_params, 138 const ResourceMessageCallParams& call_params,
144 const IPC::Message& nested_msg); 139 const IPC::Message& nested_msg);
145 140
141 int32_t GenericSyncCall(Destination dest,
142 const IPC::Message& msg,
143 IPC::Message* reply_msg);
144
146 int32_t GetNextSequence(); 145 int32_t GetNextSequence();
147 146
148 Connection connection_; 147 Connection connection_;
149 148
150 // Use GetNextSequence to retrieve the next value. 149 // Use GetNextSequence to retrieve the next value.
151 int32_t next_sequence_number_; 150 int32_t next_sequence_number_;
152 151
153 bool sent_create_to_browser_; 152 bool sent_create_to_browser_;
154 bool sent_create_to_renderer_; 153 bool sent_create_to_renderer_;
155 154
(...skipping 15 matching lines...) Expand all
171 new PluginResourceCallback<ReplyMsgClass, CallbackType>(callback)); 170 new PluginResourceCallback<ReplyMsgClass, CallbackType>(callback));
172 callbacks_.insert(std::make_pair(params.sequence(), plugin_callback)); 171 callbacks_.insert(std::make_pair(params.sequence(), plugin_callback));
173 params.set_has_callback(); 172 params.set_has_callback();
174 SendResourceCall(dest, params, msg); 173 SendResourceCall(dest, params, msg);
175 return params.sequence(); 174 return params.sequence();
176 } 175 }
177 176
178 template <class ReplyMsgClass> 177 template <class ReplyMsgClass>
179 int32_t PluginResource::SyncCall(Destination dest, const IPC::Message& msg) { 178 int32_t PluginResource::SyncCall(Destination dest, const IPC::Message& msg) {
180 IPC::Message reply; 179 IPC::Message reply;
181 ResourceMessageReplyParams reply_params; 180 return GenericSyncCall(dest, msg, &reply);
182 return GenericSyncCall(dest, msg, &reply, &reply_params);
183 } 181 }
184 182
185 template <class ReplyMsgClass, class A> 183 template <class ReplyMsgClass, class A>
186 int32_t PluginResource::SyncCall( 184 int32_t PluginResource::SyncCall(
187 Destination dest, const IPC::Message& msg, A* a) { 185 Destination dest, const IPC::Message& msg, A* a) {
188 IPC::Message reply; 186 IPC::Message reply;
189 ResourceMessageReplyParams reply_params; 187 int32_t result = GenericSyncCall(dest, msg, &reply);
190 int32_t result = GenericSyncCall(dest, msg, &reply, &reply_params);
191 188
192 if (UnpackMessage<ReplyMsgClass>(reply, a)) 189 if (UnpackMessage<ReplyMsgClass>(reply, a))
193 return result; 190 return result;
194 return PP_ERROR_FAILED; 191 return PP_ERROR_FAILED;
195 } 192 }
196 193
197 template <class ReplyMsgClass, class A, class B> 194 template <class ReplyMsgClass, class A, class B>
198 int32_t PluginResource::SyncCall( 195 int32_t PluginResource::SyncCall(
199 Destination dest, const IPC::Message& msg, A* a, B* b) { 196 Destination dest, const IPC::Message& msg, A* a, B* b) {
200 IPC::Message reply; 197 IPC::Message reply;
201 ResourceMessageReplyParams reply_params; 198 int32_t result = GenericSyncCall(dest, msg, &reply);
202 int32_t result = GenericSyncCall(dest, msg, &reply, &reply_params);
203 199
204 if (UnpackMessage<ReplyMsgClass>(reply, a, b)) 200 if (UnpackMessage<ReplyMsgClass>(reply, a, b))
205 return result; 201 return result;
206 return PP_ERROR_FAILED; 202 return PP_ERROR_FAILED;
207 } 203 }
208 204
209 template <class ReplyMsgClass, class A, class B, class C> 205 template <class ReplyMsgClass, class A, class B, class C>
210 int32_t PluginResource::SyncCall( 206 int32_t PluginResource::SyncCall(
211 Destination dest, const IPC::Message& msg, A* a, B* b, C* c) { 207 Destination dest, const IPC::Message& msg, A* a, B* b, C* c) {
212 IPC::Message reply; 208 IPC::Message reply;
213 ResourceMessageReplyParams reply_params; 209 int32_t result = GenericSyncCall(dest, msg, &reply);
214 int32_t result = GenericSyncCall(dest, msg, &reply, &reply_params);
215 210
216 if (UnpackMessage<ReplyMsgClass>(reply, a, b, c)) 211 if (UnpackMessage<ReplyMsgClass>(reply, a, b, c))
217 return result; 212 return result;
218 return PP_ERROR_FAILED; 213 return PP_ERROR_FAILED;
219 } 214 }
220 215
221 template <class ReplyMsgClass, class A, class B, class C, class D> 216 template <class ReplyMsgClass, class A, class B, class C, class D>
222 int32_t PluginResource::SyncCall( 217 int32_t PluginResource::SyncCall(
223 Destination dest, const IPC::Message& msg, A* a, B* b, C* c, D* d) { 218 Destination dest, const IPC::Message& msg, A* a, B* b, C* c, D* d) {
224 IPC::Message reply; 219 IPC::Message reply;
225 ResourceMessageReplyParams reply_params; 220 int32_t result = GenericSyncCall(dest, msg, &reply);
226 int32_t result = GenericSyncCall(dest, msg, &reply, &reply_params);
227 221
228 if (UnpackMessage<ReplyMsgClass>(reply, a, b, c, d)) 222 if (UnpackMessage<ReplyMsgClass>(reply, a, b, c, d))
229 return result; 223 return result;
230 return PP_ERROR_FAILED; 224 return PP_ERROR_FAILED;
231 } 225 }
232 226
233 template <class ReplyMsgClass, class A, class B, class C, class D, class E> 227 template <class ReplyMsgClass, class A, class B, class C, class D, class E>
234 int32_t PluginResource::SyncCall( 228 int32_t PluginResource::SyncCall(
235 Destination dest, const IPC::Message& msg, A* a, B* b, C* c, D* d, E* e) { 229 Destination dest, const IPC::Message& msg, A* a, B* b, C* c, D* d, E* e) {
236 IPC::Message reply; 230 IPC::Message reply;
237 ResourceMessageReplyParams reply_params; 231 int32_t result = GenericSyncCall(dest, msg, &reply);
238 int32_t result = GenericSyncCall(dest, msg, &reply, &reply_params);
239 232
240 if (UnpackMessage<ReplyMsgClass>(reply, a, b, c, d, e)) 233 if (UnpackMessage<ReplyMsgClass>(reply, a, b, c, d, e))
241 return result; 234 return result;
242 return PP_ERROR_FAILED; 235 return PP_ERROR_FAILED;
243 } 236 }
244 237
245 } // namespace proxy 238 } // namespace proxy
246 } // namespace ppapi 239 } // namespace ppapi
247 240
248 #endif // PPAPI_PROXY_PLUGIN_RESOURCE_H_ 241 #endif // PPAPI_PROXY_PLUGIN_RESOURCE_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/plugin_dispatcher.cc ('k') | ppapi/proxy/plugin_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698