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

Unified 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, 1 month 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppb_instance_proxy.cc
diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc
index cb8389051226f958fd05363f56c29527a1849c14..99030c3e0113fc4afe56d032a83587503cfad624 100644
--- a/ppapi/proxy/ppb_instance_proxy.cc
+++ b/ppapi/proxy/ppb_instance_proxy.cc
@@ -29,6 +29,8 @@
#include "ppapi/shared_impl/ppb_view_shared.h"
#include "ppapi/shared_impl/var.h"
#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_graphics_2d_api.h"
+#include "ppapi/thunk/ppb_graphics_3d_api.h"
#include "ppapi/thunk/thunk.h"
// Windows headers interfere with this file.
@@ -38,6 +40,8 @@
using ppapi::thunk::EnterInstanceNoLock;
using ppapi::thunk::EnterResourceNoLock;
+using ppapi::thunk::PPB_Graphics2D_API;
+using ppapi::thunk::PPB_Graphics3D_API;
using ppapi::thunk::PPB_Instance_API;
namespace ppapi {
@@ -198,17 +202,30 @@ PP_Bool PPB_Instance_Proxy::BindGraphics(PP_Instance instance,
// If device is 0, pass a null HostResource. This signals the host to unbind
// all devices.
HostResource host_resource;
+ PP_Resource pp_resource = 0;
if (device) {
Resource* resource =
PpapiGlobals::Get()->GetResourceTracker()->GetResource(device);
if (!resource || resource->pp_instance() != instance)
return PP_FALSE;
host_resource = resource->host_resource();
+ pp_resource = resource->pp_resource();
}
+ // We need to pass different resource to Graphics 2D and 3D right now. Once
+ // 3D is migrated to the new design, we should be able to unify this.
PP_Bool result = PP_FALSE;
- dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics(
- API_ID_PPB_INSTANCE, instance, host_resource, &result));
+ EnterResourceNoLock<PPB_Graphics2D_API> enter_2d(device, false);
+ EnterResourceNoLock<PPB_Graphics3D_API> enter_3d(device, false);
+ if (enter_2d.succeeded()) {
+ dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics(
+ API_ID_PPB_INSTANCE, instance, pp_resource,
+ &result));
+ } else if (enter_3d.succeeded()) {
+ dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics(
+ API_ID_PPB_INSTANCE, instance, host_resource.host_resource(),
+ &result));
+ }
return result;
}
@@ -808,12 +825,11 @@ void PPB_Instance_Proxy::OnHostMsgGetOwnerElementObject(
}
void PPB_Instance_Proxy::OnHostMsgBindGraphics(PP_Instance instance,
- const HostResource& device,
+ PP_Resource device,
PP_Bool* result) {
EnterInstanceNoLock enter(instance);
if (enter.succeeded()) {
- *result = enter.functions()->BindGraphics(instance,
- device.host_resource());
+ *result = enter.functions()->BindGraphics(instance, device);
}
}
« 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