Chromium Code Reviews| 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..9e9cce9ea44327065b34516e60bbfdf6302612a4 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" |
| @@ -127,7 +128,8 @@ BrowserPlugin::BrowserPlugin( |
| browser_plugin_manager_(render_view->browser_plugin_manager()), |
| current_nav_entry_index_(0), |
| nav_entry_count_(0), |
| - compositing_enabled_(false) { |
| + compositing_enabled_(false), |
| + compositing_helper_(0) { |
|
piman
2013/01/09 22:38:57
nit: we don't use 0 for NULL in chrome code. Becau
alexst (slow to review)
2013/01/09 23:16:05
Done.
|
| browser_plugin_manager()->AddBrowserPlugin(instance_id, this); |
| bindings_.reset(new BrowserPluginBindings(this)); |
| @@ -160,6 +162,7 @@ bool BrowserPlugin::OnMessageReceived(const IPC::Message& message) { |
| OnShouldAcceptTouchEvents) |
| IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetCursor, OnSetCursor) |
| IPC_MESSAGE_HANDLER(BrowserPluginMsg_UpdateRect, OnUpdateRect) |
| + IPC_MESSAGE_HANDLER(BrowserPluginMsg_BuffersSwapped, OnBuffersSwapped) |
|
Fady Samuel
2013/01/09 21:23:38
Please order alphabetically.
alexst (slow to review)
2013/01/09 21:43:39
Done.
|
| IPC_MESSAGE_UNHANDLED(handled = false) |
| IPC_END_MESSAGE_MAP() |
| return handled; |
| @@ -762,11 +765,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; |
| } |
| @@ -1045,4 +1053,19 @@ void BrowserPlugin::didFailLoadingFrameRequest( |
| const WebKit::WebURLError& error) { |
| } |
| +void BrowserPlugin::OnBuffersSwapped(int instance_id, |
|
Fady Samuel
2013/01/09 21:23:38
Please place this in alphabetical order.
alexst (slow to review)
2013/01/09 21:43:39
Done.
|
| + const gfx::Size& size, |
| + std::string mailbox_name, |
| + int gpu_route_id, |
| + int gpu_host_id) { |
| + DCHECK(instance_id == instance_id_); |
| + if (!compositing_enabled_) |
| + EnableCompositing(true); |
|
piman
2013/01/09 22:38:57
nit: You can skip the if since it's guarded agains
alexst (slow to review)
2013/01/09 23:16:05
Done.
|
| + |
| + compositing_helper_->OnBuffersSwapped(size, |
|
Fady Samuel
2013/01/09 21:23:38
I don't want to block this patch but I think we ca
alexst (slow to review)
2013/01/09 21:43:39
Sounds good.
|
| + mailbox_name, |
| + gpu_route_id, |
| + gpu_host_id); |
| +} |
| + |
| } // namespace content |