summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorzmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-02 16:24:08 +0000
committerzmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-02 16:24:08 +0000
commit6717c9495b01bd7c06eeb8973f1fef84791344ea (patch)
tree1db35723830dc366a623cc75afd9ed28464f403d /ppapi
parent2d2b1d8d1edef8b97e27c85f9ee98174549becda (diff)
downloadchromium_src-6717c9495b01bd7c06eeb8973f1fef84791344ea.zip
chromium_src-6717c9495b01bd7c06eeb8973f1fef84791344ea.tar.gz
chromium_src-6717c9495b01bd7c06eeb8973f1fef84791344ea.tar.bz2
Hookup Gpu blacklist with NaCl Pepper3D access.
If WebGL is blacklisted, we should not allow NaCl to have Pepper 3D access. However, we still want trusted Apps like Flash or Netflix player to go through. BUG=93899 TEST=no NaCl Pepper 3D access if the driver/card is blacklisted for WebGL Review URL: http://codereview.chromium.org/7790016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99383 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/c/private/ppb_gpu_blacklist_private.h19
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_graphics_3d_rpc_server.cc16
-rw-r--r--ppapi/ppapi_cpp.gypi1
-rw-r--r--ppapi/tests/all_c_includes.h3
4 files changed, 36 insertions, 3 deletions
diff --git a/ppapi/c/private/ppb_gpu_blacklist_private.h b/ppapi/c/private/ppb_gpu_blacklist_private.h
new file mode 100644
index 0000000..0ce40b6
--- /dev/null
+++ b/ppapi/c/private/ppb_gpu_blacklist_private.h
@@ -0,0 +1,19 @@
+/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#ifndef PPAPI_C_PRIVATE_PPB_GPU_BLACKLIST_PRIVATE_H_
+#define PPAPI_C_PRIVATE_PPB_GPU_BLACKLIST_PRIVATE_H_
+
+#define PPB_GPU_BLACKLIST_INTERFACE "PPB_GpuBlacklist_Private;0.1"
+
+struct PPB_GpuBlacklist_Private {
+ /*
+ * IsGpuBlacklisted is a pointer to a function which answers if untrusted
+ * NativeClient applications can access Pepper 3D or not.
+ */
+ bool (*IsGpuBlacklisted)();
+};
+
+#endif /* PPAPI_C_PRIVATE_PPB_GPU_BLACKLIST_PRIVATE_H_ */
+
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_graphics_3d_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_graphics_3d_rpc_server.cc
index ef97e63..26e6adc 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_graphics_3d_rpc_server.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_graphics_3d_rpc_server.cc
@@ -18,6 +18,7 @@
#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 "srpcgen/ppb_rpc.h"
using ppapi_proxy::DebugPrintf;
@@ -75,6 +76,13 @@ bool ValidateAndCopyAttribList(nacl_abi_size_t in_attrib_list_count,
return true;
}
+bool IsGpuBlacklisted() {
+ static const PPB_GpuBlacklist_Private* interface =
+ static_cast<const PPB_GpuBlacklist_Private*>(
+ ppapi_proxy::GetBrowserInterfaceSafe(PPB_GPU_BLACKLIST_INTERFACE));
+ return interface->IsGpuBlacklisted();
+}
+
} // namespace
//@{
@@ -183,8 +191,12 @@ void PpbGraphics3DRpcServer::PPB_Graphics3DTrusted_CreateRaw(
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 = ppapi_proxy::kInvalidResourceId;
+ } else {
+ *resource_id = ppapi_proxy::PPBGraphics3DTrustedInterface()->CreateRaw(
+ instance, share_context, attrib_list);
+ }
rpc->result = NACL_SRPC_RESULT_OK;
}
diff --git a/ppapi/ppapi_cpp.gypi b/ppapi/ppapi_cpp.gypi
index 5debaed..42cfece 100644
--- a/ppapi/ppapi_cpp.gypi
+++ b/ppapi/ppapi_cpp.gypi
@@ -95,6 +95,7 @@
'c/private/ppb_flash_menu.h',
'c/private/ppb_flash_net_connector.h',
'c/private/ppb_flash_tcp_socket.h',
+ 'c/private/ppb_gpu_blacklist_private.h',
'c/private/ppb_instance_private.h',
'c/private/ppb_nacl_private.h',
'c/private/ppb_pdf.h',
diff --git a/ppapi/tests/all_c_includes.h b/ppapi/tests/all_c_includes.h
index bd538aa..4303bf2 100644
--- a/ppapi/tests/all_c_includes.h
+++ b/ppapi/tests/all_c_includes.h
@@ -89,13 +89,14 @@
#include "ppapi/c/private/ppb_flash.h"
#include "ppapi/c/private/ppb_flash_menu.h"
#include "ppapi/c/private/ppb_flash_tcp_socket.h"
+#include "ppapi/c/private/ppb_gpu_blacklist_private.h"
#include "ppapi/c/private/ppb_instance_private.h"
#include "ppapi/c/private/ppb_nacl_private.h"
#include "ppapi/c/private/ppb_pdf.h"
-#include "ppapi/c/private/ppp_instance_private.h"
#include "ppapi/c/private/ppb_uma_private.h"
#include "ppapi/c/trusted/ppb_audio_trusted.h"
#include "ppapi/c/trusted/ppb_image_data_trusted.h"
#include "ppapi/c/trusted/ppb_url_loader_trusted.h"
+#include "ppapi/c/private/ppp_instance_private.h"
#endif /* PPAPI_TESTS_ALL_C_INCLUDES_H_ */