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

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: Fixed build error on mac and win, nits 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 cd6b6b04d7e1759ca4c6fcde1a463b86a56219bb..6794780e5da05e6b9182b467f7374767d0633b34 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"
@@ -152,6 +153,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)
@@ -318,6 +320,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);
@@ -797,11 +813,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_,
+ render_view_routing_id_));
}
+ compositing_helper_->EnableCompositing(enable);
compositing_enabled_ = enable;
}
@@ -809,6 +830,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);
}
« no previous file with comments | « content/renderer/browser_plugin/browser_plugin.h ('k') | content/renderer/browser_plugin/browser_plugin_compositing_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698