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

Unified Diff: ppapi/proxy/ppb_graphics_3d_proxy.cc

Issue 10386145: Add the necessary plumbing mechanisms to ensure proper WebGL support inside the <browser> tag, whic… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address comments; clean up; fix bugs. Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: ppapi/proxy/ppb_graphics_3d_proxy.cc
diff --git a/ppapi/proxy/ppb_graphics_3d_proxy.cc b/ppapi/proxy/ppb_graphics_3d_proxy.cc
index 2a708a36dbd49d4bdf0a694722c8d040c09e99a5..671b60cbe27e8798c1d9e1662e315e61750ae8da 100644
--- a/ppapi/proxy/ppb_graphics_3d_proxy.cc
+++ b/ppapi/proxy/ppb_graphics_3d_proxy.cc
@@ -146,17 +146,12 @@ PPB_Graphics3D_Proxy::~PPB_Graphics3D_Proxy() {
// static
PP_Resource PPB_Graphics3D_Proxy::CreateProxyResource(
PP_Instance instance,
- PP_Resource share_context,
+ PPB_Graphics3D_API* share_context,
const int32_t* attrib_list) {
PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
if (!dispatcher)
return PP_ERROR_BADARGUMENT;
- // TODO(alokp): Support shared context.
- DCHECK_EQ(0, share_context);
- if (share_context != 0)
- return 0;
-
std::vector<int32_t> attribs;
if (attrib_list) {
for (const int32_t* attr = attrib_list;
@@ -168,9 +163,13 @@ PP_Resource PPB_Graphics3D_Proxy::CreateProxyResource(
}
attribs.push_back(PP_GRAPHICS3DATTRIB_NONE);
+ HostResource share_host;
+ if (share_context)
+ share_host = static_cast<Graphics3D*>(share_context)->host_resource();
+
HostResource result;
dispatcher->Send(new PpapiHostMsg_PPBGraphics3D_Create(
- API_ID_PPB_GRAPHICS_3D, instance, attribs, &result));
+ API_ID_PPB_GRAPHICS_3D, instance, share_host, attribs, &result));
if (result.is_null())
return 0;
@@ -214,16 +213,28 @@ bool PPB_Graphics3D_Proxy::OnMessageReceived(const IPC::Message& msg) {
}
void PPB_Graphics3D_Proxy::OnMsgCreate(PP_Instance instance,
+ HostResource share_context,
const std::vector<int32_t>& attribs,
HostResource* result) {
if (attribs.empty() || attribs.back() != PP_GRAPHICS3DATTRIB_NONE)
return; // Bad message.
thunk::EnterResourceCreation enter(instance);
+ PPB_Graphics3D_API *share_api = NULL;
+ if (share_context.host_resource() != 0) {
+ thunk::EnterResource<thunk::PPB_Graphics3D_API>
+ enter_share(share_context.host_resource(), true);
+ if (!enter_share.succeeded())
+ return;
+ share_api = enter_share.object();
+ }
+
if (enter.succeeded()) {
result->SetHostResource(
- instance,
- enter.functions()->CreateGraphics3DRaw(instance, 0, &attribs.front()));
+ instance,
+ enter.functions()->CreateGraphics3DRaw(instance,
+ share_api,
+ &attribs.front()));
}
}

Powered by Google App Engine
This is Rietveld 408576698