summaryrefslogtreecommitdiff
path: root/ppapi
diff options
context:
space:
mode:
authorTorne (Richard Coles) <torne@google.com>2013-08-23 16:39:15 +0100
committerTorne (Richard Coles) <torne@google.com>2013-08-23 16:39:15 +0100
commit3551c9c881056c480085172ff9840cab31610854 (patch)
tree23660320f5f4c279966609cf9da7491b96d10ca8 /ppapi
parent4e9d9adbbb6cf287125ca44a0823791a570472f5 (diff)
downloadchromium_org-3551c9c881056c480085172ff9840cab31610854.tar.gz
Merge from Chromium at DEPS revision r219274
This commit was generated by merge_to_master.py. Change-Id: Ibb7f41396cadf4071e89153e1913c986d126f65d
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/OWNERS1
-rw-r--r--ppapi/api/ppb_file_ref.idl2
-rw-r--r--ppapi/api/private/ppb_gpu_blacklist_private.idl23
-rw-r--r--ppapi/api/private/ppb_nacl_private.idl4
-rw-r--r--ppapi/c/ppb_file_ref.h4
-rw-r--r--ppapi/c/private/ppb_gpu_blacklist_private.h49
-rw-r--r--ppapi/c/private/ppb_nacl_private.h6
-rw-r--r--ppapi/cpp/file_ref.h2
-rw-r--r--ppapi/examples/ime/ime.cc3
-rw-r--r--ppapi/examples/video_decode/video_decode.cc1
-rw-r--r--ppapi/native_client/src/trusted/plugin/json_manifest.cc19
-rw-r--r--ppapi/native_client/src/trusted/plugin/module_ppapi.cc22
-rw-r--r--ppapi/native_client/src/trusted/plugin/module_ppapi.h11
-rw-r--r--ppapi/native_client/src/trusted/plugin/nacl_entry_points.h1
-rw-r--r--ppapi/native_client/src/trusted/plugin/plugin.cc49
-rw-r--r--ppapi/native_client/src/trusted/plugin/plugin.h1
-rw-r--r--ppapi/native_client/src/trusted/plugin/plugin_error.h4
-rw-r--r--ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc2
-rw-r--r--ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h1
-rw-r--r--ppapi/native_client/src/trusted/plugin/service_runtime.cc37
-rw-r--r--ppapi/native_client/src/trusted/plugin/service_runtime.h7
-rw-r--r--ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c11
-rwxr-xr-xppapi/native_client/tools/browser_tester/browser_tester.py13
-rwxr-xr-xppapi/native_client/tools/browser_tester/browsertester/browserlauncher.py12
-rwxr-xr-xppapi/native_client/tools/browser_tester/browsertester/browserprocess.py8
-rw-r--r--ppapi/ppapi_ipc_untrusted.gyp2
-rw-r--r--ppapi/ppapi_proxy_untrusted.gyp2
-rw-r--r--ppapi/ppapi_shared_untrusted.gyp2
-rw-r--r--ppapi/ppapi_sources.gypi1
-rw-r--r--ppapi/ppapi_tests.gypi3
-rw-r--r--ppapi/proxy/plugin_resource_tracker.cc1
-rw-r--r--ppapi/proxy/ppapi_messages.h22
-rw-r--r--ppapi/shared_impl/id_assignment.h2
-rw-r--r--ppapi/shared_impl/ppb_graphics_3d_shared.cc3
-rw-r--r--ppapi/shared_impl/ppb_image_data_shared.cc7
-rw-r--r--ppapi/shared_impl/resource_tracker.cc45
-rw-r--r--ppapi/shared_impl/resource_tracker.h20
-rw-r--r--ppapi/tests/all_c_includes.h1
-rw-r--r--ppapi/tests/test_case.cc1
-rw-r--r--ppapi/tests/test_char_set.cc2
-rw-r--r--ppapi/thunk/interfaces_legacy.h2
41 files changed, 183 insertions, 226 deletions
diff --git a/ppapi/OWNERS b/ppapi/OWNERS
index a114912608..c4871e2a78 100644
--- a/ppapi/OWNERS
+++ b/ppapi/OWNERS
@@ -1,3 +1,4 @@
+bbudge@chromium.org
brettw@chromium.org
dmichael@chromium.org
raymes@chromium.org
diff --git a/ppapi/api/ppb_file_ref.idl b/ppapi/api/ppb_file_ref.idl
index 8e4b81d6cd..d9226471a9 100644
--- a/ppapi/api/ppb_file_ref.idl
+++ b/ppapi/api/ppb_file_ref.idl
@@ -25,7 +25,7 @@ interface PPB_FileRef {
*
* @param[in] resource A <code>PP_Resource</code> corresponding to a file
* system.
- * @param[in] path A path to the file.
+ * @param[in] path A path to the file. Must begin with a '/' character.
*
* @return A <code>PP_Resource</code> corresponding to a file reference if
* successful or 0 if the path is malformed.
diff --git a/ppapi/api/private/ppb_gpu_blacklist_private.idl b/ppapi/api/private/ppb_gpu_blacklist_private.idl
deleted file mode 100644
index ef8e1b5f0b..0000000000
--- a/ppapi/api/private/ppb_gpu_blacklist_private.idl
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright (c) 2012 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.
- */
-
-/* This file contains the <code>PPB_FileRefPrivate</code> interface. */
-label Chrome {
- M24 = 0.2
-};
-
-/** PPB_GpuBlacklist_Private interface */
-interface PPB_GpuBlacklist_Private {
- /**
- * Returns true if the current system's GPU is blacklisted and 3D in Chrome
- * will be emulated via software rendering.
- *
- * This is used internally by the SRPC NaCl proxy (not exposed to plugins) to
- * determine if the 3D interfaces should be exposed to plugins. We don't
- * expose the 3D interfaces if the 3D support is software-emulated. When the
- * SRPC proxy is removed, this interface can also be removed.
- */
- PP_Bool IsGpuBlacklisted();
-};
diff --git a/ppapi/api/private/ppb_nacl_private.idl b/ppapi/api/private/ppb_nacl_private.idl
index bf2918b257..9a67404f64 100644
--- a/ppapi/api/private/ppb_nacl_private.idl
+++ b/ppapi/api/private/ppb_nacl_private.idl
@@ -35,6 +35,9 @@ interface PPB_NaCl_Private {
* will be able to use dynamic code system calls (e.g., mmap with PROT_EXEC).
* The |enable_exception_handling| flag indicates whether or not the nexe
* will be able to use hardware exception handling.
+ * The |enable_crash_throttling| flag indicates whether or not crashes of
+ * the nexe contribute to crash throttling statisics and whether nexe starts
+ * are throttled by crash throttling.
*/
PP_ExternalPluginResult LaunchSelLdr([in] PP_Instance instance,
[in] str_t alleged_url,
@@ -43,6 +46,7 @@ interface PPB_NaCl_Private {
[in] PP_Bool enable_ppapi_dev,
[in] PP_Bool enable_dyncode_syscalls,
[in] PP_Bool enable_exception_handling,
+ [in] PP_Bool enable_crash_throttling,
[out] mem_t imc_handle,
[out] PP_Var error_message);
diff --git a/ppapi/c/ppb_file_ref.h b/ppapi/c/ppb_file_ref.h
index 0f35e2c937..873ef18886 100644
--- a/ppapi/c/ppb_file_ref.h
+++ b/ppapi/c/ppb_file_ref.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From ppb_file_ref.idl modified Wed May 22 15:08:49 2013. */
+/* From ppb_file_ref.idl modified Thu Aug 15 10:50:43 2013. */
#ifndef PPAPI_C_PPB_FILE_REF_H_
#define PPAPI_C_PPB_FILE_REF_H_
@@ -45,7 +45,7 @@ struct PPB_FileRef_1_1 {
*
* @param[in] resource A <code>PP_Resource</code> corresponding to a file
* system.
- * @param[in] path A path to the file.
+ * @param[in] path A path to the file. Must begin with a '/' character.
*
* @return A <code>PP_Resource</code> corresponding to a file reference if
* successful or 0 if the path is malformed.
diff --git a/ppapi/c/private/ppb_gpu_blacklist_private.h b/ppapi/c/private/ppb_gpu_blacklist_private.h
deleted file mode 100644
index f37106ef34..0000000000
--- a/ppapi/c/private/ppb_gpu_blacklist_private.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright (c) 2012 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.
- */
-
-/* From private/ppb_gpu_blacklist_private.idl,
- * modified Wed Oct 24 14:41:20 2012.
- */
-
-#ifndef PPAPI_C_PRIVATE_PPB_GPU_BLACKLIST_PRIVATE_H_
-#define PPAPI_C_PRIVATE_PPB_GPU_BLACKLIST_PRIVATE_H_
-
-#include "ppapi/c/pp_bool.h"
-#include "ppapi/c/pp_macros.h"
-
-#define PPB_GPUBLACKLIST_PRIVATE_INTERFACE_0_2 "PPB_GpuBlacklist_Private;0.2"
-#define PPB_GPUBLACKLIST_PRIVATE_INTERFACE \
- PPB_GPUBLACKLIST_PRIVATE_INTERFACE_0_2
-
-/**
- * @file
- * This file contains the <code>PPB_FileRefPrivate</code> interface. */
-
-
-/**
- * @addtogroup Interfaces
- * @{
- */
-/** PPB_GpuBlacklist_Private interface */
-struct PPB_GpuBlacklist_Private_0_2 {
- /**
- * Returns true if the current system's GPU is blacklisted and 3D in Chrome
- * will be emulated via software rendering.
- *
- * This is used internally by the SRPC NaCl proxy (not exposed to plugins) to
- * determine if the 3D interfaces should be exposed to plugins. We don't
- * expose the 3D interfaces if the 3D support is software-emulated. When the
- * SRPC proxy is removed, this interface can also be removed.
- */
- PP_Bool (*IsGpuBlacklisted)(void);
-};
-
-typedef struct PPB_GpuBlacklist_Private_0_2 PPB_GpuBlacklist_Private;
-/**
- * @}
- */
-
-#endif /* PPAPI_C_PRIVATE_PPB_GPU_BLACKLIST_PRIVATE_H_ */
-
diff --git a/ppapi/c/private/ppb_nacl_private.h b/ppapi/c/private/ppb_nacl_private.h
index 8be2829338..772998bd6b 100644
--- a/ppapi/c/private/ppb_nacl_private.h
+++ b/ppapi/c/private/ppb_nacl_private.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From private/ppb_nacl_private.idl modified Tue Aug 6 11:51:26 2013. */
+/* From private/ppb_nacl_private.idl modified Mon Aug 19 14:06:38 2013. */
#ifndef PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
#define PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
@@ -63,6 +63,9 @@ struct PPB_NaCl_Private_1_0 {
* will be able to use dynamic code system calls (e.g., mmap with PROT_EXEC).
* The |enable_exception_handling| flag indicates whether or not the nexe
* will be able to use hardware exception handling.
+ * The |enable_crash_throttling| flag indicates whether or not crashes of
+ * the nexe contribute to crash throttling statisics and whether nexe starts
+ * are throttled by crash throttling.
*/
PP_ExternalPluginResult (*LaunchSelLdr)(PP_Instance instance,
const char* alleged_url,
@@ -71,6 +74,7 @@ struct PPB_NaCl_Private_1_0 {
PP_Bool enable_ppapi_dev,
PP_Bool enable_dyncode_syscalls,
PP_Bool enable_exception_handling,
+ PP_Bool enable_crash_throttling,
void* imc_handle,
struct PP_Var* error_message);
/* This function starts the IPC proxy so the nexe can communicate with the
diff --git a/ppapi/cpp/file_ref.h b/ppapi/cpp/file_ref.h
index d229c5fd7a..56828f7e64 100644
--- a/ppapi/cpp/file_ref.h
+++ b/ppapi/cpp/file_ref.h
@@ -48,7 +48,7 @@ class FileRef : public Resource {
///
/// @param[in] file_system A <code>FileSystem</code> corresponding to a file
/// system type.
- /// @param[in] path A path to the file.
+ /// @param[in] path A path to the file. Must begin with a '/' character.
FileRef(const FileSystem& file_system, const char* path);
/// The copy constructor for <code>FileRef</code>.
diff --git a/ppapi/examples/ime/ime.cc b/ppapi/examples/ime/ime.cc
index e730786847..27215199d0 100644
--- a/ppapi/examples/ime/ime.cc
+++ b/ppapi/examples/ime/ime.cc
@@ -128,7 +128,8 @@ class MyTextField {
area_(x, y, width, height),
font_size_(height - 2),
caret_pos_(std::string::npos),
- anchor_pos_(std::string::npos) {
+ anchor_pos_(std::string::npos),
+ target_segment_(0) {
pp::FontDescription_Dev desc;
desc.set_family(PP_FONTFAMILY_SANSSERIF);
desc.set_size(font_size_);
diff --git a/ppapi/examples/video_decode/video_decode.cc b/ppapi/examples/video_decode/video_decode.cc
index e6bcff82f1..d1f7181ded 100644
--- a/ppapi/examples/video_decode/video_decode.cc
+++ b/ppapi/examples/video_decode/video_decode.cc
@@ -221,6 +221,7 @@ VideoDecodeDemoInstance::VideoDecodeDemoInstance(PP_Instance instance,
pp::Module* module)
: pp::Instance(instance), pp::Graphics3DClient(this),
pp::VideoDecoderClient_Dev(this),
+ is_painting_(false),
num_frames_rendered_(0),
first_frame_delivered_ticks_(-1),
swap_ticks_(0),
diff --git a/ppapi/native_client/src/trusted/plugin/json_manifest.cc b/ppapi/native_client/src/trusted/plugin/json_manifest.cc
index 12d3c10d19..0928c05f2c 100644
--- a/ppapi/native_client/src/trusted/plugin/json_manifest.cc
+++ b/ppapi/native_client/src/trusted/plugin/json_manifest.cc
@@ -173,6 +173,15 @@ bool IsValidUrlSpec(const Json::Value& url_spec,
urlSpecPlusOptional = kPnaclUrlSpecPlusOptional;
urlSpecPlusOptionalLength = NACL_ARRAY_SIZE(kPnaclUrlSpecPlusOptional);
} else {
+ // URL specifications must not contain "pnacl-translate" keys.
+ // This prohibits NaCl clients from invoking PNaCl.
+ if (url_spec.isMember(kPnaclTranslateKey)) {
+ nacl::stringstream error_stream;
+ error_stream << "PNaCl-like NMF with application/x-nacl mimetype instead "
+ << "of x-pnacl mimetype (has " << kPnaclTranslateKey << ").";
+ *error_string = error_stream.str();
+ return false;
+ }
urlSpecPlusOptional = kManifestUrlSpecRequired;
urlSpecPlusOptionalLength = NACL_ARRAY_SIZE(kManifestUrlSpecRequired);
}
@@ -184,16 +193,6 @@ bool IsValidUrlSpec(const Json::Value& url_spec,
error_string)) {
return false;
}
- // URL specifications must not contain "pnacl-translate" keys.
- // This prohibits NaCl clients from invoking PNaCl.
- Json::Value translate = url_spec[kPnaclTranslateKey];
- if (!translate.empty()) {
- nacl::stringstream error_stream;
- error_stream << parent_key << " property '" << container_key <<
- "' has '" << kPnaclTranslateKey << "' inside URL spec.";
- *error_string = error_stream.str();
- return false;
- }
// Verify the correct types of the fields if they exist.
Json::Value url = url_spec[kUrlKey];
if (!url.isString()) {
diff --git a/ppapi/native_client/src/trusted/plugin/module_ppapi.cc b/ppapi/native_client/src/trusted/plugin/module_ppapi.cc
index 4204ed4637..f78bbf3202 100644
--- a/ppapi/native_client/src/trusted/plugin/module_ppapi.cc
+++ b/ppapi/native_client/src/trusted/plugin/module_ppapi.cc
@@ -76,28 +76,6 @@ pp::Instance* ModulePpapi::CreateInstance(PP_Instance pp_instance) {
return plugin;
}
-const uint64_t kMaxCrashesPerInterval = 3;
-const uint64_t kCrashesIntervalInSeconds = 120;
-
-void ModulePpapi::RegisterPluginCrash() {
- PLUGIN_PRINTF(("ModulePpapi::RegisterPluginCrash ()\n"));
- if (crash_times_.size() == kMaxCrashesPerInterval) {
- crash_times_.pop_front();
- }
- int64_t time = NaClGetTimeOfDayMicroseconds();
- crash_times_.push_back(time);
-}
-
-bool ModulePpapi::IsPluginUnstable() {
- PLUGIN_PRINTF(("ModulePpapi::IsPluginUnstable ()\n"));
- if (crash_times_.size() != kMaxCrashesPerInterval) {
- return false;
- }
- int64_t now = NaClGetTimeOfDayMicroseconds();
- int64_t delta = now - crash_times_.front();
- return delta / (1000.0 * 1000.0) <= kCrashesIntervalInSeconds;
-}
-
} // namespace plugin
diff --git a/ppapi/native_client/src/trusted/plugin/module_ppapi.h b/ppapi/native_client/src/trusted/plugin/module_ppapi.h
index b2e75645e7..ee7bd1980e 100644
--- a/ppapi/native_client/src/trusted/plugin/module_ppapi.h
+++ b/ppapi/native_client/src/trusted/plugin/module_ppapi.h
@@ -4,8 +4,6 @@
* found in the LICENSE file.
*/
-#include <deque>
-
#include "ppapi/c/private/ppb_nacl_private.h"
#include "ppapi/cpp/module.h"
@@ -21,18 +19,9 @@ class ModulePpapi : public pp::Module {
virtual pp::Instance* CreateInstance(PP_Instance pp_instance);
- // NaCl crash throttling. If RegisterPluginCrash is called too many times
- // within a time period, IsPluginUnstable reports true. As long as
- // IsPluginUnstable returns true, NaCl modules will fail to load.
- void RegisterPluginCrash();
- bool IsPluginUnstable();
-
private:
bool init_was_successful_;
const PPB_NaCl_Private* private_interface_;
-
- // Crash throttling support.
- std::deque<int64_t> crash_times_;
};
} // namespace plugin
diff --git a/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h b/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h
index 4fd620d097..0d182087d6 100644
--- a/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h
+++ b/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h
@@ -24,6 +24,7 @@ typedef PP_ExternalPluginResult (*LaunchNaClProcessFunc)(
PP_Bool enable_ppapi_dev,
PP_Bool enable_dyncode_syscalls,
PP_Bool enable_exception_handling,
+ PP_Bool enable_crash_throttling,
NaClHandle* result_socket,
struct PP_Var* error_message);
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc
index fe27aa2914..2aa90bedb4 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.cc
+++ b/ppapi/native_client/src/trusted/plugin/plugin.cc
@@ -55,7 +55,6 @@
#include "ppapi/native_client/src/trusted/plugin/file_utils.h"
#include "ppapi/native_client/src/trusted/plugin/json_manifest.h"
-#include "ppapi/native_client/src/trusted/plugin/module_ppapi.h"
#include "ppapi/native_client/src/trusted/plugin/nacl_entry_points.h"
#include "ppapi/native_client/src/trusted/plugin/nacl_subprocess.h"
#include "ppapi/native_client/src/trusted/plugin/nexe_arch.h"
@@ -447,6 +446,7 @@ bool Plugin::LoadNaClModule(nacl::DescWrapper* wrapper,
ErrorInfo* error_info,
bool enable_dyncode_syscalls,
bool enable_exception_handling,
+ bool enable_crash_throttling,
const pp::CompletionCallback& init_done_cb,
const pp::CompletionCallback& crash_cb) {
// Before forking a new sel_ldr process, ensure that we do not leak
@@ -460,7 +460,8 @@ bool Plugin::LoadNaClModule(nacl::DescWrapper* wrapper,
true /* uses_ppapi */,
enable_dev_interfaces_,
enable_dyncode_syscalls,
- enable_exception_handling);
+ enable_exception_handling,
+ enable_crash_throttling);
if (!LoadNaClModuleCommon(wrapper, &main_subprocess_, manifest_.get(),
true /* should_report_uma */,
params, init_done_cb, crash_cb)) {
@@ -532,7 +533,8 @@ NaClSubprocess* Plugin::LoadHelperNaClModule(nacl::DescWrapper* wrapper,
false /* uses_ppapi */,
enable_dev_interfaces_,
false /* enable_dyncode_syscalls */,
- false /* enable_exception_handling */);
+ false /* enable_exception_handling */,
+ true /* enable_crash_throttling */);
if (!LoadNaClModuleCommon(wrapper, nacl_subprocess.get(), manifest,
false /* should_report_uma */,
params,
@@ -907,6 +909,7 @@ void Plugin::NexeFileDidOpen(int32_t pp_error) {
wrapper.get(), &error_info,
true, /* enable_dyncode_syscalls */
true, /* enable_exception_handling */
+ false, /* enable_crash_throttling */
callback_factory_.NewCallback(&Plugin::NexeFileDidOpenContinuation),
callback_factory_.NewCallback(&Plugin::NexeDidCrash));
@@ -1010,10 +1013,6 @@ void Plugin::NexeDidCrash(int32_t pp_error) {
// invocation will just be a no-op, since all the crash log will
// have been received and we'll just get an EOF indication.
CopyCrashLogToJsConsole();
-
- // Remember the nexe crash time, which helps determine the need to throttle.
- ModulePpapi* module_ppapi = static_cast<ModulePpapi*>(pp::Module::Get());
- module_ppapi->RegisterPluginCrash();
}
void Plugin::BitcodeDidTranslate(int32_t pp_error) {
@@ -1033,6 +1032,7 @@ void Plugin::BitcodeDidTranslate(int32_t pp_error) {
wrapper.get(), &error_info,
false, /* enable_dyncode_syscalls */
false, /* enable_exception_handling */
+ true, /* enable_crash_throttling */
callback_factory_.NewCallback(&Plugin::BitcodeDidTranslateContinuation),
callback_factory_.NewCallback(&Plugin::NexeDidCrash));
@@ -1208,31 +1208,16 @@ void Plugin::ProcessNaClManifest(const nacl::string& manifest_json) {
// Inform JavaScript that we found a nexe URL to load.
EnqueueProgressEvent(kProgressEventProgress);
if (pnacl_options.translate()) {
- if (this->nacl_interface()->IsPnaclEnabled()) {
- // Check whether PNaCl has been crashing "frequently". If so, report
- // a load error.
- ModulePpapi* module_ppapi =
- static_cast<ModulePpapi*>(pp::Module::Get());
- if (module_ppapi->IsPluginUnstable()) {
- error_info.SetReport(ERROR_PNACL_CRASH_THROTTLED,
- "PNaCl has been temporarily disabled because too"
- " many crashes have been observed.");
- } else {
- pp::CompletionCallback translate_callback =
- callback_factory_.NewCallback(&Plugin::BitcodeDidTranslate);
- // Will always call the callback on success or failure.
- pnacl_coordinator_.reset(
- PnaclCoordinator::BitcodeToNative(this,
- program_url,
- pnacl_options,
- translate_callback));
- return;
- }
- } else {
- error_info.SetReport(ERROR_PNACL_NOT_ENABLED,
- "PNaCl has not been enabled (e.g., by setting "
- "the --enable-pnacl flag).");
- }
+ CHECK(nacl_interface()->IsPnaclEnabled());
+ pp::CompletionCallback translate_callback =
+ callback_factory_.NewCallback(&Plugin::BitcodeDidTranslate);
+ // Will always call the callback on success or failure.
+ pnacl_coordinator_.reset(
+ PnaclCoordinator::BitcodeToNative(this,
+ program_url,
+ pnacl_options,
+ translate_callback));
+ return;
} else {
// Try the fast path first. This will only block if the file is installed.
if (OpenURLFast(program_url, &nexe_downloader_)) {
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.h b/ppapi/native_client/src/trusted/plugin/plugin.h
index 1e9e78003f..416ab5bf71 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.h
+++ b/ppapi/native_client/src/trusted/plugin/plugin.h
@@ -106,6 +106,7 @@ class Plugin : public pp::InstancePrivate {
bool LoadNaClModule(nacl::DescWrapper* wrapper, ErrorInfo* error_info,
bool enable_dyncode_syscalls,
bool enable_exception_handling,
+ bool enable_crash_throttling,
const pp::CompletionCallback& init_done_cb,
const pp::CompletionCallback& crash_cb);
diff --git a/ppapi/native_client/src/trusted/plugin/plugin_error.h b/ppapi/native_client/src/trusted/plugin/plugin_error.h
index cba1701c6c..4ec0b51a9e 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin_error.h
+++ b/ppapi/native_client/src/trusted/plugin/plugin_error.h
@@ -93,8 +93,8 @@ enum PluginErrorCode {
ERROR_PNACL_LLC_INTERNAL = 65,
ERROR_PNACL_LD_INTERNAL = 66,
ERROR_PNACL_CREATE_TEMP = 67,
- // Remove this next code when pnacl is no longer behind a flag (when we
- // remove the --enable-pnacl flag).
+ // This entry is no longer used, but should not be removed, because UMA
+ // numbers need to be kept consistent.
ERROR_PNACL_NOT_ENABLED = 68,
ERROR_MANIFEST_NOACCESS_URL = 69,
ERROR_NEXE_NOACCESS_URL = 70,
diff --git a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc
index 2714eac866..486696bce5 100644
--- a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc
+++ b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc
@@ -24,6 +24,7 @@ bool SelLdrLauncherChrome::Start(PP_Instance instance,
bool enable_ppapi_dev,
bool enable_dyncode_syscalls,
bool enable_exception_handling,
+ bool enable_crash_throttling,
nacl::string* error_message) {
*error_message = "";
if (!launch_nacl_process)
@@ -37,6 +38,7 @@ bool SelLdrLauncherChrome::Start(PP_Instance instance,
PP_FromBool(enable_ppapi_dev),
PP_FromBool(enable_dyncode_syscalls),
PP_FromBool(enable_exception_handling),
+ PP_FromBool(enable_crash_throttling),
&channel_,
&var_error_message) != PP_EXTERNAL_PLUGIN_OK) {
pp::Var var_error_message_cpp(pp::PASS_REF, var_error_message);
diff --git a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h
index a64c66b46b..69c171601c 100644
--- a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h
+++ b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h
@@ -20,6 +20,7 @@ class SelLdrLauncherChrome : public nacl::SelLdrLauncherBase {
bool enable_ppapi_dev,
bool enable_dyncode_syscalls,
bool enable_exception_handling,
+ bool enable_crash_throttling,
nacl::string* error_message);
};
diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.cc b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
index 2b43b2e6e8..fd845a5027 100644
--- a/ppapi/native_client/src/trusted/plugin/service_runtime.cc
+++ b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
@@ -337,29 +337,19 @@ void PluginReverseInterface::OpenManifestEntry_MainThreadContinuation(
NaClLog(4,
"OpenManifestEntry_MainThreadContinuation: "
"pulling down and translating.\n");
- if (plugin_->nacl_interface()->IsPnaclEnabled()) {
- pp::CompletionCallback translate_callback =
- WeakRefNewCallback(
- anchor_,
- this,
- &PluginReverseInterface::BitcodeTranslate_MainThreadContinuation,
- open_cont);
- // Will always call the callback on success or failure.
- pnacl_coordinator_.reset(
- PnaclCoordinator::BitcodeToNative(plugin_,
- mapped_url,
- pnacl_options,
- translate_callback));
- } else {
- nacl::MutexLocker take(&mu_);
- *p->op_complete_ptr = true; // done...
- p->file_info->desc = -1; // but failed.
- p->error_info->SetReport(ERROR_PNACL_NOT_ENABLED,
- "ServiceRuntime: GetPnaclFd failed -- pnacl not "
- "enabled with --enable-pnacl.");
- NaClXCondVarBroadcast(&cv_);
- return;
- }
+ CHECK(plugin_->nacl_interface()->IsPnaclEnabled());
+ pp::CompletionCallback translate_callback =
+ WeakRefNewCallback(
+ anchor_,
+ this,
+ &PluginReverseInterface::BitcodeTranslate_MainThreadContinuation,
+ open_cont);
+ // Will always call the callback on success or failure.
+ pnacl_coordinator_.reset(
+ PnaclCoordinator::BitcodeToNative(plugin_,
+ mapped_url,
+ pnacl_options,
+ translate_callback));
}
// p is deleted automatically
}
@@ -736,6 +726,7 @@ bool ServiceRuntime::StartSelLdr(const SelLdrStartParams& params) {
params.enable_dev_interfaces,
params.enable_dyncode_syscalls,
params.enable_exception_handling,
+ params.enable_crash_throttling,
&error_message);
if (!started) {
NaClLog(LOG_ERROR, "ServiceRuntime::Start (start failed)\n");
diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.h b/ppapi/native_client/src/trusted/plugin/service_runtime.h
index ee97710047..e7ebbbcf2f 100644
--- a/ppapi/native_client/src/trusted/plugin/service_runtime.h
+++ b/ppapi/native_client/src/trusted/plugin/service_runtime.h
@@ -56,14 +56,16 @@ struct SelLdrStartParams {
bool uses_ppapi,
bool enable_dev_interfaces,
bool enable_dyncode_syscalls,
- bool enable_exception_handling)
+ bool enable_exception_handling,
+ bool enable_crash_throttling)
: url(url),
error_info(error_info),
uses_irt(uses_irt),
uses_ppapi(uses_ppapi),
enable_dev_interfaces(enable_dev_interfaces),
enable_dyncode_syscalls(enable_dyncode_syscalls),
- enable_exception_handling(enable_exception_handling) {
+ enable_exception_handling(enable_exception_handling),
+ enable_crash_throttling(enable_crash_throttling) {
}
nacl::string url;
ErrorInfo* error_info;
@@ -72,6 +74,7 @@ struct SelLdrStartParams {
bool enable_dev_interfaces;
bool enable_dyncode_syscalls;
bool enable_exception_handling;
+ bool enable_crash_throttling;
};
// Callback resources are essentially our continuation state.
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
index 8bb17f721d..93ccb85758 100644
--- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
+++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
@@ -95,7 +95,6 @@
#include "ppapi/c/private/ppb_flash_menu.h"
#include "ppapi/c/private/ppb_flash_message_loop.h"
#include "ppapi/c/private/ppb_flash_print.h"
-#include "ppapi/c/private/ppb_gpu_blacklist_private.h"
#include "ppapi/c/private/ppb_host_resolver_private.h"
#include "ppapi/c/private/ppb_instance_private.h"
#include "ppapi/c/private/ppb_nacl_private.h"
@@ -2752,8 +2751,6 @@ static int32_t Pnacl_M14_PPB_Flash_Menu_Show(PP_Resource menu_id, const struct P
/* Not generating wrapper methods for PPB_Flash_Print_1_0 */
-/* Not generating wrapper methods for PPB_GpuBlacklist_Private_0_2 */
-
/* Begin wrapper methods for PPB_HostResolver_Private_0_1 */
static PP_Resource Pnacl_M19_PPB_HostResolver_Private_Create(PP_Instance instance) {
@@ -2809,9 +2806,9 @@ static void Pnacl_M13_PPB_Instance_Private_ExecuteScript(struct PP_Var* _struct_
/* Begin wrapper methods for PPB_NaCl_Private_1_0 */
-static PP_ExternalPluginResult Pnacl_M13_PPB_NaCl_Private_LaunchSelLdr(PP_Instance instance, const char* alleged_url, PP_Bool uses_irt, PP_Bool uses_ppapi, PP_Bool enable_ppapi_dev, PP_Bool enable_dyncode_syscalls, PP_Bool enable_exception_handling, void* imc_handle, struct PP_Var* error_message) {
+static PP_ExternalPluginResult Pnacl_M13_PPB_NaCl_Private_LaunchSelLdr(PP_Instance instance, const char* alleged_url, PP_Bool uses_irt, PP_Bool uses_ppapi, PP_Bool enable_ppapi_dev, PP_Bool enable_dyncode_syscalls, PP_Bool enable_exception_handling, PP_Bool enable_crash_throttling, void* imc_handle, struct PP_Var* error_message) {
const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface;
- return iface->LaunchSelLdr(instance, alleged_url, uses_irt, uses_ppapi, enable_ppapi_dev, enable_dyncode_syscalls, enable_exception_handling, imc_handle, error_message);
+ return iface->LaunchSelLdr(instance, alleged_url, uses_irt, uses_ppapi, enable_ppapi_dev, enable_dyncode_syscalls, enable_exception_handling, enable_crash_throttling, imc_handle, error_message);
}
static PP_ExternalPluginResult Pnacl_M13_PPB_NaCl_Private_StartPpapiProxy(PP_Instance instance) {
@@ -4637,8 +4634,6 @@ struct PPB_Flash_Menu_0_2 Pnacl_Wrappers_PPB_Flash_Menu_0_2 = {
/* Not generating wrapper interface for PPB_Flash_Print_1_0 */
-/* Not generating wrapper interface for PPB_GpuBlacklist_Private_0_2 */
-
struct PPB_HostResolver_Private_0_1 Pnacl_Wrappers_PPB_HostResolver_Private_0_1 = {
.Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M19_PPB_HostResolver_Private_Create,
.IsHostResolver = (PP_Bool (*)(PP_Resource resource))&Pnacl_M19_PPB_HostResolver_Private_IsHostResolver,
@@ -4655,7 +4650,7 @@ struct PPB_Instance_Private_0_1 Pnacl_Wrappers_PPB_Instance_Private_0_1 = {
};
struct PPB_NaCl_Private_1_0 Pnacl_Wrappers_PPB_NaCl_Private_1_0 = {
- .LaunchSelLdr = (PP_ExternalPluginResult (*)(PP_Instance instance, const char* alleged_url, PP_Bool uses_irt, PP_Bool uses_ppapi, PP_Bool enable_ppapi_dev, PP_Bool enable_dyncode_syscalls, PP_Bool enable_exception_handling, void* imc_handle, struct PP_Var* error_message))&Pnacl_M13_PPB_NaCl_Private_LaunchSelLdr,
+ .LaunchSelLdr = (PP_ExternalPluginResult (*)(PP_Instance instance, const char* alleged_url, PP_Bool uses_irt, PP_Bool uses_ppapi, PP_Bool enable_ppapi_dev, PP_Bool enable_dyncode_syscalls, PP_Bool enable_exception_handling, PP_Bool enable_crash_throttling, void* imc_handle, struct PP_Var* error_message))&Pnacl_M13_PPB_NaCl_Private_LaunchSelLdr,
.StartPpapiProxy = (PP_ExternalPluginResult (*)(PP_Instance instance))&Pnacl_M13_PPB_NaCl_Private_StartPpapiProxy,
.UrandomFD = (int32_t (*)(void))&Pnacl_M13_PPB_NaCl_Private_UrandomFD,
.Are3DInterfacesDisabled = (PP_Bool (*)(void))&Pnacl_M13_PPB_NaCl_Private_Are3DInterfacesDisabled,
diff --git a/ppapi/native_client/tools/browser_tester/browser_tester.py b/ppapi/native_client/tools/browser_tester/browser_tester.py
index 513a091605..ab24d0c81c 100755
--- a/ppapi/native_client/tools/browser_tester/browser_tester.py
+++ b/ppapi/native_client/tools/browser_tester/browser_tester.py
@@ -138,6 +138,10 @@ def BuildArgParser():
parser.add_option('--enable_crash_reporter', dest='enable_crash_reporter',
action='store_true', default=False,
help='Force crash reporting on.')
+ parser.add_option('--enable_sockets', dest='enable_sockets',
+ action='store_true', default=False,
+ help='Pass --allow-nacl-socket-api=<host> to Chrome, where '
+ '<host> is the name of the browser tester\'s web server.')
return parser
@@ -242,7 +246,7 @@ def RunTestsOnce(url, options):
full_url = 'http://%s:%d/%s' % (host, port, url)
if len(options.test_args) > 0:
full_url += '?' + urllib.urlencode(options.test_args)
- browser.Run(full_url, port)
+ browser.Run(full_url, host, port)
server.TestingBegun(0.125)
# In Python 2.5, server.handle_request may block indefinitely. Serving pages
@@ -308,6 +312,13 @@ def RunTestsOnce(url, options):
DumpNetLog(browser.NetLogName())
except Exception:
listener.ever_failed = 1
+ # Try to let the browser clean itself up normally before killing it.
+ sys.stdout.write('##################### Terminating the browser\n')
+ browser.WaitForProcessDeath()
+ if browser.IsRunning():
+ sys.stdout.write('##################### TERM failed, KILLING\n')
+ # Always call Cleanup; it kills the process, but also removes the
+ # user-data-dir.
browser.Cleanup()
# We avoid calling server.server_close() here because it causes
# the HTTP server thread to exit uncleanly with an EBADF error,
diff --git a/ppapi/native_client/tools/browser_tester/browsertester/browserlauncher.py b/ppapi/native_client/tools/browser_tester/browsertester/browserlauncher.py
index 256a1cb37f..5631690fe7 100755
--- a/ppapi/native_client/tools/browser_tester/browsertester/browserlauncher.py
+++ b/ppapi/native_client/tools/browser_tester/browsertester/browserlauncher.py
@@ -9,6 +9,7 @@ import shutil
import sys
import tempfile
import time
+import urlparse
import browserprocess
@@ -105,7 +106,7 @@ class BrowserLauncher(object):
def CreateProfile(self):
raise NotImplementedError
- def MakeCmd(self, url):
+ def MakeCmd(self, url, host, port):
raise NotImplementedError
def CreateToolLogDir(self):
@@ -205,12 +206,12 @@ class BrowserLauncher(object):
def GetReturnCode(self):
return self.browser_process.GetReturnCode()
- def Run(self, url, port):
+ def Run(self, url, host, port):
self.binary = EscapeSpaces(self.FindBinary())
self.profile = self.CreateProfile()
if self.options.tool is not None:
self.tool_log_dir = self.CreateToolLogDir()
- cmd = self.MakeCmd(url, port)
+ cmd = self.MakeCmd(url, host, port)
self.Launch(cmd, MakeEnv(self.options))
@@ -262,7 +263,7 @@ class ChromeLauncher(BrowserLauncher):
def NetLogName(self):
return os.path.join(self.profile, 'netlog.json')
- def MakeCmd(self, url, port):
+ def MakeCmd(self, url, host, port):
cmd = [self.binary,
# Note that we do not use "--enable-logging" here because
# it actually turns off logging to the Buildbot logs on
@@ -279,6 +280,7 @@ class ChromeLauncher(BrowserLauncher):
'--no-default-browser-check',
'--log-level=1',
'--safebrowsing-disable-auto-update',
+ '--disable-default-apps',
# Suppress metrics reporting. This prevents misconfigured bots,
# people testing at their desktop, etc from poisoning the UMA data.
'--metrics-recording-only',
@@ -335,6 +337,8 @@ class ChromeLauncher(BrowserLauncher):
'--log-file=%s/log.%%p' % (self.tool_log_dir,)] + cmd
elif self.options.tool != None:
raise LaunchFailure('Invalid tool name "%s"' % (self.options.tool,))
+ if self.options.enable_sockets:
+ cmd.append('--allow-nacl-socket-api=%s' % host)
cmd.extend(self.options.browser_flags)
cmd.append(url)
return cmd
diff --git a/ppapi/native_client/tools/browser_tester/browsertester/browserprocess.py b/ppapi/native_client/tools/browser_tester/browsertester/browserprocess.py
index bca1734077..e10e6b5336 100755
--- a/ppapi/native_client/tools/browser_tester/browsertester/browserprocess.py
+++ b/ppapi/native_client/tools/browser_tester/browsertester/browserprocess.py
@@ -21,7 +21,13 @@ class BrowserProcessBase(object):
return self.handle.poll() is None
def Wait(self, wait_steps, sleep_time):
- self.term()
+ try:
+ self.term()
+ except Exception:
+ # Terminating the handle can raise an exception. There is likely no point
+ # in waiting if the termination didn't succeed.
+ return
+
i = 0
# subprocess.wait() doesn't have a timeout, unfortunately.
while self.IsRunning() and i < wait_steps:
diff --git a/ppapi/ppapi_ipc_untrusted.gyp b/ppapi/ppapi_ipc_untrusted.gyp
index 9b0b6785aa..9e13867308 100644
--- a/ppapi/ppapi_ipc_untrusted.gyp
+++ b/ppapi/ppapi_ipc_untrusted.gyp
@@ -22,7 +22,7 @@
'nacl_untrusted_build': 1,
'nlib_target': 'libppapi_ipc_untrusted.a',
'build_glibc': 0,
- 'build_newlib': 1,
+ 'build_newlib': 0,
'build_irt': 1,
},
'include_dirs': [
diff --git a/ppapi/ppapi_proxy_untrusted.gyp b/ppapi/ppapi_proxy_untrusted.gyp
index 727fbb5cf8..35dff87294 100644
--- a/ppapi/ppapi_proxy_untrusted.gyp
+++ b/ppapi/ppapi_proxy_untrusted.gyp
@@ -21,7 +21,7 @@
'nacl_untrusted_build': 1,
'nlib_target': 'libppapi_proxy_untrusted.a',
'build_glibc': 0,
- 'build_newlib': 1,
+ 'build_newlib': 0,
'build_irt': 1,
},
'include_dirs': [
diff --git a/ppapi/ppapi_shared_untrusted.gyp b/ppapi/ppapi_shared_untrusted.gyp
index 4043c3a039..453e711b06 100644
--- a/ppapi/ppapi_shared_untrusted.gyp
+++ b/ppapi/ppapi_shared_untrusted.gyp
@@ -22,7 +22,7 @@
'nacl_untrusted_build': 1,
'nlib_target': 'libppapi_shared_untrusted.a',
'build_glibc': 0,
- 'build_newlib': 1,
+ 'build_newlib': 0,
'build_irt': 1,
},
'include_dirs': [
diff --git a/ppapi/ppapi_sources.gypi b/ppapi/ppapi_sources.gypi
index c6f7b0190a..209434e5e1 100644
--- a/ppapi/ppapi_sources.gypi
+++ b/ppapi/ppapi_sources.gypi
@@ -110,7 +110,6 @@
'c/private/ppb_flash_fullscreen.h',
'c/private/ppb_flash_menu.h',
'c/private/ppb_flash_message_loop.h',
- 'c/private/ppb_gpu_blacklist_private.h',
'c/private/ppb_host_resolver_private.h',
'c/private/ppb_instance_private.h',
'c/private/ppb_nacl_private.h',
diff --git a/ppapi/ppapi_tests.gypi b/ppapi/ppapi_tests.gypi
index 3a1ac8735b..cf755c1faf 100644
--- a/ppapi/ppapi_tests.gypi
+++ b/ppapi/ppapi_tests.gypi
@@ -219,9 +219,6 @@
['os_posix==1 and OS!="mac"', {
'cflags': ['-fvisibility=hidden'],
'type': 'shared_library',
- # -gstabs, used in the official builds, causes an ICE. Simply remove
- # it.
- 'cflags!': ['-gstabs'],
}],
['OS=="win"', {
'type': 'shared_library',
diff --git a/ppapi/proxy/plugin_resource_tracker.cc b/ppapi/proxy/plugin_resource_tracker.cc
index 12e9d3faf6..86cbf7cee4 100644
--- a/ppapi/proxy/plugin_resource_tracker.cc
+++ b/ppapi/proxy/plugin_resource_tracker.cc
@@ -18,6 +18,7 @@ namespace ppapi {
namespace proxy {
PluginResourceTracker::PluginResourceTracker() : ResourceTracker(THREAD_SAFE) {
+ UseOddResourceValueInDebugMode();
}
PluginResourceTracker::~PluginResourceTracker() {
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index 3767f8f4c1..a377193ad1 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -1275,27 +1275,27 @@ IPC_SYNC_MESSAGE_CONTROL2_2(PpapiHostMsg_ResourceSyncCall,
IPC::Message /* reply_msg */)
// This message is sent from the renderer to the browser when it wants to create
-// a ResourceHost in the browser. It contains the process ID of the plugin and
+// ResourceHosts in the browser. It contains the process ID of the plugin and
// the instance of the plugin for which to create the resource for. params
// contains the sequence number for the message to track the response.
-// The nested message is a ResourceHost creation message.
+// The nested messages are ResourceHost creation messages.
IPC_MESSAGE_CONTROL5(
- PpapiHostMsg_CreateResourceHostFromHost,
+ PpapiHostMsg_CreateResourceHostsFromHost,
int /* routing_id */,
int /* child_process_id */,
ppapi::proxy::ResourceMessageCallParams /* params */,
PP_Instance /* instance */,
- IPC::Message /* nested_msg */)
+ std::vector<IPC::Message> /* nested_msgs */)
-// This message is sent from the browser to the renderer when it has created a
-// ResourceHost for the renderer. It contains the sequence number that was sent
-// in the request and the ID of the pending ResourceHost which was created in
-// the browser. This ID is only useful for the plugin which can attach to the
-// ResourceHost in the browser.
+// This message is sent from the browser to the renderer when it has created
+// ResourceHosts for the renderer. It contains the sequence number that was sent
+// in the request and the IDs of the pending ResourceHosts which were created in
+// the browser. These IDs are only useful for the plugin which can attach to the
+// ResourceHosts in the browser.
IPC_MESSAGE_ROUTED2(
- PpapiHostMsg_CreateResourceHostFromHostReply,
+ PpapiHostMsg_CreateResourceHostsFromHostReply,
int32_t /* sequence */,
- int /* pending_host_id */)
+ std::vector<int> /* pending_host_ids */)
//-----------------------------------------------------------------------------
// Messages for resources using call/reply above.
diff --git a/ppapi/shared_impl/id_assignment.h b/ppapi/shared_impl/id_assignment.h
index 039e7fed4c..3bacac3829 100644
--- a/ppapi/shared_impl/id_assignment.h
+++ b/ppapi/shared_impl/id_assignment.h
@@ -26,7 +26,7 @@ PPAPI_SHARED_EXPORT extern const unsigned int kPPIdTypeBits;
extern const int32 kMaxPPId;
-// The most significant bits are the type, the rest are the value.
+// The least significant bits are the type, the rest are the value.
template <typename T> inline T MakeTypedId(T value, PPIdType type) {
return (value << kPPIdTypeBits) | static_cast<T>(type);
}
diff --git a/ppapi/shared_impl/ppb_graphics_3d_shared.cc b/ppapi/shared_impl/ppb_graphics_3d_shared.cc
index 948905dfee..e24a13c461 100644
--- a/ppapi/shared_impl/ppb_graphics_3d_shared.cc
+++ b/ppapi/shared_impl/ppb_graphics_3d_shared.cc
@@ -135,7 +135,8 @@ bool PPB_Graphics3D_Shared::CreateGLES2Impl(
if (!gles2_impl_->Initialize(
transfer_buffer_size,
kMinTransferBufferSize,
- std::max(kMaxTransferBufferSize, transfer_buffer_size))) {
+ std::max(kMaxTransferBufferSize, transfer_buffer_size),
+ gpu::gles2::GLES2Implementation::kNoLimit)) {
return false;
}
diff --git a/ppapi/shared_impl/ppb_image_data_shared.cc b/ppapi/shared_impl/ppb_image_data_shared.cc
index 4001d6f758..50751a0382 100644
--- a/ppapi/shared_impl/ppb_image_data_shared.cc
+++ b/ppapi/shared_impl/ppb_image_data_shared.cc
@@ -26,12 +26,7 @@ PP_ImageDataFormat PPB_ImageData_Shared::GetNativeImageDataFormat() {
NOTIMPLEMENTED();
return PP_IMAGEDATAFORMAT_BGRA_PREMUL;
#else
- return PP_IMAGEDATAFORMAT_BGRA_PREMUL; if (SK_B32_SHIFT == 0)
- return PP_IMAGEDATAFORMAT_BGRA_PREMUL;
- else if (SK_R32_SHIFT == 0)
- return PP_IMAGEDATAFORMAT_RGBA_PREMUL;
- else
- return PP_IMAGEDATAFORMAT_BGRA_PREMUL; // Default to something on failure.
+ return PP_IMAGEDATAFORMAT_BGRA_PREMUL;
#endif
}
diff --git a/ppapi/shared_impl/resource_tracker.cc b/ppapi/shared_impl/resource_tracker.cc
index 5d7d01ad7a..36aa2e142d 100644
--- a/ppapi/shared_impl/resource_tracker.cc
+++ b/ppapi/shared_impl/resource_tracker.cc
@@ -44,6 +44,9 @@ void ResourceTracker::AddRefResource(PP_Resource res) {
CheckThreadingPreconditions();
DLOG_IF(ERROR, !CheckIdType(res, PP_ID_TYPE_RESOURCE))
<< res << " is not a PP_Resource.";
+
+ DCHECK(CanOperateOnResource(res));
+
ResourceMap::iterator i = live_resources_.find(res);
if (i == live_resources_.end())
return;
@@ -66,6 +69,9 @@ void ResourceTracker::ReleaseResource(PP_Resource res) {
CheckThreadingPreconditions();
DLOG_IF(ERROR, !CheckIdType(res, PP_ID_TYPE_RESOURCE))
<< res << " is not a PP_Resource.";
+
+ DCHECK(CanOperateOnResource(res));
+
ResourceMap::iterator i = live_resources_.find(res);
if (i == live_resources_.end())
return;
@@ -166,15 +172,23 @@ int ResourceTracker::GetLiveObjectsForInstance(PP_Instance instance) const {
return static_cast<int>(found->second->resources.size());
}
+void ResourceTracker::UseOddResourceValueInDebugMode() {
+#if !defined(NDEBUG)
+ DCHECK_EQ(0, last_resource_value_);
+
+ ++last_resource_value_;
+#endif
+}
+
PP_Resource ResourceTracker::AddResource(Resource* object) {
CheckThreadingPreconditions();
// If the plugin manages to create too many resources, don't do crazy stuff.
- if (last_resource_value_ == kMaxPPId)
+ if (last_resource_value_ >= kMaxPPId)
return 0;
// Allocate an ID. Note there's a rare error condition below that means we
// could end up not using |new_id|, but that's harmless.
- PP_Resource new_id = MakeTypedId(++last_resource_value_, PP_ID_TYPE_RESOURCE);
+ PP_Resource new_id = MakeTypedId(GetNextResourceValue(), PP_ID_TYPE_RESOURCE);
// Some objects have a 0 instance, meaning they aren't associated with any
// instance, so they won't be in |instance_map_|. This is (as of this writing)
@@ -229,4 +243,31 @@ void ResourceTracker::LastPluginRefWasDeleted(Resource* object) {
object->NotifyLastPluginRefWasDeleted();
}
+int32 ResourceTracker::GetNextResourceValue() {
+#if defined(NDEBUG)
+ return ++last_resource_value_;
+#else
+ // In debug mode, the least significant bit indicates which side (renderer
+ // or plugin process) created the resource. Increment by 2 so it's always the
+ // same.
+ last_resource_value_ += 2;
+ return last_resource_value_;
+#endif
+}
+
+bool ResourceTracker::CanOperateOnResource(PP_Resource res) {
+#if defined(NDEBUG)
+ return true;
+#else
+ // The invalid PP_Resource value could appear at both sides.
+ if (res == 0)
+ return true;
+
+ // Skipping the type bits, the least significant bit of |res| should be the
+ // same as that of |last_resource_value_|.
+ return ((res >> kPPIdTypeBits) & 1) == (last_resource_value_ & 1);
+#endif
+
+}
+
} // namespace ppapi
diff --git a/ppapi/shared_impl/resource_tracker.h b/ppapi/shared_impl/resource_tracker.h
index 2ba43b8bb5..ee93376b4c 100644
--- a/ppapi/shared_impl/resource_tracker.h
+++ b/ppapi/shared_impl/resource_tracker.h
@@ -36,7 +36,14 @@ class PPAPI_SHARED_EXPORT ResourceTracker {
// count of the resource is unaffected.
Resource* GetResource(PP_Resource res) const;
+ // Takes a reference on the given resource.
+ // Do not call this method on on the host side for resources backed by a
+ // ResourceHost.
void AddRefResource(PP_Resource res);
+
+ // Releases a reference on the given resource.
+ // Do not call this method on on the host side for resources backed by a
+ // ResourceHost.
void ReleaseResource(PP_Resource res);
// Releases a reference on the given resource once the message loop returns.
@@ -63,6 +70,14 @@ class PPAPI_SHARED_EXPORT ResourceTracker {
// plugin side, make sure we have the proxy lock.
void CheckThreadingPreconditions() const;
+ // This method is called by PluginResourceTracker's constructor so that in
+ // debug mode PP_Resources from the plugin process always have odd values
+ // (ignoring the type bits), while PP_Resources from the renderer process have
+ // even values.
+ // This allows us to check that resource refs aren't added or released on the
+ // wrong side.
+ void UseOddResourceValueInDebugMode();
+
// Adds the given resource to the tracker, associating it with the instance
// stored in the resource object. The new resource ID is returned, and the
// resource will have 0 plugin refcount. This is called by the resource
@@ -80,6 +95,11 @@ class PPAPI_SHARED_EXPORT ResourceTracker {
// cancels pending callbacks for the resource.
void LastPluginRefWasDeleted(Resource* object);
+ int32 GetNextResourceValue();
+
+ // In debug mode, checks whether |res| comes from the same resource tracker.
+ bool CanOperateOnResource(PP_Resource res);
+
typedef std::set<PP_Resource> ResourceSet;
struct InstanceData {
diff --git a/ppapi/tests/all_c_includes.h b/ppapi/tests/all_c_includes.h
index 5950c4ea70..54130c586a 100644
--- a/ppapi/tests/all_c_includes.h
+++ b/ppapi/tests/all_c_includes.h
@@ -111,7 +111,6 @@
#include "ppapi/c/private/ppb_flash_font_file.h"
#include "ppapi/c/private/ppb_flash_menu.h"
#include "ppapi/c/private/ppb_flash_message_loop.h"
-#include "ppapi/c/private/ppb_gpu_blacklist_private.h"
#include "ppapi/c/private/ppb_host_resolver_private.h"
#include "ppapi/c/private/ppb_instance_private.h"
#include "ppapi/c/private/ppb_nacl_private.h"
diff --git a/ppapi/tests/test_case.cc b/ppapi/tests/test_case.cc
index 6f61fc505a..9b565befe2 100644
--- a/ppapi/tests/test_case.cc
+++ b/ppapi/tests/test_case.cc
@@ -105,7 +105,6 @@ std::string TestCase::MakeFailureMessage(const char* file,
// GYP_DEFINES='branding=Chrome buildtype=Official target_arch=x64'
// gclient runhooks
// make -k -j4 BUILDTYPE=Release ppapi_tests
- std::string s;
std::ostringstream output;
output << "Failure in " << file << "(" << line << "): " << cmd;
diff --git a/ppapi/tests/test_char_set.cc b/ppapi/tests/test_char_set.cc
index 5056c2c988..de998d09a3 100644
--- a/ppapi/tests/test_char_set.cc
+++ b/ppapi/tests/test_char_set.cc
@@ -187,6 +187,7 @@ std::string TestCharSet::TestUTF16ToCharSet() {
&utf16[0], static_cast<uint32_t>(utf16.size()),
"latin1", PP_CHARSET_TRUSTED_CONVERSIONERROR_SUBSTITUTE,
&output_buffer[0], &utf8result_len);
+ ASSERT_TRUE(result == PP_TRUE);
ASSERT_TRUE(utf8result_len == 3);
output_buffer.resize(utf8result_len);
ASSERT_TRUE(output_buffer == "h?i");
@@ -201,6 +202,7 @@ std::string TestCharSet::TestUTF16ToCharSet() {
&utf16[0], static_cast<uint32_t>(utf16.size()),
"latin1", PP_CHARSET_TRUSTED_CONVERSIONERROR_SUBSTITUTE,
&output_buffer[0], &utf8result_len);
+ ASSERT_TRUE(result == PP_TRUE);
ASSERT_TRUE(utf8result_len == 2);
ASSERT_TRUE(output_buffer[0] == '?' && output_buffer[1] == 'A');
diff --git a/ppapi/thunk/interfaces_legacy.h b/ppapi/thunk/interfaces_legacy.h
index 6e53ea4580..60518249a0 100644
--- a/ppapi/thunk/interfaces_legacy.h
+++ b/ppapi/thunk/interfaces_legacy.h
@@ -10,8 +10,6 @@ LEGACY_IFACE(PPB_INPUT_EVENT_INTERFACE_1_0,
LEGACY_IFACE(PPB_INSTANCE_PRIVATE_INTERFACE_0_1,
::ppapi::thunk::GetPPB_Instance_Private_0_1_Thunk())
LEGACY_IFACE(PPB_CORE_INTERFACE_1_0, &core_interface)
-LEGACY_IFACE(PPB_GPUBLACKLIST_PRIVATE_INTERFACE,
- PPB_GpuBlacklist_Private_Impl::GetInterface())
LEGACY_IFACE(PPB_OPENGLES2_INTERFACE,
::ppapi::PPB_OpenGLES2_Shared::GetInterface())
LEGACY_IFACE(PPB_OPENGLES2_INSTANCEDARRAYS_INTERFACE,