diff options
author | piman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-04 20:23:45 +0000 |
---|---|---|
committer | piman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-04 20:23:45 +0000 |
commit | 6a160e7875ec2b1b6003480c4a61ba236a649a24 (patch) | |
tree | 77d6bbe4cae93188f547c175ae8f3da88da27068 /ppapi/proxy | |
parent | 57c70e3af079daeaf87f88da9c2c0989b8971c8c (diff) | |
download | chromium_src-6a160e7875ec2b1b6003480c4a61ba236a649a24.zip chromium_src-6a160e7875ec2b1b6003480c4a61ba236a649a24.tar.gz chromium_src-6a160e7875ec2b1b6003480c4a61ba236a649a24.tar.bz2 |
Pass fullscreen state along with DidChangeView to avoid sync messages
BUG=none
TEST=NYTimes with Pepper Flash, check that video still plays while scrolling.
Review URL: http://codereview.chromium.org/6923001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84112 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy')
-rw-r--r-- | ppapi/proxy/plugin_dispatcher.h | 2 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_messages.h | 8 | ||||
-rw-r--r-- | ppapi/proxy/ppb_fullscreen_proxy.cc | 18 | ||||
-rw-r--r-- | ppapi/proxy/ppb_fullscreen_proxy.h | 4 | ||||
-rw-r--r-- | ppapi/proxy/ppp_instance_proxy.cc | 16 | ||||
-rw-r--r-- | ppapi/proxy/ppp_instance_proxy.h | 5 |
6 files changed, 27 insertions, 26 deletions
diff --git a/ppapi/proxy/plugin_dispatcher.h b/ppapi/proxy/plugin_dispatcher.h index efa0d70..c3df7ae 100644 --- a/ppapi/proxy/plugin_dispatcher.h +++ b/ppapi/proxy/plugin_dispatcher.h @@ -26,7 +26,9 @@ namespace proxy { // Used to keep track of per-instance data. struct InstanceData { + InstanceData() : fullscreen(PP_FALSE) {} PP_Rect position; + PP_Bool fullscreen; }; class PluginDispatcher : public Dispatcher { diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index 6bbd8bd..916f508 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -209,10 +209,11 @@ IPC_SYNC_MESSAGE_ROUTED3_1(PpapiMsg_PPPInstance_DidCreate, PP_Bool /* result */) IPC_SYNC_MESSAGE_ROUTED1_0(PpapiMsg_PPPInstance_DidDestroy, PP_Instance /* instance */) -IPC_MESSAGE_ROUTED3(PpapiMsg_PPPInstance_DidChangeView, +IPC_MESSAGE_ROUTED4(PpapiMsg_PPPInstance_DidChangeView, PP_Instance /* instance */, PP_Rect /* position */, - PP_Rect /* clip */) + PP_Rect /* clip */, + PP_Bool /* fullscreen */) IPC_MESSAGE_ROUTED2(PpapiMsg_PPPInstance_DidChangeFocus, PP_Instance /* instance */, PP_Bool /* has_focus */) @@ -562,9 +563,6 @@ IPC_SYNC_MESSAGE_ROUTED5_1(PpapiHostMsg_PPBFont_PixelOffsetForCharacter, int32_t /* result */) // PPB_Fullscreen. -IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBFullscreen_IsFullscreen, - PP_Instance /* instance */, - PP_Bool /* result */) IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFullscreen_SetFullscreen, PP_Instance /* instance */, PP_Bool /* fullscreen */, diff --git a/ppapi/proxy/ppb_fullscreen_proxy.cc b/ppapi/proxy/ppb_fullscreen_proxy.cc index 12848bb..ac768d4 100644 --- a/ppapi/proxy/ppb_fullscreen_proxy.cc +++ b/ppapi/proxy/ppb_fullscreen_proxy.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// 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. @@ -17,11 +17,10 @@ PP_Bool IsFullscreen(PP_Instance instance) { PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); if (!dispatcher) return PP_FALSE; - - PP_Bool result = PP_FALSE; - dispatcher->Send(new PpapiHostMsg_PPBFullscreen_IsFullscreen( - INTERFACE_ID_PPB_FULLSCREEN, instance, &result)); - return result; + InstanceData* data = dispatcher->GetInstanceData(instance); + if (!data) + return PP_FALSE; + return data->fullscreen; } PP_Bool SetFullscreen(PP_Instance instance, PP_Bool fullscreen) { @@ -82,8 +81,6 @@ const InterfaceProxy::Info* PPB_Fullscreen_Proxy::GetInfo() { bool PPB_Fullscreen_Proxy::OnMessageReceived(const IPC::Message& msg) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPB_Fullscreen_Proxy, msg) - IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFullscreen_IsFullscreen, - OnMsgIsFullscreen) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFullscreen_SetFullscreen, OnMsgSetFullscreen) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFullscreen_GetScreenSize, @@ -94,11 +91,6 @@ bool PPB_Fullscreen_Proxy::OnMessageReceived(const IPC::Message& msg) { return handled; } -void PPB_Fullscreen_Proxy::OnMsgIsFullscreen(PP_Instance instance, - PP_Bool* result) { - *result = ppb_fullscreen_target()->IsFullscreen(instance); -} - void PPB_Fullscreen_Proxy::OnMsgSetFullscreen(PP_Instance instance, PP_Bool fullscreen, PP_Bool* result) { diff --git a/ppapi/proxy/ppb_fullscreen_proxy.h b/ppapi/proxy/ppb_fullscreen_proxy.h index 0efc189..4bb66f4 100644 --- a/ppapi/proxy/ppb_fullscreen_proxy.h +++ b/ppapi/proxy/ppb_fullscreen_proxy.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// 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. @@ -32,8 +32,6 @@ class PPB_Fullscreen_Proxy : public InterfaceProxy { private: // Message handlers. - void OnMsgIsFullscreen(PP_Instance instance, - PP_Bool* result); void OnMsgSetFullscreen(PP_Instance instance, PP_Bool fullscreen, PP_Bool* result); diff --git a/ppapi/proxy/ppp_instance_proxy.cc b/ppapi/proxy/ppp_instance_proxy.cc index 98e2615..1ccc673 100644 --- a/ppapi/proxy/ppp_instance_proxy.cc +++ b/ppapi/proxy/ppp_instance_proxy.cc @@ -6,6 +6,7 @@ #include <algorithm> +#include "ppapi/c/dev/ppb_fullscreen_dev.h" #include "ppapi/c/pp_var.h" #include "ppapi/c/ppb_core.h" #include "ppapi/c/ppp_instance.h" @@ -46,9 +47,16 @@ void DidDestroy(PP_Instance instance) { void DidChangeView(PP_Instance instance, const PP_Rect* position, const PP_Rect* clip) { - HostDispatcher::GetForInstance(instance)->Send( + HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); + const PPB_Fullscreen_Dev* fullscreen_interface = + static_cast<const PPB_Fullscreen_Dev*>( + dispatcher->GetLocalInterface(PPB_FULLSCREEN_DEV_INTERFACE)); + DCHECK(fullscreen_interface); + PP_Bool fullscreen = fullscreen_interface->IsFullscreen(instance); + dispatcher->Send( new PpapiMsg_PPPInstance_DidChangeView(INTERFACE_ID_PPP_INSTANCE, - instance, *position, *clip)); + instance, *position, *clip, + fullscreen)); } void DidChangeFocus(PP_Instance instance, PP_Bool has_focus) { @@ -211,7 +219,8 @@ void PPP_Instance_Proxy::OnMsgDidDestroy(PP_Instance instance) { void PPP_Instance_Proxy::OnMsgDidChangeView(PP_Instance instance, const PP_Rect& position, - const PP_Rect& clip) { + const PP_Rect& clip, + PP_Bool fullscreen) { PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); if (!dispatcher) return; @@ -219,6 +228,7 @@ void PPP_Instance_Proxy::OnMsgDidChangeView(PP_Instance instance, if (!data) return; data->position = position; + data->fullscreen = fullscreen; ppp_instance_target()->DidChangeView(instance, &position, &clip); } diff --git a/ppapi/proxy/ppp_instance_proxy.h b/ppapi/proxy/ppp_instance_proxy.h index 318f52f..7c208ca 100644 --- a/ppapi/proxy/ppp_instance_proxy.h +++ b/ppapi/proxy/ppp_instance_proxy.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// 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. @@ -46,7 +46,8 @@ class PPP_Instance_Proxy : public InterfaceProxy { void OnMsgDidDestroy(PP_Instance instance); void OnMsgDidChangeView(PP_Instance instance, const PP_Rect& position, - const PP_Rect& clip); + const PP_Rect& clip, + PP_Bool fullscreen); void OnMsgDidChangeFocus(PP_Instance instance, PP_Bool has_focus); void OnMsgHandleInputEvent(PP_Instance instance, const PP_InputEvent& event, |