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

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

Issue 6282007: First pass at making the proxy handle multiple renderers. This associates the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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_image_data_proxy.cc ('k') | ppapi/proxy/ppb_pdf_proxy.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/pp_var.h" 7 #include "ppapi/c/pp_var.h"
8 #include "ppapi/c/ppb_instance.h" 8 #include "ppapi/c/ppb_instance.h"
9 #include "ppapi/proxy/plugin_dispatcher.h" 9 #include "ppapi/proxy/plugin_dispatcher.h"
10 #include "ppapi/proxy/ppapi_messages.h" 10 #include "ppapi/proxy/ppapi_messages.h"
11 #include "ppapi/proxy/serialized_var.h" 11 #include "ppapi/proxy/serialized_var.h"
12 12
13 namespace pp { 13 namespace pp {
14 namespace proxy { 14 namespace proxy {
15 15
16 namespace { 16 namespace {
17 17
18 PP_Var GetWindowObject(PP_Instance instance) { 18 PP_Var GetWindowObject(PP_Instance instance) {
19 Dispatcher* dispatcher = PluginDispatcher::Get(); 19 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
20 if (!dispatcher)
21 return PP_MakeUndefined();
22
20 ReceiveSerializedVarReturnValue result; 23 ReceiveSerializedVarReturnValue result;
21 dispatcher->Send(new PpapiHostMsg_PPBInstance_GetWindowObject( 24 dispatcher->Send(new PpapiHostMsg_PPBInstance_GetWindowObject(
22 INTERFACE_ID_PPB_INSTANCE, instance, &result)); 25 INTERFACE_ID_PPB_INSTANCE, instance, &result));
23 return result.Return(dispatcher); 26 return result.Return(dispatcher);
24 } 27 }
25 28
26 PP_Var GetOwnerElementObject(PP_Instance instance) { 29 PP_Var GetOwnerElementObject(PP_Instance instance) {
27 Dispatcher* dispatcher = PluginDispatcher::Get(); 30 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
31 if (!dispatcher)
32 return PP_MakeUndefined();
33
28 ReceiveSerializedVarReturnValue result; 34 ReceiveSerializedVarReturnValue result;
29 dispatcher->Send(new PpapiHostMsg_PPBInstance_GetOwnerElementObject( 35 dispatcher->Send(new PpapiHostMsg_PPBInstance_GetOwnerElementObject(
30 INTERFACE_ID_PPB_INSTANCE, instance, &result)); 36 INTERFACE_ID_PPB_INSTANCE, instance, &result));
31 return result.Return(dispatcher); 37 return result.Return(dispatcher);
32 } 38 }
33 39
34 PP_Bool BindGraphics(PP_Instance instance, PP_Resource device) { 40 PP_Bool BindGraphics(PP_Instance instance, PP_Resource device) {
35 PP_Bool result; 41 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
36 PluginDispatcher::Get()->Send(new PpapiHostMsg_PPBInstance_BindGraphics( 42 if (!dispatcher)
43 return PP_FALSE;
44
45 PP_Bool result = PP_FALSE;
46 dispatcher->Send(new PpapiHostMsg_PPBInstance_BindGraphics(
37 INTERFACE_ID_PPB_INSTANCE, instance, device, &result)); 47 INTERFACE_ID_PPB_INSTANCE, instance, device, &result));
38 return result; 48 return result;
39 } 49 }
40 50
41 PP_Bool IsFullFrame(PP_Instance instance) { 51 PP_Bool IsFullFrame(PP_Instance instance) {
42 PP_Bool result; 52 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
43 PluginDispatcher::Get()->Send(new PpapiHostMsg_PPBInstance_IsFullFrame( 53 if (!dispatcher)
54 return PP_FALSE;
55
56 PP_Bool result = PP_FALSE;
57 dispatcher->Send(new PpapiHostMsg_PPBInstance_IsFullFrame(
44 INTERFACE_ID_PPB_INSTANCE, instance, &result)); 58 INTERFACE_ID_PPB_INSTANCE, instance, &result));
45 return result; 59 return result;
46 } 60 }
47 61
48 PP_Var ExecuteScript(PP_Instance instance, PP_Var script, PP_Var* exception) { 62 PP_Var ExecuteScript(PP_Instance instance, PP_Var script, PP_Var* exception) {
49 Dispatcher* dispatcher = PluginDispatcher::Get(); 63 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
64 if (!dispatcher)
65 return PP_MakeUndefined();
66
50 ReceiveSerializedException se(dispatcher, exception); 67 ReceiveSerializedException se(dispatcher, exception);
51 if (se.IsThrown()) 68 if (se.IsThrown())
52 return PP_MakeUndefined(); 69 return PP_MakeUndefined();
53 70
54 ReceiveSerializedVarReturnValue result; 71 ReceiveSerializedVarReturnValue result;
55 dispatcher->Send(new PpapiHostMsg_PPBInstance_ExecuteScript( 72 dispatcher->Send(new PpapiHostMsg_PPBInstance_ExecuteScript(
56 INTERFACE_ID_PPB_INSTANCE, instance, 73 INTERFACE_ID_PPB_INSTANCE, instance,
57 SerializedVarSendInput(dispatcher, script), &se, &result)); 74 SerializedVarSendInput(dispatcher, script), &se, &result));
58 return result.Return(dispatcher); 75 return result.Return(dispatcher);
59 } 76 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 SerializedVarOutParam out_exception, 150 SerializedVarOutParam out_exception,
134 SerializedVarReturnValue result) { 151 SerializedVarReturnValue result) {
135 result.Return(dispatcher(), ppb_instance_target()->ExecuteScript( 152 result.Return(dispatcher(), ppb_instance_target()->ExecuteScript(
136 instance, 153 instance,
137 script.Get(dispatcher()), 154 script.Get(dispatcher()),
138 out_exception.OutParam(dispatcher()))); 155 out_exception.OutParam(dispatcher())));
139 } 156 }
140 157
141 } // namespace proxy 158 } // namespace proxy
142 } // namespace pp 159 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_image_data_proxy.cc ('k') | ppapi/proxy/ppb_pdf_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698