diff options
-rw-r--r-- | content/renderer/pepper/pepper_plugin_delegate_impl.cc | 4 | ||||
-rw-r--r-- | content/renderer/pepper/pepper_plugin_delegate_impl.h | 1 | ||||
-rw-r--r-- | content/renderer/render_thread_impl.cc | 4 | ||||
-rw-r--r-- | content/renderer/render_thread_impl.h | 2 | ||||
-rw-r--r-- | ppapi/api/private/ppb_flash.idl | 14 | ||||
-rw-r--r-- | ppapi/c/private/ppb_flash.h | 45 | ||||
-rw-r--r-- | ppapi/cpp/private/flash.cc | 22 | ||||
-rw-r--r-- | ppapi/cpp/private/flash.h | 3 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_messages.h | 3 | ||||
-rw-r--r-- | ppapi/proxy/ppb_flash_proxy.cc | 17 | ||||
-rw-r--r-- | ppapi/proxy/ppb_flash_proxy.h | 4 | ||||
-rw-r--r-- | ppapi/thunk/interfaces_ppb_private_flash.h | 3 | ||||
-rw-r--r-- | ppapi/thunk/ppb_flash_api.h | 2 | ||||
-rw-r--r-- | ppapi/thunk/ppb_flash_thunk.cc | 28 | ||||
-rw-r--r-- | webkit/plugins/ppapi/mock_plugin_delegate.cc | 3 | ||||
-rw-r--r-- | webkit/plugins/ppapi/mock_plugin_delegate.h | 1 | ||||
-rw-r--r-- | webkit/plugins/ppapi/plugin_delegate.h | 3 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_flash_impl.cc | 5 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_flash_impl.h | 2 |
19 files changed, 158 insertions, 8 deletions
diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.cc b/content/renderer/pepper/pepper_plugin_delegate_impl.cc index 5803ffb..95085f5 100644 --- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc +++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc @@ -545,6 +545,10 @@ void PepperPluginDelegateImpl::InstanceDeleted( PluginFocusChanged(instance, false); } +void PepperPluginDelegateImpl::SetAllowSuddenTermination(bool allowed) { + RenderThreadImpl::current()->SetAllowSuddenTermination(allowed); +} + SkBitmap* PepperPluginDelegateImpl::GetSadPluginBitmap() { return GetContentClient()->renderer()->GetSadPluginBitmap(); } diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.h b/content/renderer/pepper/pepper_plugin_delegate_impl.h index a7ce753..f1f4dc3 100644 --- a/content/renderer/pepper/pepper_plugin_delegate_impl.h +++ b/content/renderer/pepper/pepper_plugin_delegate_impl.h @@ -167,6 +167,7 @@ class PepperPluginDelegateImpl webkit::ppapi::PluginInstance* instance) OVERRIDE; virtual void InstanceDeleted( webkit::ppapi::PluginInstance* instance) OVERRIDE; + virtual void SetAllowSuddenTermination(bool allowed) OVERRIDE; virtual SkBitmap* GetSadPluginBitmap() OVERRIDE; virtual WebKit::WebPlugin* CreatePluginReplacement( const FilePath& file_path) OVERRIDE; diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index b4c2b68..7009e39 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc @@ -697,6 +697,10 @@ void RenderThreadImpl::PostponeIdleNotification() { idle_notifications_to_skip_ = 2; } +void RenderThreadImpl::SetAllowSuddenTermination(bool allowed) { + webkit_platform_support_->suddenTerminationChanged(allowed); +} + #if defined(OS_WIN) void RenderThreadImpl::PreCacheFont(const LOGFONT& log_font) { Send(new ChildProcessHostMsg_PreCacheFont(log_font)); diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h index a747b91..5b1e98d 100644 --- a/content/renderer/render_thread_impl.h +++ b/content/renderer/render_thread_impl.h @@ -200,6 +200,8 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread, // not sent for at least one notification delay. void PostponeIdleNotification(); + void SetAllowSuddenTermination(bool allowed); + private: virtual bool OnControlMessageReceived(const IPC::Message& msg) OVERRIDE; diff --git a/ppapi/api/private/ppb_flash.idl b/ppapi/api/private/ppb_flash.idl index a08c4d0..6f005a4 100644 --- a/ppapi/api/private/ppb_flash.idl +++ b/ppapi/api/private/ppb_flash.idl @@ -11,7 +11,8 @@ label Chrome { M17 = 12.0, M19 = 12.1, M20_0 = 12.2, - M20_1 = 12.3 + M20_1 = 12.3, + M20_2 = 12.4 }; [assert_size(4)] @@ -167,6 +168,17 @@ interface PPB_Flash { */ [version=12.3] int32_t GetSettingInt(PP_Instance instance, PP_FlashSetting setting); + + /** + * Indicates whether simply killing the renderer as a means of "fast shutdown" + * is acceptable. The initial state is that fast shutdown is allowed. Used + * when the plugin has shutdown actions that depend on a live renderer to + * complete. + */ + [version=12.4] + void SetAllowSuddenTermination( + [in] PP_Instance instance, + [in] PP_Bool allowed); }; #inline c diff --git a/ppapi/c/private/ppb_flash.h b/ppapi/c/private/ppb_flash.h index b7dc4bc..54959b9 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 Tue May 01 16:01:19 2012. */ +/* From private/ppb_flash.idl modified Fri May 4 10:14:01 2012. */ #ifndef PPAPI_C_PRIVATE_PPB_FLASH_H_ #define PPAPI_C_PRIVATE_PPB_FLASH_H_ @@ -25,7 +25,8 @@ #define PPB_FLASH_INTERFACE_12_1 "PPB_Flash;12.1" #define PPB_FLASH_INTERFACE_12_2 "PPB_Flash;12.2" #define PPB_FLASH_INTERFACE_12_3 "PPB_Flash;12.3" -#define PPB_FLASH_INTERFACE PPB_FLASH_INTERFACE_12_3 +#define PPB_FLASH_INTERFACE_12_4 "PPB_Flash;12.4" +#define PPB_FLASH_INTERFACE PPB_FLASH_INTERFACE_12_4 /** * @file @@ -70,7 +71,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_3 { +struct PPB_Flash_12_4 { /** * 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 @@ -162,9 +163,16 @@ struct PPB_Flash_12_3 { * result in -1 return value. */ int32_t (*GetSettingInt)(PP_Instance instance, PP_FlashSetting setting); + /** + * Indicates whether simply killing the renderer as a means of "fast shutdown" + * is acceptable. The initial state is that fast shutdown is allowed. Used + * when the plugin has shutdown actions that depend on a live renderer to + * complete. + */ + void (*SetAllowSuddenTermination)(PP_Instance instance, PP_Bool allowed); }; -typedef struct PPB_Flash_12_3 PPB_Flash; +typedef struct PPB_Flash_12_4 PPB_Flash; struct PPB_Flash_12_0 { void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top); @@ -244,6 +252,35 @@ struct PPB_Flash_12_2 { void (*UpdateActivity)(PP_Instance instance); struct PP_Var (*GetDeviceID)(PP_Instance instance); }; + +struct PPB_Flash_12_3 { + 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); +}; /** * @} */ diff --git a/ppapi/cpp/private/flash.cc b/ppapi/cpp/private/flash.cc index a141f63..0c9f26c 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_4>() { + return PPB_FLASH_INTERFACE_12_4; +} + template <> const char* interface_name<PPB_Flash_12_3>() { return PPB_FLASH_INTERFACE_12_3; } @@ -57,7 +61,10 @@ PPB_Flash flash_12_combined_interface; void InitializeCombinedInterface() { if (initialized_combined_interface) return; - if (has_interface<PPB_Flash_12_3>()) { + 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>()) { memcpy(&flash_12_combined_interface, get_interface<PPB_Flash_12_3>(), sizeof(PPB_Flash_12_3)); } else if (has_interface<PPB_Flash_12_2>()) { @@ -79,7 +86,8 @@ namespace flash { // static bool Flash::IsAvailable() { - return has_interface<PPB_Flash_12_3>() || + return has_interface<PPB_Flash_12_4>() || + has_interface<PPB_Flash_12_3>() || has_interface<PPB_Flash_12_2>() || has_interface<PPB_Flash_12_1>() || has_interface<PPB_Flash_12_0>() || @@ -233,6 +241,16 @@ int32_t Flash::GetSettingInt(const InstanceHandle& instance, } // static +void Flash::SetAllowSuddenTermination(const InstanceHandle& instance, + bool allowed) { + InitializeCombinedInterface(); + if (flash_12_combined_interface.SetAllowSuddenTermination) { + flash_12_combined_interface.SetAllowSuddenTermination( + instance.pp_instance(), PP_FromBool(allowed)); + } +} + +// static void 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 0156036..fbc7964 100644 --- a/ppapi/cpp/private/flash.h +++ b/ppapi/cpp/private/flash.h @@ -60,7 +60,8 @@ class Flash { static Var GetDeviceID(const InstanceHandle& instance); static int32_t GetSettingInt(const InstanceHandle& instance, PP_FlashSetting setting); - + static void SetAllowSuddenTermination(const InstanceHandle& instance, + bool allowed); // PPB_Flash_Print. static void InvokePrinting(const InstanceHandle& instance); }; diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index 7e4a4c9..04e2b85 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -1175,6 +1175,9 @@ IPC_SYNC_MESSAGE_ROUTED1_2(PpapiHostMsg_PPBFlash_FlashGetScreenSize, PP_Instance /* instance */, PP_Bool /* result */, PP_Size /* size */) +IPC_SYNC_MESSAGE_ROUTED2_0(PpapiHostMsg_PPBFlash_SetAllowSuddenTermination, + PP_Instance /* instance */, + PP_Bool /* allowed */) IPC_MESSAGE_ROUTED0(PpapiHostMsg_PPBFlash_UpdateActivity) IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBFlash_GetDeviceID, PP_Instance /* instance */, diff --git a/ppapi/proxy/ppb_flash_proxy.cc b/ppapi/proxy/ppb_flash_proxy.cc index cd4365c..f4925ba 100644 --- a/ppapi/proxy/ppb_flash_proxy.cc +++ b/ppapi/proxy/ppb_flash_proxy.cc @@ -402,6 +402,8 @@ bool PPB_Flash_Proxy::OnMessageReceived(const IPC::Message& msg) { OnHostMsgFlashSetFullscreen) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_FlashGetScreenSize, OnHostMsgFlashGetScreenSize) + IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_SetAllowSuddenTermination, + OnHostMsgFlashSetAllowSuddenTermination) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_IsClipboardFormatAvailable, OnHostMsgIsClipboardFormatAvailable) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_ReadClipboardData, @@ -805,6 +807,12 @@ PP_Bool PPB_Flash_Proxy::FlashGetScreenSize(PP_Instance instance, return result; } +void PPB_Flash_Proxy::SetAllowSuddenTermination(PP_Instance instance, + PP_Bool allowed) { + dispatcher()->Send(new PpapiHostMsg_PPBFlash_SetAllowSuddenTermination( + API_ID_PPB_FLASH, instance, allowed)); +} + void PPB_Flash_Proxy::OnHostMsgSetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) { EnterInstanceNoLock enter(instance); @@ -953,6 +961,15 @@ void PPB_Flash_Proxy::OnHostMsgFlashGetScreenSize(PP_Instance instance, } } +void PPB_Flash_Proxy::OnHostMsgFlashSetAllowSuddenTermination( + PP_Instance instance, PP_Bool allowed) { + EnterInstanceNoLock enter(instance); + if (enter.succeeded()) { + enter.functions()->GetFlashAPI()->SetAllowSuddenTermination(instance, + allowed); + } +} + void PPB_Flash_Proxy::OnHostMsgIsClipboardFormatAvailable( PP_Instance instance, int clipboard_type, diff --git a/ppapi/proxy/ppb_flash_proxy.h b/ppapi/proxy/ppb_flash_proxy.h index ce007bb..5f871d2 100644 --- a/ppapi/proxy/ppb_flash_proxy.h +++ b/ppapi/proxy/ppb_flash_proxy.h @@ -111,6 +111,8 @@ class PPB_Flash_Proxy : public InterfaceProxy, public PPB_Flash_Shared { PP_Bool fullscreen) OVERRIDE; virtual PP_Bool FlashGetScreenSize(PP_Instance instance, PP_Size* size) OVERRIDE; + virtual void SetAllowSuddenTermination(PP_Instance instance, + PP_Bool allowed) OVERRIDE; static const ApiID kApiID = API_ID_PPB_FLASH; @@ -142,6 +144,8 @@ class PPB_Flash_Proxy : public InterfaceProxy, public PPB_Flash_Shared { void OnHostMsgFlashGetScreenSize(PP_Instance instance, PP_Bool* result, PP_Size* size); + void OnHostMsgFlashSetAllowSuddenTermination(PP_Instance instance, + PP_Bool allowed); void OnHostMsgIsClipboardFormatAvailable(PP_Instance instance, int clipboard_type, int format, diff --git a/ppapi/thunk/interfaces_ppb_private_flash.h b/ppapi/thunk/interfaces_ppb_private_flash.h index e36f502..fa8842a 100644 --- a/ppapi/thunk/interfaces_ppb_private_flash.h +++ b/ppapi/thunk/interfaces_ppb_private_flash.h @@ -20,6 +20,9 @@ PROXIED_IFACE(PPB_Flash, PROXIED_IFACE(PPB_Flash, PPB_FLASH_INTERFACE_12_3, PPB_Flash_12_3) +PROXIED_IFACE(PPB_Flash, + PPB_FLASH_INTERFACE_12_4, + PPB_Flash_12_4) 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 3e1bf56..8483cab1 100644 --- a/ppapi/thunk/ppb_flash_api.h +++ b/ppapi/thunk/ppb_flash_api.h @@ -45,6 +45,8 @@ class PPAPI_THUNK_EXPORT PPB_Flash_API { virtual PP_Var GetDeviceID(PP_Instance instance) = 0; virtual int32_t GetSettingInt(PP_Instance instance, PP_FlashSetting setting) = 0; + virtual void SetAllowSuddenTermination(PP_Instance instance, + PP_Bool allowed) = 0; // FlashClipboard. virtual PP_Bool IsClipboardFormatAvailable( diff --git a/ppapi/thunk/ppb_flash_thunk.cc b/ppapi/thunk/ppb_flash_thunk.cc index 4e004fb..c342803 100644 --- a/ppapi/thunk/ppb_flash_thunk.cc +++ b/ppapi/thunk/ppb_flash_thunk.cc @@ -139,6 +139,14 @@ int32_t GetSettingInt(PP_Instance instance, PP_FlashSetting setting) { return enter.functions()->GetFlashAPI()->GetSettingInt(instance, setting); } +void SetAllowSuddenTermination(PP_Instance instance, PP_Bool allowed) { + EnterInstance enter(instance); + if (enter.succeeded()) { + enter.functions()->GetFlashAPI()->SetAllowSuddenTermination(instance, + allowed); + } +} + const PPB_Flash_12_0 g_ppb_flash_12_0_thunk = { &SetInstanceAlwaysOnTop, &DrawGlyphs, @@ -199,6 +207,23 @@ const PPB_Flash_12_3 g_ppb_flash_12_3_thunk = { &GetSettingInt }; +const PPB_Flash_12_4 g_ppb_flash_12_4_thunk = { + &SetInstanceAlwaysOnTop, + &DrawGlyphs, + &GetProxyForURL, + &Navigate, + &RunMessageLoop, + &QuitMessageLoop, + &GetLocalTimeZoneOffset, + &GetCommandLineArgs, + &PreLoadFontWin, + &IsRectTopmost, + &InvokePrinting, + &UpdateActivity, + &GetDeviceID, + &GetSettingInt, + &SetAllowSuddenTermination +}; } // namespace const PPB_Flash_12_0* GetPPB_Flash_12_0_Thunk() { @@ -217,5 +242,8 @@ const PPB_Flash_12_3* GetPPB_Flash_12_3_Thunk() { return &g_ppb_flash_12_3_thunk; } +const PPB_Flash_12_4* GetPPB_Flash_12_4_Thunk() { + return &g_ppb_flash_12_4_thunk; +} } // namespace thunk } // namespace ppapi diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.cc b/webkit/plugins/ppapi/mock_plugin_delegate.cc index 971754c..ef7df7a 100644 --- a/webkit/plugins/ppapi/mock_plugin_delegate.cc +++ b/webkit/plugins/ppapi/mock_plugin_delegate.cc @@ -46,6 +46,9 @@ void MockPluginDelegate::InstanceCreated(PluginInstance* instance) { void MockPluginDelegate::InstanceDeleted(PluginInstance* instance) { } +void MockPluginDelegate::SetAllowSuddenTermination(bool allowed) { +} + SkBitmap* MockPluginDelegate::GetSadPluginBitmap() { return NULL; } diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.h b/webkit/plugins/ppapi/mock_plugin_delegate.h index 91c62e0..48ab17d 100644 --- a/webkit/plugins/ppapi/mock_plugin_delegate.h +++ b/webkit/plugins/ppapi/mock_plugin_delegate.h @@ -27,6 +27,7 @@ class MockPluginDelegate : public PluginDelegate { virtual void PluginCrashed(PluginInstance* instance); virtual void InstanceCreated(PluginInstance* instance); virtual void InstanceDeleted(PluginInstance* instance); + virtual void SetAllowSuddenTermination(bool allowed); virtual SkBitmap* GetSadPluginBitmap(); virtual WebKit::WebPlugin* CreatePluginReplacement(const FilePath& file_path); virtual PlatformImage2D* CreateImage2D(int width, int height); diff --git a/webkit/plugins/ppapi/plugin_delegate.h b/webkit/plugins/ppapi/plugin_delegate.h index 304cb09..c71767a 100644 --- a/webkit/plugins/ppapi/plugin_delegate.h +++ b/webkit/plugins/ppapi/plugin_delegate.h @@ -330,6 +330,9 @@ class PluginDelegate { // from this call. virtual void InstanceDeleted(PluginInstance* instance) = 0; + // Indicates if the plugin needs a live renderer at termination. + virtual void SetAllowSuddenTermination(bool allowed) = 0; + // Returns a pointer (ownership not transferred) to the bitmap to paint the // sad plugin screen with. Returns NULL on failure. virtual SkBitmap* GetSadPluginBitmap() = 0; diff --git a/webkit/plugins/ppapi/ppb_flash_impl.cc b/webkit/plugins/ppapi/ppb_flash_impl.cc index babd3f7..be12642 100644 --- a/webkit/plugins/ppapi/ppb_flash_impl.cc +++ b/webkit/plugins/ppapi/ppb_flash_impl.cc @@ -252,6 +252,11 @@ int32_t PPB_Flash_Impl::GetSettingInt(PP_Instance instance, return -1; } +void PPB_Flash_Impl::SetAllowSuddenTermination(PP_Instance instance, + PP_Bool allowed) { + instance_->delegate()->SetAllowSuddenTermination(PP_ToBool(allowed)); +} + PP_Bool PPB_Flash_Impl::IsClipboardFormatAvailable( PP_Instance instance, PP_Flash_Clipboard_Type clipboard_type, diff --git a/webkit/plugins/ppapi/ppb_flash_impl.h b/webkit/plugins/ppapi/ppb_flash_impl.h index 2cabc03..a4ad38d 100644 --- a/webkit/plugins/ppapi/ppb_flash_impl.h +++ b/webkit/plugins/ppapi/ppb_flash_impl.h @@ -57,6 +57,8 @@ class PPB_Flash_Impl : public ::ppapi::PPB_Flash_Shared { virtual PP_Var GetDeviceID(PP_Instance instance) OVERRIDE; virtual int32_t GetSettingInt(PP_Instance instance, PP_FlashSetting settiny) OVERRIDE; + virtual void SetAllowSuddenTermination(PP_Instance instance, + PP_Bool allowed) OVERRIDE; virtual PP_Bool IsClipboardFormatAvailable( PP_Instance instance, PP_Flash_Clipboard_Type clipboard_type, |