Chromium Code Reviews| Index: content/browser/browser_plugin/old/browser_plugin_host_helper.cc |
| diff --git a/content/browser/browser_plugin/old/browser_plugin_host_helper.cc b/content/browser/browser_plugin/old/browser_plugin_host_helper.cc |
| index 794aed4f1625ef0891009426eca57ba254c33fb9..0272c99d9219e1f800b9ebea200b4892976779b4 100644 |
| --- a/content/browser/browser_plugin/old/browser_plugin_host_helper.cc |
| +++ b/content/browser/browser_plugin/old/browser_plugin_host_helper.cc |
| @@ -6,17 +6,69 @@ |
| #include "content/browser/browser_plugin/old/browser_plugin_host.h" |
| #include "content/common/browser_plugin_messages.h" |
| +#include "content/common/gpu/gpu_messages.h" |
| #include "content/public/browser/render_view_host.h" |
| #include "content/public/browser/render_widget_host_view.h" |
| #include "ui/gfx/size.h" |
| +#include "content/browser/renderer_host/render_widget_host_view_base.h" |
| +#include "content/browser/renderer_host/render_widget_host_impl.h" |
|
Fady Samuel
2012/07/06 15:14:44
Given you're now applying these changes to the new
|
| namespace content { |
| +class CrappyCompositingDelegate : public RenderWidgetHostViewBase::CompositingDelegate { |
|
Fady Samuel
2012/07/06 15:14:44
How about we simply call this BrowserPluginComposi
scshunt
2012/07/06 16:39:03
Probably a good plan.
|
| + public: |
| + virtual gfx::GLSurfaceHandle GetCompositingSurface() { |
| + gfx::GLSurfaceHandle handle = gfx::GLSurfaceHandle(gfx::kNullPluginWindow, true); |
| + handle.parent_gpu_process_id = helper_->surface_params_.gpu_process_id; |
| + handle.parent_client_id = helper_->surface_params_.client_id; |
| + handle.parent_context_id = helper_->surface_params_.context_id; |
| + handle.parent_texture_id[0] = helper_->surface_params_.texture_id[0]; |
| + handle.parent_texture_id[1] = helper_->surface_params_.texture_id[1]; |
| + handle.sync_point = helper_->surface_params_.sync_point; |
| + printf("CrappyCompositingDelegate is giving textures %u and %u\n", handle.parent_texture_id[0], handle.parent_texture_id[1]); |
| + return handle; |
| + } |
| + virtual bool ResizeNeedsNewSurface() { return false;} |
| + BrowserPluginHostHelper* helper_; |
| + CrappyCompositingDelegate(BrowserPluginHostHelper* helper) |
| + : helper_(helper) { |
| + } |
| + virtual void AcceleratedSurfaceBuffersSwapped( |
| + const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
| + int gpu_host_id) OVERRIDE { |
| + printf("CrappyCompositingDelegate is acknowledging a full swap\n"); |
| + RenderWidgetHostImpl::AcknowledgeBufferPresent(params.route_id, gpu_host_id, 0); |
| + } |
| + virtual void AcceleratedSurfacePostSubBuffer( |
| + const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, |
| + int gpu_host_id) OVERRIDE { |
| + printf("CrappyCompositingDelegate is acknowledging a partial swap\n"); |
| + RenderWidgetHostImpl::AcknowledgeBufferPresent(params.route_id, gpu_host_id, 0); |
| + } |
| + virtual void AcceleratedSurfaceNew( |
| + int32 width_in_pixel, int32 height_in_pixel, uint64* surface_handle, TransportDIB::Handle* shm_handle) { |
| + printf("CrappyCompositingDelegate is making a new surface\n"); |
| + } |
| + virtual void AcceleratedSurfaceRelease( |
| + uint64 surface_handle) { |
| + printf("CrappyCompositingDelegate is releasing a surface\n"); |
| + } |
| +}; |
| + |
| BrowserPluginHostHelper::BrowserPluginHostHelper( |
| BrowserPluginHost* browser_plugin_host, |
| - RenderViewHost* render_view_host) |
| + RenderViewHost* render_view_host, |
| + const BrowserPluginHostMsg_Surface_Params& params) |
| : RenderViewHostObserver(render_view_host), |
| - browser_plugin_host_(browser_plugin_host) { |
| + browser_plugin_host_(browser_plugin_host), |
| + surface_params_(params) { |
| + printf("Constructing helper..."); |
| + if (browser_plugin_host->embedder_render_process_host()) { |
| + printf(" in guest\n"); |
| + static_cast<RenderWidgetHostViewBase*>(render_view_host->GetView())->SetCompositingDelegate(scoped_ptr<RenderWidgetHostViewBase::CompositingDelegate>(new CrappyCompositingDelegate(this)).Pass()); |
| + } else { |
| + printf(" not in guest\n"); |
| + } |
| } |
| BrowserPluginHostHelper::~BrowserPluginHostHelper() { |
| @@ -46,12 +98,14 @@ void BrowserPluginHostHelper::OnConnectToChannel( |
| void BrowserPluginHostHelper::OnNavigateGuestFromEmbedder( |
| int32 instance_id, |
| long long frame_id, |
| - const std::string& src) { |
| + const std::string& src, |
| + const BrowserPluginHostMsg_Surface_Params& params) { |
| browser_plugin_host_->NavigateGuestFromEmbedder( |
| render_view_host(), |
| instance_id, |
| frame_id, |
| - src); |
| + src, |
| + params); |
| } |
| void BrowserPluginHostHelper::OnResizeGuest(int width, int height) { |