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

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

Issue 11053003: Migrate Graphics2D to new design. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase 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
« no previous file with comments | « ppapi/proxy/ppb_instance_proxy.h ('k') | ppapi/proxy/ppb_testing_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) 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 #include "ppapi/proxy/ppb_instance_proxy.h" 5 #include "ppapi/proxy/ppb_instance_proxy.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "ppapi/c/pp_errors.h" 8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/pp_time.h" 9 #include "ppapi/c/pp_time.h"
10 #include "ppapi/c/pp_var.h" 10 #include "ppapi/c/pp_var.h"
(...skipping 11 matching lines...) Expand all
22 #include "ppapi/proxy/plugin_dispatcher.h" 22 #include "ppapi/proxy/plugin_dispatcher.h"
23 #include "ppapi/proxy/plugin_proxy_delegate.h" 23 #include "ppapi/proxy/plugin_proxy_delegate.h"
24 #include "ppapi/proxy/ppapi_messages.h" 24 #include "ppapi/proxy/ppapi_messages.h"
25 #include "ppapi/proxy/ppb_flash_proxy.h" 25 #include "ppapi/proxy/ppb_flash_proxy.h"
26 #include "ppapi/proxy/serialized_var.h" 26 #include "ppapi/proxy/serialized_var.h"
27 #include "ppapi/shared_impl/ppapi_globals.h" 27 #include "ppapi/shared_impl/ppapi_globals.h"
28 #include "ppapi/shared_impl/ppb_url_util_shared.h" 28 #include "ppapi/shared_impl/ppb_url_util_shared.h"
29 #include "ppapi/shared_impl/ppb_view_shared.h" 29 #include "ppapi/shared_impl/ppb_view_shared.h"
30 #include "ppapi/shared_impl/var.h" 30 #include "ppapi/shared_impl/var.h"
31 #include "ppapi/thunk/enter.h" 31 #include "ppapi/thunk/enter.h"
32 #include "ppapi/thunk/ppb_graphics_2d_api.h"
33 #include "ppapi/thunk/ppb_graphics_3d_api.h"
32 #include "ppapi/thunk/thunk.h" 34 #include "ppapi/thunk/thunk.h"
33 35
34 // Windows headers interfere with this file. 36 // Windows headers interfere with this file.
35 #ifdef PostMessage 37 #ifdef PostMessage
36 #undef PostMessage 38 #undef PostMessage
37 #endif 39 #endif
38 40
39 using ppapi::thunk::EnterInstanceNoLock; 41 using ppapi::thunk::EnterInstanceNoLock;
40 using ppapi::thunk::EnterResourceNoLock; 42 using ppapi::thunk::EnterResourceNoLock;
43 using ppapi::thunk::PPB_Graphics2D_API;
44 using ppapi::thunk::PPB_Graphics3D_API;
41 using ppapi::thunk::PPB_Instance_API; 45 using ppapi::thunk::PPB_Instance_API;
42 46
43 namespace ppapi { 47 namespace ppapi {
44 namespace proxy { 48 namespace proxy {
45 49
46 namespace { 50 namespace {
47 51
48 InterfaceProxy* CreateInstanceProxy(Dispatcher* dispatcher) { 52 InterfaceProxy* CreateInstanceProxy(Dispatcher* dispatcher) {
49 return new PPB_Instance_Proxy(dispatcher); 53 return new PPB_Instance_Proxy(dispatcher);
50 } 54 }
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 IPC_MESSAGE_UNHANDLED(handled = false) 195 IPC_MESSAGE_UNHANDLED(handled = false)
192 IPC_END_MESSAGE_MAP() 196 IPC_END_MESSAGE_MAP()
193 return handled; 197 return handled;
194 } 198 }
195 199
196 PP_Bool PPB_Instance_Proxy::BindGraphics(PP_Instance instance, 200 PP_Bool PPB_Instance_Proxy::BindGraphics(PP_Instance instance,
197 PP_Resource device) { 201 PP_Resource device) {
198 // If device is 0, pass a null HostResource. This signals the host to unbind 202 // If device is 0, pass a null HostResource. This signals the host to unbind
199 // all devices. 203 // all devices.
200 HostResource host_resource; 204 HostResource host_resource;
205 PP_Resource pp_resource = 0;
201 if (device) { 206 if (device) {
202 Resource* resource = 207 Resource* resource =
203 PpapiGlobals::Get()->GetResourceTracker()->GetResource(device); 208 PpapiGlobals::Get()->GetResourceTracker()->GetResource(device);
204 if (!resource || resource->pp_instance() != instance) 209 if (!resource || resource->pp_instance() != instance)
205 return PP_FALSE; 210 return PP_FALSE;
206 host_resource = resource->host_resource(); 211 host_resource = resource->host_resource();
212 pp_resource = resource->pp_resource();
207 } 213 }
208 214
215 // We need to pass different resource to Graphics 2D and 3D right now. Once
216 // 3D is migrated to the new design, we should be able to unify this.
209 PP_Bool result = PP_FALSE; 217 PP_Bool result = PP_FALSE;
210 dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics( 218 EnterResourceNoLock<PPB_Graphics2D_API> enter_2d(device, false);
211 API_ID_PPB_INSTANCE, instance, host_resource, &result)); 219 EnterResourceNoLock<PPB_Graphics3D_API> enter_3d(device, false);
220 if (enter_2d.succeeded()) {
221 dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics(
222 API_ID_PPB_INSTANCE, instance, pp_resource,
223 &result));
224 } else if (enter_3d.succeeded()) {
225 dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics(
226 API_ID_PPB_INSTANCE, instance, host_resource.host_resource(),
227 &result));
228 }
212 return result; 229 return result;
213 } 230 }
214 231
215 PP_Bool PPB_Instance_Proxy::IsFullFrame(PP_Instance instance) { 232 PP_Bool PPB_Instance_Proxy::IsFullFrame(PP_Instance instance) {
216 PP_Bool result = PP_FALSE; 233 PP_Bool result = PP_FALSE;
217 dispatcher()->Send(new PpapiHostMsg_PPBInstance_IsFullFrame( 234 dispatcher()->Send(new PpapiHostMsg_PPBInstance_IsFullFrame(
218 API_ID_PPB_INSTANCE, instance, &result)); 235 API_ID_PPB_INSTANCE, instance, &result));
219 return result; 236 return result;
220 } 237 }
221 238
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 PP_Instance instance, 818 PP_Instance instance,
802 SerializedVarReturnValue result) { 819 SerializedVarReturnValue result) {
803 EnterInstanceNoLock enter(instance); 820 EnterInstanceNoLock enter(instance);
804 if (enter.succeeded()) { 821 if (enter.succeeded()) {
805 result.Return(dispatcher(), 822 result.Return(dispatcher(),
806 enter.functions()->GetOwnerElementObject(instance)); 823 enter.functions()->GetOwnerElementObject(instance));
807 } 824 }
808 } 825 }
809 826
810 void PPB_Instance_Proxy::OnHostMsgBindGraphics(PP_Instance instance, 827 void PPB_Instance_Proxy::OnHostMsgBindGraphics(PP_Instance instance,
811 const HostResource& device, 828 PP_Resource device,
812 PP_Bool* result) { 829 PP_Bool* result) {
813 EnterInstanceNoLock enter(instance); 830 EnterInstanceNoLock enter(instance);
814 if (enter.succeeded()) { 831 if (enter.succeeded()) {
815 *result = enter.functions()->BindGraphics(instance, 832 *result = enter.functions()->BindGraphics(instance, device);
816 device.host_resource());
817 } 833 }
818 } 834 }
819 835
820 void PPB_Instance_Proxy::OnHostMsgGetAudioHardwareOutputSampleRate( 836 void PPB_Instance_Proxy::OnHostMsgGetAudioHardwareOutputSampleRate(
821 PP_Instance instance, uint32_t* result) { 837 PP_Instance instance, uint32_t* result) {
822 EnterInstanceNoLock enter(instance); 838 EnterInstanceNoLock enter(instance);
823 if (enter.succeeded()) 839 if (enter.succeeded())
824 *result = enter.functions()->GetAudioHardwareOutputSampleRate(instance); 840 *result = enter.functions()->GetAudioHardwareOutputSampleRate(instance);
825 } 841 }
826 842
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 PP_Instance instance) { 1208 PP_Instance instance) {
1193 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> 1209 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
1194 GetInstanceData(instance); 1210 GetInstanceData(instance);
1195 if (!data) 1211 if (!data)
1196 return; // Instance was probably deleted. 1212 return; // Instance was probably deleted.
1197 data->should_do_request_surrounding_text = false; 1213 data->should_do_request_surrounding_text = false;
1198 } 1214 }
1199 1215
1200 } // namespace proxy 1216 } // namespace proxy
1201 } // namespace ppapi 1217 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_instance_proxy.h ('k') | ppapi/proxy/ppb_testing_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698