Chromium Code Reviews| Index: ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_graphics_3d_rpc_server.cc |
| =================================================================== |
| --- ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_graphics_3d_rpc_server.cc (revision 98703) |
| +++ ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_graphics_3d_rpc_server.cc (working copy) |
| @@ -18,6 +18,8 @@ |
| #include "ppapi/c/dev/ppb_graphics_3d_dev.h" |
| #include "ppapi/c/dev/ppb_graphics_3d_trusted_dev.h" |
| #include "ppapi/c/pp_errors.h" |
| +#include "ppapi/c/private/ppb_gpu_blacklist_private.h" |
| +#include "ppapi/cpp/module.h" |
| #include "srpcgen/ppb_rpc.h" |
| using ppapi_proxy::DebugPrintf; |
| @@ -75,6 +77,17 @@ |
| return true; |
| } |
| +bool IsGpuBlacklisted() { |
| + pp::Module* module = pp::Module::Get(); |
| + CHECK(module); |
|
polina
2011/08/31 06:39:53
NaCl code usually goes for explicit != NULL and ==
Zhenyao Mo
2011/09/01 18:54:41
No longer use module to access interface
|
| + const PPB_GpuBlacklist_Private* interface = |
| + static_cast<const PPB_GpuBlacklist_Private*>( |
| + module->GetBrowserInterface(PPB_GPU_BLACKLIST_INTERFACE)); |
|
polina
2011/08/31 06:39:53
Can you switch to ppapi_proxy::GetBrowserInterface
Zhenyao Mo
2011/09/01 18:54:41
Done.
|
| + if (!interface) |
| + return true; // TODO(zmo): should we return true or false here? |
|
polina
2011/08/31 06:39:53
Is it normal for this private interface not to be
Zhenyao Mo
2011/09/01 18:54:41
I was hoping I could just CHECK here, but examples
polina
2011/09/02 09:56:52
In most other cases use GetBrowserInterfaceSafe wh
|
| + return interface->IsGpuBlacklisted(); |
| +} |
| + |
| } // namespace |
| //@{ |
| @@ -198,8 +211,12 @@ |
| attrib_list = NULL; |
| if (!ValidateAttribList(attrib_list_size, attrib_list)) |
| return; |
| - *resource_id = ppapi_proxy::PPBGraphics3DTrustedInterface()->CreateRaw( |
| - instance, share_context, attrib_list); |
| + if (IsGpuBlacklisted()) { |
| + *resource_id = 0; |
|
polina
2011/08/31 06:39:53
ppapi_proxy::kInvalidResourceId
Zhenyao Mo
2011/09/01 18:54:41
Done.
|
| + } else { |
| + *resource_id = ppapi_proxy::PPBGraphics3DTrustedInterface()->CreateRaw( |
| + instance, share_context, attrib_list); |
| + } |
| rpc->result = NACL_SRPC_RESULT_OK; |
| } |