summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-27 19:30:58 +0000
committerraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-27 19:30:58 +0000
commit72a1072525f076a8fb46de782df640e3006512a2 (patch)
treec0c3ebba54b1dcb4d758a9810fab23a0ddcfeb0e /ppapi
parent6c1d2994c9472e09336d08a496d54332256dcc22 (diff)
downloadchromium_src-72a1072525f076a8fb46de782df640e3006512a2.zip
chromium_src-72a1072525f076a8fb46de782df640e3006512a2.tar.gz
chromium_src-72a1072525f076a8fb46de782df640e3006512a2.tar.bz2
This adds an interface for setting crash data from a plugin. It also provides an implementation for setting crash URLs.
BUG=134176 TEST=Added test case to sanity check API call. Also hooked up to flash and produced a crash and checked that the report included the document url (http://crash/reportdetail?reportid=1719cae3a745f633) Review URL: https://chromiumcodereview.appspot.com/10681006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144516 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/api/private/ppb_flash.idl23
-rw-r--r--ppapi/c/private/ppb_flash.h57
-rw-r--r--ppapi/cpp/private/flash.cc25
-rw-r--r--ppapi/cpp/private/flash.h3
-rw-r--r--ppapi/proxy/plugin_proxy_delegate.h5
-rw-r--r--ppapi/proxy/ppapi_proxy_test.cc4
-rw-r--r--ppapi/proxy/ppapi_proxy_test.h1
-rw-r--r--ppapi/proxy/ppb_flash_proxy.cc15
-rw-r--r--ppapi/proxy/ppb_flash_proxy.h3
-rw-r--r--ppapi/tests/test_flash.cc10
-rw-r--r--ppapi/tests/test_flash.h1
-rw-r--r--ppapi/thunk/interfaces_ppb_private_flash.h5
-rw-r--r--ppapi/thunk/ppb_flash_api.h3
-rw-r--r--ppapi/thunk/ppb_flash_thunk.cc32
14 files changed, 178 insertions, 9 deletions
diff --git a/ppapi/api/private/ppb_flash.idl b/ppapi/api/private/ppb_flash.idl
index f6c5c7a..12b44b2 100644
--- a/ppapi/api/private/ppb_flash.idl
+++ b/ppapi/api/private/ppb_flash.idl
@@ -12,7 +12,8 @@ label Chrome {
M19 = 12.1,
M20_0 = 12.2,
M20_1 = 12.3,
- M21 = 12.4
+ M21 = 12.4,
+ M22 = 12.5
};
[assert_size(4)]
@@ -65,6 +66,17 @@ enum PP_FlashSetting {
};
/**
+ * This enum provides keys for setting breakpad crash report data.
+ */
+[assert_size(4)]
+enum PP_FlashCrashKey {
+ /**
+ * Specifies the document URL which contains the flash instance.
+ */
+ PP_FLASHCRASHKEY_URL = 1
+};
+
+/**
* The <code>PPB_Flash</code> interface contains pointers to various functions
* that are only needed to support Pepper Flash.
*/
@@ -202,4 +214,13 @@ interface PPB_Flash {
*/
[version=12.4]
PP_Var GetSetting(PP_Instance instance, PP_FlashSetting setting);
+
+ /**
+ * Allows setting breakpad crash data which will be included in plugin crash
+ * reports. Returns PP_FALSE if crash data could not be set.
+ */
+ [version=12.5]
+ PP_Bool SetCrashData([in] PP_Instance instance,
+ [in] PP_FlashCrashKey key,
+ [in] PP_Var value);
};
diff --git a/ppapi/c/private/ppb_flash.h b/ppapi/c/private/ppb_flash.h
index fa11b80..8d52f02 100644
--- a/ppapi/c/private/ppb_flash.h
+++ b/ppapi/c/private/ppb_flash.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From private/ppb_flash.idl modified Thu Jun 14 16:38:53 2012. */
+/* From private/ppb_flash.idl modified Mon Jun 25 12:46:59 2012. */
#ifndef PPAPI_C_PRIVATE_PPB_FLASH_H_
#define PPAPI_C_PRIVATE_PPB_FLASH_H_
@@ -26,7 +26,8 @@
#define PPB_FLASH_INTERFACE_12_2 "PPB_Flash;12.2"
#define PPB_FLASH_INTERFACE_12_3 "PPB_Flash;12.3"
#define PPB_FLASH_INTERFACE_12_4 "PPB_Flash;12.4"
-#define PPB_FLASH_INTERFACE PPB_FLASH_INTERFACE_12_4
+#define PPB_FLASH_INTERFACE_12_5 "PPB_Flash;12.5"
+#define PPB_FLASH_INTERFACE PPB_FLASH_INTERFACE_12_5
/**
* @file
@@ -82,6 +83,17 @@ typedef enum {
PP_FLASHSETTING_NUMCORES = 5
} PP_FlashSetting;
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FlashSetting, 4);
+
+/**
+ * This enum provides keys for setting breakpad crash report data.
+ */
+typedef enum {
+ /**
+ * Specifies the document URL which contains the flash instance.
+ */
+ PP_FLASHCRASHKEY_URL = 1
+} PP_FlashCrashKey;
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FlashCrashKey, 4);
/**
* @}
*/
@@ -94,7 +106,7 @@ PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FlashSetting, 4);
* The <code>PPB_Flash</code> interface contains pointers to various functions
* that are only needed to support Pepper Flash.
*/
-struct PPB_Flash_12_4 {
+struct PPB_Flash_12_5 {
/**
* Sets or clears the rendering hint that the given plugin instance is always
* on top of page content. Somewhat more optimized painting can be used in
@@ -191,9 +203,16 @@ struct PPB_Flash_12_4 {
* result in an undefined PP_Var return value.
*/
struct PP_Var (*GetSetting)(PP_Instance instance, PP_FlashSetting setting);
+ /**
+ * Allows setting breakpad crash data which will be included in plugin crash
+ * reports. Returns PP_FALSE if crash data could not be set.
+ */
+ PP_Bool (*SetCrashData)(PP_Instance instance,
+ PP_FlashCrashKey key,
+ struct PP_Var value);
};
-typedef struct PPB_Flash_12_4 PPB_Flash;
+typedef struct PPB_Flash_12_5 PPB_Flash;
struct PPB_Flash_12_0 {
void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top);
@@ -302,6 +321,36 @@ struct PPB_Flash_12_3 {
struct PP_Var (*GetDeviceID)(PP_Instance instance);
int32_t (*GetSettingInt)(PP_Instance instance, PP_FlashSetting setting);
};
+
+struct PPB_Flash_12_4 {
+ void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top);
+ PP_Bool (*DrawGlyphs)(PP_Instance instance,
+ PP_Resource pp_image_data,
+ const struct PP_FontDescription_Dev* font_desc,
+ uint32_t color,
+ const struct PP_Point* position,
+ const struct PP_Rect* clip,
+ const float transformation[3][3],
+ PP_Bool allow_subpixel_aa,
+ uint32_t glyph_count,
+ const uint16_t glyph_indices[],
+ const struct PP_Point glyph_advances[]);
+ struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url);
+ int32_t (*Navigate)(PP_Resource request_info,
+ const char* target,
+ PP_Bool from_user_action);
+ void (*RunMessageLoop)(PP_Instance instance);
+ void (*QuitMessageLoop)(PP_Instance instance);
+ double (*GetLocalTimeZoneOffset)(PP_Instance instance, PP_Time t);
+ struct PP_Var (*GetCommandLineArgs)(PP_Module module);
+ void (*PreloadFontWin)(const void* logfontw);
+ PP_Bool (*IsRectTopmost)(PP_Instance instance, const struct PP_Rect* rect);
+ int32_t (*InvokePrinting)(PP_Instance instance);
+ void (*UpdateActivity)(PP_Instance instance);
+ struct PP_Var (*GetDeviceID)(PP_Instance instance);
+ int32_t (*GetSettingInt)(PP_Instance instance, PP_FlashSetting setting);
+ struct PP_Var (*GetSetting)(PP_Instance instance, PP_FlashSetting setting);
+};
/**
* @}
*/
diff --git a/ppapi/cpp/private/flash.cc b/ppapi/cpp/private/flash.cc
index 6af7c3d..2c91431 100644
--- a/ppapi/cpp/private/flash.cc
+++ b/ppapi/cpp/private/flash.cc
@@ -24,6 +24,10 @@ namespace pp {
namespace {
+template <> const char* interface_name<PPB_Flash_12_5>() {
+ return PPB_FLASH_INTERFACE_12_5;
+}
+
template <> const char* interface_name<PPB_Flash_12_4>() {
return PPB_FLASH_INTERFACE_12_4;
}
@@ -61,7 +65,10 @@ PPB_Flash flash_12_combined_interface;
void InitializeCombinedInterface() {
if (initialized_combined_interface)
return;
- if (has_interface<PPB_Flash_12_4>()) {
+ if (has_interface<PPB_Flash_12_5>()) {
+ memcpy(&flash_12_combined_interface, get_interface<PPB_Flash_12_5>(),
+ sizeof(PPB_Flash_12_5));
+ } else if (has_interface<PPB_Flash_12_4>()) {
memcpy(&flash_12_combined_interface, get_interface<PPB_Flash_12_4>(),
sizeof(PPB_Flash_12_4));
} else if (has_interface<PPB_Flash_12_3>()) {
@@ -86,7 +93,8 @@ namespace flash {
// static
bool Flash::IsAvailable() {
- return has_interface<PPB_Flash_12_4>() ||
+ return has_interface<PPB_Flash_12_5>() ||
+ has_interface<PPB_Flash_12_4>() ||
has_interface<PPB_Flash_12_3>() ||
has_interface<PPB_Flash_12_2>() ||
has_interface<PPB_Flash_12_1>() ||
@@ -249,6 +257,19 @@ Var Flash::GetSetting(const InstanceHandle& instance, PP_FlashSetting setting) {
}
// static
+bool Flash::SetCrashData(const InstanceHandle& instance,
+ PP_FlashCrashKey key,
+ const pp::Var& value) {
+ InitializeCombinedInterface();
+ if (flash_12_combined_interface.SetCrashData) {
+ return PP_ToBool(
+ flash_12_combined_interface.SetCrashData(instance.pp_instance(),
+ key, value.pp_var()));
+ }
+ return false;
+}
+
+// static
bool Flash::InvokePrinting(const InstanceHandle& instance) {
if (has_interface<PPB_Flash_Print_1_0>()) {
get_interface<PPB_Flash_Print_1_0>()->InvokePrinting(
diff --git a/ppapi/cpp/private/flash.h b/ppapi/cpp/private/flash.h
index c32007e..dc5f929 100644
--- a/ppapi/cpp/private/flash.h
+++ b/ppapi/cpp/private/flash.h
@@ -60,6 +60,9 @@ class Flash {
static Var GetDeviceID(const InstanceHandle& instance);
static Var GetSetting(const InstanceHandle& instance,
PP_FlashSetting setting);
+ static bool SetCrashData(const InstanceHandle& instance,
+ PP_FlashCrashKey key,
+ const pp::Var& value);
// PPB_Flash_Print.
static bool InvokePrinting(const InstanceHandle& instance);
diff --git a/ppapi/proxy/plugin_proxy_delegate.h b/ppapi/proxy/plugin_proxy_delegate.h
index 82b540e..0ce2655 100644
--- a/ppapi/proxy/plugin_proxy_delegate.h
+++ b/ppapi/proxy/plugin_proxy_delegate.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// 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.
@@ -24,6 +24,9 @@ class PPAPI_PROXY_EXPORT PluginProxyDelegate {
// Performs Windows-specific font caching in the browser for the given
// LOGFONTW. Does nothing on non-Windows platforms.
virtual void PreCacheFont(const void* logfontw) = 0;
+
+ // Sets the active url which is reported by breakpad.
+ virtual void SetActiveURL(const std::string& url) = 0;
};
} // namespace proxy
diff --git a/ppapi/proxy/ppapi_proxy_test.cc b/ppapi/proxy/ppapi_proxy_test.cc
index deeb8f4..1e68afc 100644
--- a/ppapi/proxy/ppapi_proxy_test.cc
+++ b/ppapi/proxy/ppapi_proxy_test.cc
@@ -237,6 +237,10 @@ void PluginProxyTestHarness::PluginDelegateMock::PreCacheFont(
const void* logfontw) {
}
+void PluginProxyTestHarness::PluginDelegateMock::SetActiveURL(
+ const std::string& url) {
+}
+
// PluginProxyTest -------------------------------------------------------------
PluginProxyTest::PluginProxyTest() {
diff --git a/ppapi/proxy/ppapi_proxy_test.h b/ppapi/proxy/ppapi_proxy_test.h
index 1de0809..b4ad1b5 100644
--- a/ppapi/proxy/ppapi_proxy_test.h
+++ b/ppapi/proxy/ppapi_proxy_test.h
@@ -128,6 +128,7 @@ class PluginProxyTestHarness : public ProxyTestHarnessBase {
virtual bool SendToBrowser(IPC::Message* msg) OVERRIDE;
virtual std::string GetUILanguage() OVERRIDE;
virtual void PreCacheFont(const void* logfontw) OVERRIDE;
+ virtual void SetActiveURL(const std::string& url) OVERRIDE;
private:
base::MessageLoopProxy* ipc_message_loop_; // Weak
diff --git a/ppapi/proxy/ppb_flash_proxy.cc b/ppapi/proxy/ppb_flash_proxy.cc
index 0033a10..ba2ae81 100644
--- a/ppapi/proxy/ppb_flash_proxy.cc
+++ b/ppapi/proxy/ppb_flash_proxy.cc
@@ -307,6 +307,21 @@ PP_Var PPB_Flash_Proxy::GetSetting(PP_Instance instance,
return PP_MakeUndefined();
}
+PP_Bool PPB_Flash_Proxy::SetCrashData(PP_Instance instance,
+ PP_FlashCrashKey key,
+ PP_Var value) {
+ switch (key) {
+ case PP_FLASHCRASHKEY_URL:
+ StringVar *url_string_var(StringVar::FromPPVar(value));
+ if (!url_string_var)
+ return PP_FALSE;
+ std::string url_string(url_string_var->value());
+ PluginGlobals::Get()->plugin_proxy_delegate()->SetActiveURL(url_string);
+ return PP_TRUE;
+ }
+ return PP_FALSE;
+}
+
PP_Bool PPB_Flash_Proxy::IsClipboardFormatAvailable(
PP_Instance instance,
PP_Flash_Clipboard_Type clipboard_type,
diff --git a/ppapi/proxy/ppb_flash_proxy.h b/ppapi/proxy/ppb_flash_proxy.h
index c441455..a0c273f 100644
--- a/ppapi/proxy/ppb_flash_proxy.h
+++ b/ppapi/proxy/ppb_flash_proxy.h
@@ -76,6 +76,9 @@ class PPB_Flash_Proxy : public InterfaceProxy, public PPB_Flash_Shared {
PP_FlashSetting setting) OVERRIDE;
virtual PP_Var GetSetting(PP_Instance instance,
PP_FlashSetting setting) OVERRIDE;
+ virtual PP_Bool SetCrashData(PP_Instance instance,
+ PP_FlashCrashKey key,
+ PP_Var value) OVERRIDE;
virtual PP_Bool IsClipboardFormatAvailable(
PP_Instance instance,
PP_Flash_Clipboard_Type clipboard_type,
diff --git a/ppapi/tests/test_flash.cc b/ppapi/tests/test_flash.cc
index e9964e2..458de78 100644
--- a/ppapi/tests/test_flash.cc
+++ b/ppapi/tests/test_flash.cc
@@ -35,6 +35,7 @@ void TestFlash::RunTests(const std::string& filter) {
RUN_TEST(GetDeviceID, filter);
RUN_TEST(GetSettingInt, filter);
RUN_TEST(GetSetting, filter);
+ RUN_TEST(SetCrashData, filter);
}
std::string TestFlash::TestSetInstanceAlwaysOnTop() {
@@ -176,6 +177,15 @@ std::string TestFlash::TestGetSetting() {
PASS();
}
+std::string TestFlash::TestSetCrashData() {
+ pp::Var url("http://...");
+ ASSERT_TRUE(flash_interface_->SetCrashData(instance_->pp_instance(),
+ PP_FLASHCRASHKEY_URL,
+ url.pp_var()));
+
+ PASS();
+}
+
void TestFlash::QuitMessageLoopTask(int32_t) {
flash_interface_->QuitMessageLoop(instance_->pp_instance());
}
diff --git a/ppapi/tests/test_flash.h b/ppapi/tests/test_flash.h
index 602f5f0..0643db2 100644
--- a/ppapi/tests/test_flash.h
+++ b/ppapi/tests/test_flash.h
@@ -32,6 +32,7 @@ class TestFlash : public TestCase {
std::string TestGetDeviceID();
std::string TestGetSettingInt();
std::string TestGetSetting();
+ std::string TestSetCrashData();
void QuitMessageLoopTask(int32_t);
diff --git a/ppapi/thunk/interfaces_ppb_private_flash.h b/ppapi/thunk/interfaces_ppb_private_flash.h
index fb5817b..7226020 100644
--- a/ppapi/thunk/interfaces_ppb_private_flash.h
+++ b/ppapi/thunk/interfaces_ppb_private_flash.h
@@ -22,7 +22,10 @@ PROXIED_IFACE(PPB_Flash,
PPB_Flash_12_3)
PROXIED_IFACE(PPB_Flash,
PPB_FLASH_INTERFACE_12_4,
- PPB_Flash_12_4)
+ PPB_Flash_12_4)
+PROXIED_IFACE(PPB_Flash,
+ PPB_FLASH_INTERFACE_12_5,
+ PPB_Flash_12_5)
PROXIED_IFACE(PPB_Flash,
PPB_FLASH_CLIPBOARD_INTERFACE_3_LEGACY,
diff --git a/ppapi/thunk/ppb_flash_api.h b/ppapi/thunk/ppb_flash_api.h
index 823740e..8e24e44 100644
--- a/ppapi/thunk/ppb_flash_api.h
+++ b/ppapi/thunk/ppb_flash_api.h
@@ -45,6 +45,9 @@ class PPAPI_THUNK_EXPORT PPB_Flash_API {
virtual int32_t GetSettingInt(PP_Instance instance,
PP_FlashSetting setting) = 0;
virtual PP_Var GetSetting(PP_Instance instance, PP_FlashSetting setting) = 0;
+ virtual PP_Bool SetCrashData(PP_Instance instance,
+ PP_FlashCrashKey key,
+ PP_Var value) = 0;
// FlashClipboard.
virtual PP_Bool IsClipboardFormatAvailable(
diff --git a/ppapi/thunk/ppb_flash_thunk.cc b/ppapi/thunk/ppb_flash_thunk.cc
index c988b6a..85ca393 100644
--- a/ppapi/thunk/ppb_flash_thunk.cc
+++ b/ppapi/thunk/ppb_flash_thunk.cc
@@ -144,6 +144,15 @@ PP_Var GetSetting(PP_Instance instance, PP_FlashSetting setting) {
return enter.functions()->GetFlashAPI()->GetSetting(instance, setting);
}
+PP_Bool SetCrashData(PP_Instance instance,
+ PP_FlashCrashKey key,
+ PP_Var value) {
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.functions()->GetFlashAPI()->SetCrashData(instance, key, value);
+}
+
const PPB_Flash_12_0 g_ppb_flash_12_0_thunk = {
&SetInstanceAlwaysOnTop,
&DrawGlyphs,
@@ -222,6 +231,25 @@ const PPB_Flash_12_4 g_ppb_flash_12_4_thunk = {
&GetSetting
};
+const PPB_Flash_12_5 g_ppb_flash_12_5_thunk = {
+ &SetInstanceAlwaysOnTop,
+ &DrawGlyphs,
+ &GetProxyForURL,
+ &Navigate,
+ &RunMessageLoop,
+ &QuitMessageLoop,
+ &GetLocalTimeZoneOffset,
+ &GetCommandLineArgs,
+ &PreLoadFontWin,
+ &IsRectTopmost,
+ &InvokePrinting,
+ &UpdateActivity,
+ &GetDeviceID,
+ &GetSettingInt,
+ &GetSetting,
+ &SetCrashData
+};
+
} // namespace
const PPB_Flash_12_0* GetPPB_Flash_12_0_Thunk() {
@@ -244,5 +272,9 @@ const PPB_Flash_12_4* GetPPB_Flash_12_4_Thunk() {
return &g_ppb_flash_12_4_thunk;
}
+const PPB_Flash_12_5* GetPPB_Flash_12_5_Thunk() {
+ return &g_ppb_flash_12_5_thunk;
+}
+
} // namespace thunk
} // namespace ppapi