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

Side by Side Diff: ppapi/proxy/ppb_instance_proxy.cc

Issue 7844018: Revert 100748 - This patch tries to remove most of the manual registration for Pepper interfaces,... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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/proxy/ppb_instance_proxy.h ('k') | ppapi/proxy/ppb_memory_proxy.h » ('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 #include "ppapi/proxy/ppb_instance_proxy.h" 5 #include "ppapi/proxy/ppb_instance_proxy.h"
6 6
7 #include "ppapi/c/dev/ppb_fullscreen_dev.h" 7 #include "ppapi/c/dev/ppb_fullscreen_dev.h"
8 #include "ppapi/c/dev/ppb_mouse_lock_dev.h" 8 #include "ppapi/c/dev/ppb_mouse_lock_dev.h"
9 #include "ppapi/c/pp_errors.h" 9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/c/pp_var.h" 10 #include "ppapi/c/pp_var.h"
(...skipping 14 matching lines...) Expand all
25 25
26 using ppapi::thunk::EnterFunctionNoLock; 26 using ppapi::thunk::EnterFunctionNoLock;
27 using ppapi::thunk::EnterResourceNoLock; 27 using ppapi::thunk::EnterResourceNoLock;
28 using ppapi::thunk::PPB_Instance_FunctionAPI; 28 using ppapi::thunk::PPB_Instance_FunctionAPI;
29 29
30 namespace ppapi { 30 namespace ppapi {
31 namespace proxy { 31 namespace proxy {
32 32
33 namespace { 33 namespace {
34 34
35 typedef EnterFunctionNoLock<PPB_Instance_FunctionAPI> EnterInstanceNoLock; 35 InterfaceProxy* CreateInstanceProxy(Dispatcher* dispatcher,
36 36 const void* target_interface) {
37 InterfaceProxy* CreateInstanceProxy(Dispatcher* dispatcher) { 37 return new PPB_Instance_Proxy(dispatcher, target_interface);
38 return new PPB_Instance_Proxy(dispatcher);
39 } 38 }
40 39
41 } // namespace 40 } // namespace
42 41
43 PPB_Instance_Proxy::PPB_Instance_Proxy(Dispatcher* dispatcher) 42 PPB_Instance_Proxy::PPB_Instance_Proxy(Dispatcher* dispatcher,
44 : InterfaceProxy(dispatcher) { 43 const void* target_interface)
44 : InterfaceProxy(dispatcher, target_interface) {
45 } 45 }
46 46
47 PPB_Instance_Proxy::~PPB_Instance_Proxy() { 47 PPB_Instance_Proxy::~PPB_Instance_Proxy() {
48 } 48 }
49 49
50 // static 50 // static
51 const InterfaceProxy::Info* PPB_Instance_Proxy::GetInfo0_5() {
52 static const Info info = {
53 ppapi::thunk::GetPPB_Instance_1_0_Thunk(),
54 PPB_INSTANCE_INTERFACE_0_5,
55 INTERFACE_ID_NONE, // 1_0 is the canonical one.
56 false,
57 &CreateInstanceProxy,
58 };
59 return &info;
60 }
61
62 // static
63 const InterfaceProxy::Info* PPB_Instance_Proxy::GetInfo1_0() {
64 static const Info info = {
65 ppapi::thunk::GetPPB_Instance_1_0_Thunk(),
66 PPB_INSTANCE_INTERFACE_1_0,
67 INTERFACE_ID_PPB_INSTANCE,
68 false,
69 &CreateInstanceProxy,
70 };
71 return &info;
72 }
73
74 // static
75 const InterfaceProxy::Info* PPB_Instance_Proxy::GetInfoMessaging() {
76 static const Info info = {
77 ppapi::thunk::GetPPB_Messaging_Thunk(),
78 PPB_MESSAGING_INTERFACE,
79 INTERFACE_ID_NONE, // 1_0 is the canonical one.
80 false,
81 &CreateInstanceProxy,
82 };
83 return &info;
84 }
85
86 // static
87 const InterfaceProxy::Info* PPB_Instance_Proxy::GetInfoMouseLock() {
88 static const Info info = {
89 ppapi::thunk::GetPPB_MouseLock_Thunk(),
90 PPB_MOUSELOCK_DEV_INTERFACE,
91 INTERFACE_ID_NONE, // 1_0 is the canonical one.
92 false,
93 &CreateInstanceProxy,
94 };
95 return &info;
96 }
97
98 // static
51 const InterfaceProxy::Info* PPB_Instance_Proxy::GetInfoPrivate() { 99 const InterfaceProxy::Info* PPB_Instance_Proxy::GetInfoPrivate() {
52 static const Info info = { 100 static const Info info = {
53 ppapi::thunk::GetPPB_Instance_Private_Thunk(), 101 ppapi::thunk::GetPPB_Instance_Private_Thunk(),
54 PPB_INSTANCE_PRIVATE_INTERFACE, 102 PPB_INSTANCE_PRIVATE_INTERFACE,
55 INTERFACE_ID_NONE, // 1_0 is the canonical one. 103 INTERFACE_ID_NONE, // 1_0 is the canonical one.
56 false, 104 false,
57 &CreateInstanceProxy, 105 &CreateInstanceProxy,
58 }; 106 };
59 return &info; 107 return &info;
60 } 108 }
(...skipping 22 matching lines...) Expand all
83 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetWindowObject, 131 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetWindowObject,
84 OnMsgGetWindowObject) 132 OnMsgGetWindowObject)
85 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetOwnerElementObject, 133 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetOwnerElementObject,
86 OnMsgGetOwnerElementObject) 134 OnMsgGetOwnerElementObject)
87 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_BindGraphics, 135 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_BindGraphics,
88 OnMsgBindGraphics) 136 OnMsgBindGraphics)
89 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_IsFullFrame, 137 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_IsFullFrame,
90 OnMsgIsFullFrame) 138 OnMsgIsFullFrame)
91 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ExecuteScript, 139 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ExecuteScript,
92 OnMsgExecuteScript) 140 OnMsgExecuteScript)
93 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_Log,
94 OnMsgLog)
95 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_LogWithSource,
96 OnMsgLogWithSource)
97 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PostMessage, 141 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PostMessage,
98 OnMsgPostMessage) 142 OnMsgPostMessage)
99 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetFullscreen, 143 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetFullscreen,
100 OnMsgSetFullscreen) 144 OnMsgSetFullscreen)
101 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetScreenSize, 145 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetScreenSize,
102 OnMsgGetScreenSize) 146 OnMsgGetScreenSize)
103 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_RequestInputEvents, 147 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_RequestInputEvents,
104 OnMsgRequestInputEvents) 148 OnMsgRequestInputEvents)
105 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ClearInputEvents, 149 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ClearInputEvents,
106 OnMsgClearInputEvents) 150 OnMsgClearInputEvents)
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 if (se.IsThrown()) 202 if (se.IsThrown())
159 return PP_MakeUndefined(); 203 return PP_MakeUndefined();
160 204
161 ReceiveSerializedVarReturnValue result; 205 ReceiveSerializedVarReturnValue result;
162 dispatcher()->Send(new PpapiHostMsg_PPBInstance_ExecuteScript( 206 dispatcher()->Send(new PpapiHostMsg_PPBInstance_ExecuteScript(
163 INTERFACE_ID_PPB_INSTANCE, instance, 207 INTERFACE_ID_PPB_INSTANCE, instance,
164 SerializedVarSendInput(dispatcher(), script), &se, &result)); 208 SerializedVarSendInput(dispatcher(), script), &se, &result));
165 return result.Return(dispatcher()); 209 return result.Return(dispatcher());
166 } 210 }
167 211
168 void PPB_Instance_Proxy::Log(PP_Instance instance,
169 int log_level,
170 PP_Var value) {
171 dispatcher()->Send(new PpapiHostMsg_PPBInstance_Log(
172 INTERFACE_ID_PPB_INSTANCE, instance, static_cast<int>(log_level),
173 SerializedVarSendInput(dispatcher(), value)));
174 }
175
176 void PPB_Instance_Proxy::LogWithSource(PP_Instance instance,
177 int log_level,
178 PP_Var source,
179 PP_Var value) {
180 dispatcher()->Send(new PpapiHostMsg_PPBInstance_LogWithSource(
181 INTERFACE_ID_PPB_INSTANCE, instance, static_cast<int>(log_level),
182 SerializedVarSendInput(dispatcher(), source),
183 SerializedVarSendInput(dispatcher(), value)));
184 }
185
186 PP_Bool PPB_Instance_Proxy::IsFullscreen(PP_Instance instance) { 212 PP_Bool PPB_Instance_Proxy::IsFullscreen(PP_Instance instance) {
187 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> 213 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
188 GetInstanceData(instance); 214 GetInstanceData(instance);
189 if (!data) 215 if (!data)
190 return PP_FALSE; 216 return PP_FALSE;
191 return data->fullscreen; 217 return data->fullscreen;
192 } 218 }
193 219
194 PP_Bool PPB_Instance_Proxy::SetFullscreen(PP_Instance instance, 220 PP_Bool PPB_Instance_Proxy::SetFullscreen(PP_Instance instance,
195 PP_Bool fullscreen) { 221 PP_Bool fullscreen) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 } 298 }
273 299
274 void PPB_Instance_Proxy::UnlockMouse(PP_Instance instance) { 300 void PPB_Instance_Proxy::UnlockMouse(PP_Instance instance) {
275 dispatcher()->Send(new PpapiHostMsg_PPBInstance_UnlockMouse( 301 dispatcher()->Send(new PpapiHostMsg_PPBInstance_UnlockMouse(
276 INTERFACE_ID_PPB_INSTANCE, instance)); 302 INTERFACE_ID_PPB_INSTANCE, instance));
277 } 303 }
278 304
279 void PPB_Instance_Proxy::OnMsgGetWindowObject( 305 void PPB_Instance_Proxy::OnMsgGetWindowObject(
280 PP_Instance instance, 306 PP_Instance instance,
281 SerializedVarReturnValue result) { 307 SerializedVarReturnValue result) {
282 EnterInstanceNoLock enter(instance, false); 308 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false);
283 if (enter.succeeded()) 309 if (enter.succeeded())
284 result.Return(dispatcher(), enter.functions()->GetWindowObject(instance)); 310 result.Return(dispatcher(), enter.functions()->GetWindowObject(instance));
285 } 311 }
286 312
287 void PPB_Instance_Proxy::OnMsgGetOwnerElementObject( 313 void PPB_Instance_Proxy::OnMsgGetOwnerElementObject(
288 PP_Instance instance, 314 PP_Instance instance,
289 SerializedVarReturnValue result) { 315 SerializedVarReturnValue result) {
290 EnterInstanceNoLock enter(instance, false); 316 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false);
291 if (enter.succeeded()) { 317 if (enter.succeeded()) {
292 result.Return(dispatcher(), 318 result.Return(dispatcher(),
293 enter.functions()->GetOwnerElementObject(instance)); 319 enter.functions()->GetOwnerElementObject(instance));
294 } 320 }
295 } 321 }
296 322
297 void PPB_Instance_Proxy::OnMsgBindGraphics(PP_Instance instance, 323 void PPB_Instance_Proxy::OnMsgBindGraphics(PP_Instance instance,
298 const HostResource& device, 324 const HostResource& device,
299 PP_Bool* result) { 325 PP_Bool* result) {
300 EnterInstanceNoLock enter(instance, false); 326 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false);
301 if (enter.succeeded()) { 327 if (enter.succeeded()) {
302 *result = enter.functions()->BindGraphics(instance, 328 *result = enter.functions()->BindGraphics(instance,
303 device.host_resource()); 329 device.host_resource());
304 } 330 }
305 } 331 }
306 332
307 void PPB_Instance_Proxy::OnMsgIsFullFrame(PP_Instance instance, 333 void PPB_Instance_Proxy::OnMsgIsFullFrame(PP_Instance instance,
308 PP_Bool* result) { 334 PP_Bool* result) {
309 EnterInstanceNoLock enter(instance, false); 335 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false);
310 if (enter.succeeded()) 336 if (enter.succeeded())
311 *result = enter.functions()->IsFullFrame(instance); 337 *result = enter.functions()->IsFullFrame(instance);
312 } 338 }
313 339
314 void PPB_Instance_Proxy::OnMsgExecuteScript( 340 void PPB_Instance_Proxy::OnMsgExecuteScript(
315 PP_Instance instance, 341 PP_Instance instance,
316 SerializedVarReceiveInput script, 342 SerializedVarReceiveInput script,
317 SerializedVarOutParam out_exception, 343 SerializedVarOutParam out_exception,
318 SerializedVarReturnValue result) { 344 SerializedVarReturnValue result) {
319 EnterInstanceNoLock enter(instance, false); 345 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false);
320 if (enter.failed()) 346 if (enter.failed())
321 return; 347 return;
322 348
323 if (dispatcher()->IsPlugin()) 349 if (dispatcher()->IsPlugin())
324 NOTREACHED(); 350 NOTREACHED();
325 else 351 else
326 static_cast<HostDispatcher*>(dispatcher())->set_allow_plugin_reentrancy(); 352 static_cast<HostDispatcher*>(dispatcher())->set_allow_plugin_reentrancy();
327 353
328 result.Return(dispatcher(), enter.functions()->ExecuteScript( 354 result.Return(dispatcher(), enter.functions()->ExecuteScript(
329 instance, 355 instance,
330 script.Get(dispatcher()), 356 script.Get(dispatcher()),
331 out_exception.OutParam(dispatcher()))); 357 out_exception.OutParam(dispatcher())));
332 } 358 }
333 359
334 void PPB_Instance_Proxy::OnMsgLog(PP_Instance instance,
335 int log_level,
336 SerializedVarReceiveInput value) {
337 EnterInstanceNoLock enter(instance, false);
338 if (enter.succeeded())
339 enter.functions()->Log(instance, log_level, value.Get(dispatcher()));
340 }
341
342 void PPB_Instance_Proxy::OnMsgLogWithSource(PP_Instance instance,
343 int log_level,
344 SerializedVarReceiveInput source,
345 SerializedVarReceiveInput value) {
346 EnterInstanceNoLock enter(instance, false);
347 if (enter.succeeded()) {
348 enter.functions()->LogWithSource(instance, log_level,
349 source.Get(dispatcher()),
350 value.Get(dispatcher()));
351 }
352 }
353
354 void PPB_Instance_Proxy::OnMsgSetFullscreen(PP_Instance instance, 360 void PPB_Instance_Proxy::OnMsgSetFullscreen(PP_Instance instance,
355 PP_Bool fullscreen, 361 PP_Bool fullscreen,
356 PP_Bool* result) { 362 PP_Bool* result) {
357 EnterInstanceNoLock enter(instance, false); 363 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false);
358 if (enter.succeeded()) 364 if (enter.succeeded())
359 *result = enter.functions()->SetFullscreen(instance, fullscreen); 365 *result = enter.functions()->SetFullscreen(instance, fullscreen);
360 } 366 }
361 367
362 void PPB_Instance_Proxy::OnMsgGetScreenSize(PP_Instance instance, 368 void PPB_Instance_Proxy::OnMsgGetScreenSize(PP_Instance instance,
363 PP_Bool* result, 369 PP_Bool* result,
364 PP_Size* size) { 370 PP_Size* size) {
365 EnterInstanceNoLock enter(instance, false); 371 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false);
366 if (enter.succeeded()) 372 if (enter.succeeded())
367 *result = enter.functions()->GetScreenSize(instance, size); 373 *result = enter.functions()->GetScreenSize(instance, size);
368 } 374 }
369 375
370 void PPB_Instance_Proxy::OnMsgRequestInputEvents(PP_Instance instance, 376 void PPB_Instance_Proxy::OnMsgRequestInputEvents(PP_Instance instance,
371 bool is_filtering, 377 bool is_filtering,
372 uint32_t event_classes) { 378 uint32_t event_classes) {
373 EnterInstanceNoLock enter(instance, false); 379 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false);
374 if (enter.succeeded()) { 380 if (enter.succeeded()) {
375 if (is_filtering) 381 if (is_filtering)
376 enter.functions()->RequestFilteringInputEvents(instance, event_classes); 382 enter.functions()->RequestFilteringInputEvents(instance, event_classes);
377 else 383 else
378 enter.functions()->RequestInputEvents(instance, event_classes); 384 enter.functions()->RequestInputEvents(instance, event_classes);
379 } 385 }
380 } 386 }
381 387
382 void PPB_Instance_Proxy::OnMsgClearInputEvents(PP_Instance instance, 388 void PPB_Instance_Proxy::OnMsgClearInputEvents(PP_Instance instance,
383 uint32_t event_classes) { 389 uint32_t event_classes) {
384 EnterInstanceNoLock enter(instance, false); 390 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false);
385 if (enter.succeeded()) 391 if (enter.succeeded())
386 enter.functions()->ClearInputEventRequest(instance, event_classes); 392 enter.functions()->ClearInputEventRequest(instance, event_classes);
387 } 393 }
388 394
389 void PPB_Instance_Proxy::OnMsgPostMessage(PP_Instance instance, 395 void PPB_Instance_Proxy::OnMsgPostMessage(PP_Instance instance,
390 SerializedVarReceiveInput message) { 396 SerializedVarReceiveInput message) {
391 EnterInstanceNoLock enter(instance, false); 397 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false);
392 if (enter.succeeded()) 398 if (enter.succeeded())
393 enter.functions()->PostMessage(instance, message.Get(dispatcher())); 399 enter.functions()->PostMessage(instance, message.Get(dispatcher()));
394 } 400 }
395 401
396 void PPB_Instance_Proxy::OnMsgLockMouse(PP_Instance instance, 402 void PPB_Instance_Proxy::OnMsgLockMouse(PP_Instance instance,
397 uint32_t serialized_callback) { 403 uint32_t serialized_callback) {
398 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, true); 404 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, true);
399 if (enter.failed()) 405 if (enter.failed())
400 return; 406 return;
401 PP_CompletionCallback callback = ReceiveCallback(serialized_callback); 407 PP_CompletionCallback callback = ReceiveCallback(serialized_callback);
402 int32_t result = enter.functions()->LockMouse(instance, callback); 408 int32_t result = enter.functions()->LockMouse(instance, callback);
403 if (result != PP_OK_COMPLETIONPENDING) 409 if (result != PP_OK_COMPLETIONPENDING)
404 PP_RunCompletionCallback(&callback, result); 410 PP_RunCompletionCallback(&callback, result);
405 } 411 }
406 412
407 void PPB_Instance_Proxy::OnMsgUnlockMouse(PP_Instance instance) { 413 void PPB_Instance_Proxy::OnMsgUnlockMouse(PP_Instance instance) {
408 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, true); 414 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, true);
409 if (enter.succeeded()) 415 if (enter.succeeded())
410 enter.functions()->UnlockMouse(instance); 416 enter.functions()->UnlockMouse(instance);
411 } 417 }
412 418
413 } // namespace proxy 419 } // namespace proxy
414 } // namespace ppapi 420 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_instance_proxy.h ('k') | ppapi/proxy/ppb_memory_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698