summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/browser/browser_plugin/browser_plugin_guest.cc24
-rw-r--r--content/browser/browser_plugin/browser_plugin_guest.h10
-rw-r--r--content/browser/browser_plugin/browser_plugin_guest_manager.cc37
-rw-r--r--content/browser/browser_plugin/browser_plugin_guest_manager.h7
-rw-r--r--content/browser/browser_plugin/browser_plugin_message_filter.cc23
-rw-r--r--content/browser/browser_plugin/browser_plugin_message_filter.h4
-rw-r--r--content/common/browser_plugin/browser_plugin_messages.h3
-rw-r--r--content/renderer/child_frame_compositing_helper.cc2
8 files changed, 39 insertions, 71 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc
index c5c6ce6..5f38cec 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -538,8 +538,6 @@ bool BrowserPluginGuest::OnMessageReceivedFromEmbedder(
const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(BrowserPluginGuest, message)
- IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_BuffersSwappedACK,
- OnSwapBuffersACK)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_CompositorFrameSwappedACK,
OnCompositorFrameSwappedACK)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_CopyFromCompositingSurfaceAck,
@@ -1184,24 +1182,9 @@ void BrowserPluginGuest::RenderProcessGone(base::TerminationStatus status) {
}
// static
-void BrowserPluginGuest::AcknowledgeBufferPresent(
- int route_id,
- int gpu_host_id,
- const gpu::Mailbox& mailbox,
- uint32 sync_point) {
- AcceleratedSurfaceMsg_BufferPresented_Params ack_params;
- ack_params.mailbox = mailbox;
- ack_params.sync_point = sync_point;
- RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id,
- gpu_host_id,
- ack_params);
-}
-
-// static
bool BrowserPluginGuest::ShouldForwardToBrowserPluginGuest(
const IPC::Message& message) {
switch (message.type()) {
- case BrowserPluginHostMsg_BuffersSwappedACK::ID:
case BrowserPluginHostMsg_CompositorFrameSwappedACK::ID:
case BrowserPluginHostMsg_CopyFromCompositingSurfaceAck::ID:
case BrowserPluginHostMsg_DragStatusUpdate::ID:
@@ -1639,13 +1622,6 @@ void BrowserPluginGuest::OnSetVisibility(int instance_id, bool visible) {
GetWebContents()->WasHidden();
}
-void BrowserPluginGuest::OnSwapBuffersACK(
- int instance_id,
- const FrameHostMsg_BuffersSwappedACK_Params& params) {
- AcknowledgeBufferPresent(params.gpu_route_id, params.gpu_host_id,
- params.mailbox, params.sync_point);
-}
-
void BrowserPluginGuest::OnUnlockMouse() {
SendMessageToEmbedder(
new BrowserPluginMsg_SetMouseLock(instance_id(), false));
diff --git a/content/browser/browser_plugin/browser_plugin_guest.h b/content/browser/browser_plugin/browser_plugin_guest.h
index 3aa61f9..e1da849 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.h
+++ b/content/browser/browser_plugin/browser_plugin_guest.h
@@ -297,13 +297,6 @@ class CONTENT_EXPORT BrowserPluginGuest
// Cancels pending geolocation request.
void CancelGeolocationRequest(int bridge_id);
- // Allow the embedder to call this for unhandled messages when
- // BrowserPluginGuest is already destroyed.
- static void AcknowledgeBufferPresent(int route_id,
- int gpu_host_id,
- const gpu::Mailbox& mailbox,
- uint32 sync_point);
-
// Returns whether BrowserPluginGuest is interested in receiving the given
// |message|.
static bool ShouldForwardToBrowserPluginGuest(const IPC::Message& message);
@@ -475,9 +468,6 @@ class CONTENT_EXPORT BrowserPluginGuest
// collection. See RenderThreadImpl::IdleHandler (executed when hidden) and
// RenderThreadImpl::IdleHandlerInForegroundTab (executed when visible).
void OnSetVisibility(int instance_id, bool visible);
- // Message from embedder acknowledging last HW buffer.
- void OnSwapBuffersACK(int instance_id,
- const FrameHostMsg_BuffersSwappedACK_Params& params);
void OnUnlockMouse();
void OnUnlockMouseAck(int instance_id);
void OnUpdateGeometry(int instance_id, const gfx::Rect& view_rect);
diff --git a/content/browser/browser_plugin/browser_plugin_guest_manager.cc b/content/browser/browser_plugin/browser_plugin_guest_manager.cc
index 4ef9e29..443e7c7 100644
--- a/content/browser/browser_plugin/browser_plugin_guest_manager.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest_manager.cc
@@ -142,21 +142,17 @@ bool BrowserPluginGuestManager::CanEmbedderAccessInstanceIDMaybeKill(
void BrowserPluginGuestManager::OnMessageReceived(const IPC::Message& message,
int render_process_id) {
- if (BrowserPluginGuest::ShouldForwardToBrowserPluginGuest(message)) {
- int instance_id = 0;
- // All allowed messages must have instance_id as their first parameter.
- PickleIterator iter(message);
- bool success = iter.ReadInt(&instance_id);
- DCHECK(success);
- BrowserPluginGuest* guest =
- GetGuestByInstanceID(instance_id, render_process_id);
- if (guest && guest->OnMessageReceivedFromEmbedder(message))
- return;
- }
- IPC_BEGIN_MESSAGE_MAP(BrowserPluginGuestManager, message)
- IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_BuffersSwappedACK,
- OnUnhandledSwapBuffersACK)
- IPC_END_MESSAGE_MAP()
+ DCHECK(BrowserPluginGuest::ShouldForwardToBrowserPluginGuest(message));
+ int instance_id = 0;
+ // All allowed messages must have instance_id as their first parameter.
+ PickleIterator iter(message);
+ bool success = iter.ReadInt(&instance_id);
+ DCHECK(success);
+ BrowserPluginGuest* guest =
+ GetGuestByInstanceID(instance_id, render_process_id);
+ if (!guest)
+ return;
+ guest->OnMessageReceivedFromEmbedder(message);
}
// static
@@ -214,17 +210,6 @@ SiteInstance* BrowserPluginGuestManager::GetGuestSiteInstance(
return NULL;
}
-// We only get here during teardown if we have one last buffer pending,
-// otherwise the ACK is handled by the guest.
-void BrowserPluginGuestManager::OnUnhandledSwapBuffersACK(
- int instance_id,
- const FrameHostMsg_BuffersSwappedACK_Params& params) {
- BrowserPluginGuest::AcknowledgeBufferPresent(params.gpu_route_id,
- params.gpu_host_id,
- params.mailbox,
- params.sync_point);
-}
-
bool BrowserPluginGuestManager::ForEachGuest(
WebContentsImpl* embedder_web_contents, const GuestCallback& callback) {
for (GuestInstanceMap::iterator it =
diff --git a/content/browser/browser_plugin/browser_plugin_guest_manager.h b/content/browser/browser_plugin/browser_plugin_guest_manager.h
index b1b6b09..10c6b24 100644
--- a/content/browser/browser_plugin/browser_plugin_guest_manager.h
+++ b/content/browser/browser_plugin/browser_plugin_guest_manager.h
@@ -17,7 +17,6 @@
struct BrowserPluginHostMsg_Attach_Params;
struct BrowserPluginHostMsg_ResizeGuest_Params;
-struct FrameHostMsg_BuffersSwappedACK_Params;
class GURL;
namespace gfx {
@@ -32,7 +31,6 @@ namespace content {
class BrowserPluginGuest;
class BrowserPluginHostFactory;
-class RenderProcessHostImpl;
class RenderWidgetHostImpl;
class SiteInstance;
class WebContents;
@@ -115,11 +113,6 @@ class CONTENT_EXPORT BrowserPluginGuestManager :
// given |guest_site|.
SiteInstance* GetGuestSiteInstance(const GURL& guest_site);
- // Message handlers.
- void OnUnhandledSwapBuffersACK(
- int instance_id,
- const FrameHostMsg_BuffersSwappedACK_Params& params);
-
// Static factory instance (always NULL outside of tests).
static BrowserPluginHostFactory* factory_;
diff --git a/content/browser/browser_plugin/browser_plugin_message_filter.cc b/content/browser/browser_plugin/browser_plugin_message_filter.cc
index b5ada72..512f8a7 100644
--- a/content/browser/browser_plugin/browser_plugin_message_filter.cc
+++ b/content/browser/browser_plugin/browser_plugin_message_filter.cc
@@ -7,9 +7,11 @@
#include "base/supports_user_data.h"
#include "content/browser/browser_plugin/browser_plugin_guest.h"
#include "content/browser/browser_plugin/browser_plugin_guest_manager.h"
+#include "content/browser/gpu/gpu_process_host.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/browser_plugin/browser_plugin_constants.h"
#include "content/common/browser_plugin/browser_plugin_messages.h"
+#include "content/common/gpu/gpu_messages.h"
#include "content/common/view_messages.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
@@ -43,7 +45,14 @@ bool BrowserPluginMessageFilter::OnMessageReceived(
// thread.
return true;
}
- return false;
+ bool handled = true;
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ IPC_BEGIN_MESSAGE_MAP(BrowserPluginMessageFilter, message)
+ IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_BuffersSwappedACK,
+ OnSwapBuffersACK)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+ return handled;
}
void BrowserPluginMessageFilter::OnDestruct() const {
@@ -70,4 +79,16 @@ BrowserPluginGuestManager*
browser_plugin::kBrowserPluginGuestManagerKeyName));
}
+void BrowserPluginMessageFilter::OnSwapBuffersACK(
+ const FrameHostMsg_BuffersSwappedACK_Params& params) {
+ GpuProcessHost* gpu_host = GpuProcessHost::FromID(params.gpu_host_id);
+ if (!gpu_host)
+ return;
+ AcceleratedSurfaceMsg_BufferPresented_Params ack_params;
+ ack_params.mailbox = params.mailbox;
+ ack_params.sync_point = params.sync_point;
+ gpu_host->Send(new AcceleratedSurfaceMsg_BufferPresented(params.gpu_route_id,
+ ack_params));
+}
+
} // namespace content
diff --git a/content/browser/browser_plugin/browser_plugin_message_filter.h b/content/browser/browser_plugin/browser_plugin_message_filter.h
index 829c1ba..778b3b4 100644
--- a/content/browser/browser_plugin/browser_plugin_message_filter.h
+++ b/content/browser/browser_plugin/browser_plugin_message_filter.h
@@ -7,6 +7,8 @@
#include "content/public/browser/browser_message_filter.h"
+struct FrameHostMsg_BuffersSwappedACK_Params;
+
namespace content {
class BrowserContext;
@@ -34,6 +36,8 @@ class BrowserPluginMessageFilter : public BrowserMessageFilter {
BrowserPluginGuestManager* GetBrowserPluginGuestManager();
+ void OnSwapBuffersACK(const FrameHostMsg_BuffersSwappedACK_Params& params);
+
int render_process_id_;
int is_guest_;
diff --git a/content/common/browser_plugin/browser_plugin_messages.h b/content/common/browser_plugin/browser_plugin_messages.h
index bd6f38b..50f1504 100644
--- a/content/common/browser_plugin/browser_plugin_messages.h
+++ b/content/common/browser_plugin/browser_plugin_messages.h
@@ -366,8 +366,7 @@ IPC_MESSAGE_CONTROL2(BrowserPluginMsg_SetMouseLock,
// See comment about BrowserPluginMsg_BuffersSwapped and
// BrowserPluginMsg_CompositorFrameSwapped for how these related
// to the FrameHostMsg variants.
-IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_BuffersSwappedACK,
- int /* instance_id */,
+IPC_MESSAGE_ROUTED1(BrowserPluginHostMsg_BuffersSwappedACK,
FrameHostMsg_BuffersSwappedACK_Params /* params */)
// Acknowledge that we presented an ubercomp frame.
diff --git a/content/renderer/child_frame_compositing_helper.cc b/content/renderer/child_frame_compositing_helper.cc
index 10da97d..0a651db5 100644
--- a/content/renderer/child_frame_compositing_helper.cc
+++ b/content/renderer/child_frame_compositing_helper.cc
@@ -114,7 +114,7 @@ void ChildFrameCompositingHelper::SendBuffersSwappedACKToBrowser(
// BrowserPlugin is modified to use a RenderFrame.
if (GetBrowserPluginManager()) {
GetBrowserPluginManager()->Send(new BrowserPluginHostMsg_BuffersSwappedACK(
- host_routing_id_, GetInstanceID(), params));
+ host_routing_id_, params));
} else if (render_frame_) {
render_frame_->Send(
new FrameHostMsg_BuffersSwappedACK(host_routing_id_, params));