Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: content/renderer/browser_plugin/browser_plugin.cc

Issue 11824040: Enables compositing support for webview. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Comments Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/browser_plugin/browser_plugin.cc
diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc
index 75af8912790bcf84ebd5744dde7711472fb41a1a..9b38f17eb023aaeb61a84801da6ee78066714d36 100644
--- a/content/renderer/browser_plugin/browser_plugin.cc
+++ b/content/renderer/browser_plugin/browser_plugin.cc
@@ -14,6 +14,7 @@
#include "content/public/common/content_client.h"
#include "content/public/renderer/content_renderer_client.h"
#include "content/renderer/browser_plugin/browser_plugin_bindings.h"
+#include "content/renderer/browser_plugin/browser_plugin_compositing_helper.h"
#include "content/renderer/browser_plugin/browser_plugin_manager.h"
#include "content/renderer/render_process_impl.h"
#include "content/renderer/render_thread_impl.h"
@@ -146,6 +147,7 @@ bool BrowserPlugin::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(BrowserPlugin, message)
IPC_MESSAGE_HANDLER(BrowserPluginMsg_AdvanceFocus, OnAdvanceFocus)
+ IPC_MESSAGE_HANDLER(BrowserPluginMsg_BuffersSwapped, OnBuffersSwapped)
IPC_MESSAGE_HANDLER(BrowserPluginMsg_GuestContentWindowReady,
OnGuestContentWindowReady)
IPC_MESSAGE_HANDLER(BrowserPluginMsg_GuestGone, OnGuestGone)
@@ -295,6 +297,20 @@ void BrowserPlugin::OnAdvanceFocus(int instance_id, bool reverse) {
render_view_->GetWebView()->advanceFocus(reverse);
}
+void BrowserPlugin::OnBuffersSwapped(int instance_id,
+ const gfx::Size& size,
+ std::string mailbox_name,
+ int gpu_route_id,
+ int gpu_host_id) {
+ DCHECK(instance_id == instance_id_);
+ EnableCompositing(true);
+
+ compositing_helper_->OnBuffersSwapped(size,
+ mailbox_name,
+ gpu_route_id,
+ gpu_host_id);
+}
+
void BrowserPlugin::OnGuestContentWindowReady(int instance_id,
int content_window_routing_id) {
DCHECK(content_window_routing_id != MSG_ROUTING_NONE);
@@ -762,11 +778,16 @@ bool BrowserPlugin::initialize(WebPluginContainer* container) {
}
void BrowserPlugin::EnableCompositing(bool enable) {
- if (enable) {
- LOG(ERROR) << "BrowserPlugin compositing not yet implemented.";
+ if (compositing_enabled_ == enable)
return;
+
+ if (enable && !compositing_helper_) {
+ compositing_helper_.reset(new BrowserPluginCompositingHelper(
+ container_,
rjkroege 2013/01/10 17:03:21 should align with new?
alexst (slow to review) 2013/01/10 18:56:31 All the new statements in the function parameters
rjkroege 2013/01/10 19:03:53 sgtm.
+ render_view_routing_id_));
}
+ compositing_helper_->EnableCompositing(enable);
compositing_enabled_ = enable;
}
@@ -774,6 +795,7 @@ void BrowserPlugin::destroy() {
// The BrowserPlugin's WebPluginContainer is deleted immediately after this
// call returns, so let's not keep a reference to it around.
container_ = NULL;
+ compositing_helper_.reset();
MessageLoop::current()->DeleteSoon(FROM_HERE, this);
}

Powered by Google App Engine
This is Rietveld 408576698