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

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 upstream Created 8 years, 2 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
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 10 matching lines...) Expand all
21 #include "ppapi/proxy/plugin_dispatcher.h" 21 #include "ppapi/proxy/plugin_dispatcher.h"
22 #include "ppapi/proxy/plugin_proxy_delegate.h" 22 #include "ppapi/proxy/plugin_proxy_delegate.h"
23 #include "ppapi/proxy/ppapi_messages.h" 23 #include "ppapi/proxy/ppapi_messages.h"
24 #include "ppapi/proxy/ppb_flash_proxy.h" 24 #include "ppapi/proxy/ppb_flash_proxy.h"
25 #include "ppapi/proxy/serialized_var.h" 25 #include "ppapi/proxy/serialized_var.h"
26 #include "ppapi/shared_impl/ppapi_globals.h" 26 #include "ppapi/shared_impl/ppapi_globals.h"
27 #include "ppapi/shared_impl/ppb_url_util_shared.h" 27 #include "ppapi/shared_impl/ppb_url_util_shared.h"
28 #include "ppapi/shared_impl/ppb_view_shared.h" 28 #include "ppapi/shared_impl/ppb_view_shared.h"
29 #include "ppapi/shared_impl/var.h" 29 #include "ppapi/shared_impl/var.h"
30 #include "ppapi/thunk/enter.h" 30 #include "ppapi/thunk/enter.h"
31 #include "ppapi/thunk/ppb_graphics_2d_api.h"
32 #include "ppapi/thunk/ppb_graphics_3d_api.h"
31 #include "ppapi/thunk/thunk.h" 33 #include "ppapi/thunk/thunk.h"
32 34
33 // Windows headers interfere with this file. 35 // Windows headers interfere with this file.
34 #ifdef PostMessage 36 #ifdef PostMessage
35 #undef PostMessage 37 #undef PostMessage
36 #endif 38 #endif
37 39
38 using ppapi::thunk::EnterInstanceNoLock; 40 using ppapi::thunk::EnterInstanceNoLock;
39 using ppapi::thunk::EnterResourceNoLock; 41 using ppapi::thunk::EnterResourceNoLock;
42 using ppapi::thunk::PPB_Graphics2D_API;
43 using ppapi::thunk::PPB_Graphics3D_API;
40 using ppapi::thunk::PPB_Instance_API; 44 using ppapi::thunk::PPB_Instance_API;
41 45
42 namespace ppapi { 46 namespace ppapi {
43 namespace proxy { 47 namespace proxy {
44 48
45 namespace { 49 namespace {
46 50
47 InterfaceProxy* CreateInstanceProxy(Dispatcher* dispatcher) { 51 InterfaceProxy* CreateInstanceProxy(Dispatcher* dispatcher) {
48 return new PPB_Instance_Proxy(dispatcher); 52 return new PPB_Instance_Proxy(dispatcher);
49 } 53 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 } 193 }
190 194
191 PP_Bool PPB_Instance_Proxy::BindGraphics(PP_Instance instance, 195 PP_Bool PPB_Instance_Proxy::BindGraphics(PP_Instance instance,
192 PP_Resource device) { 196 PP_Resource device) {
193 Resource* object = 197 Resource* object =
194 PpapiGlobals::Get()->GetResourceTracker()->GetResource(device); 198 PpapiGlobals::Get()->GetResourceTracker()->GetResource(device);
195 if (!object || object->pp_instance() != instance) 199 if (!object || object->pp_instance() != instance)
196 return PP_FALSE; 200 return PP_FALSE;
197 201
198 PP_Bool result = PP_FALSE; 202 PP_Bool result = PP_FALSE;
199 dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics( 203
200 API_ID_PPB_INSTANCE, instance, object->host_resource(), 204 // We need to pass different resource to Graphics 2D and 3D right now. Once
201 &result)); 205 // 3D is migrated to the new design, we should be able to unify this.
206 EnterResourceNoLock<PPB_Graphics2D_API> enter_2d(device, false);
207 EnterResourceNoLock<PPB_Graphics3D_API> enter_3d(device, false);
208 if (enter_2d.succeeded()) {
209 dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics(
210 API_ID_PPB_INSTANCE, instance, object->pp_resource(),
211 &result));
212 } else if (enter_3d.succeeded()) {
213 dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics(
214 API_ID_PPB_INSTANCE, instance, object->host_resource().host_resource(),
215 &result));
216 }
202 return result; 217 return result;
203 } 218 }
204 219
205 PP_Bool PPB_Instance_Proxy::IsFullFrame(PP_Instance instance) { 220 PP_Bool PPB_Instance_Proxy::IsFullFrame(PP_Instance instance) {
206 PP_Bool result = PP_FALSE; 221 PP_Bool result = PP_FALSE;
207 dispatcher()->Send(new PpapiHostMsg_PPBInstance_IsFullFrame( 222 dispatcher()->Send(new PpapiHostMsg_PPBInstance_IsFullFrame(
208 API_ID_PPB_INSTANCE, instance, &result)); 223 API_ID_PPB_INSTANCE, instance, &result));
209 return result; 224 return result;
210 } 225 }
211 226
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 PP_Instance instance, 760 PP_Instance instance,
746 SerializedVarReturnValue result) { 761 SerializedVarReturnValue result) {
747 EnterInstanceNoLock enter(instance); 762 EnterInstanceNoLock enter(instance);
748 if (enter.succeeded()) { 763 if (enter.succeeded()) {
749 result.Return(dispatcher(), 764 result.Return(dispatcher(),
750 enter.functions()->GetOwnerElementObject(instance)); 765 enter.functions()->GetOwnerElementObject(instance));
751 } 766 }
752 } 767 }
753 768
754 void PPB_Instance_Proxy::OnHostMsgBindGraphics(PP_Instance instance, 769 void PPB_Instance_Proxy::OnHostMsgBindGraphics(PP_Instance instance,
755 const HostResource& device, 770 PP_Resource device,
756 PP_Bool* result) { 771 PP_Bool* result) {
757 EnterInstanceNoLock enter(instance); 772 EnterInstanceNoLock enter(instance);
758 if (enter.succeeded()) { 773 if (enter.succeeded()) {
759 *result = enter.functions()->BindGraphics(instance, 774 *result = enter.functions()->BindGraphics(instance, device);
760 device.host_resource());
761 } 775 }
762 } 776 }
763 777
764 void PPB_Instance_Proxy::OnHostMsgGetAudioHardwareOutputSampleRate( 778 void PPB_Instance_Proxy::OnHostMsgGetAudioHardwareOutputSampleRate(
765 PP_Instance instance, uint32_t* result) { 779 PP_Instance instance, uint32_t* result) {
766 EnterInstanceNoLock enter(instance); 780 EnterInstanceNoLock enter(instance);
767 if (enter.succeeded()) 781 if (enter.succeeded())
768 *result = enter.functions()->GetAudioHardwareOutputSampleRate(instance); 782 *result = enter.functions()->GetAudioHardwareOutputSampleRate(instance);
769 } 783 }
770 784
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 PP_Instance instance) { 1141 PP_Instance instance) {
1128 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> 1142 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
1129 GetInstanceData(instance); 1143 GetInstanceData(instance);
1130 if (!data) 1144 if (!data)
1131 return; // Instance was probably deleted. 1145 return; // Instance was probably deleted.
1132 data->should_do_request_surrounding_text = false; 1146 data->should_do_request_surrounding_text = false;
1133 } 1147 }
1134 1148
1135 } // namespace proxy 1149 } // namespace proxy
1136 } // namespace ppapi 1150 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698