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

Side by Side Diff: content/browser/browser_plugin/old/browser_plugin_host_helper.cc

Issue 10735010: 3D Compositing in <browser>, first draft. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/browser_plugin/old/browser_plugin_host_helper.h" 5 #include "content/browser/browser_plugin/old/browser_plugin_host_helper.h"
6 6
7 #include "content/browser/browser_plugin/old/browser_plugin_host.h" 7 #include "content/browser/browser_plugin/old/browser_plugin_host.h"
8 #include "content/common/browser_plugin_messages.h" 8 #include "content/common/browser_plugin_messages.h"
9 #include "content/common/gpu/gpu_messages.h"
9 #include "content/public/browser/render_view_host.h" 10 #include "content/public/browser/render_view_host.h"
10 #include "content/public/browser/render_widget_host_view.h" 11 #include "content/public/browser/render_widget_host_view.h"
11 #include "ui/gfx/size.h" 12 #include "ui/gfx/size.h"
13 #include "content/browser/renderer_host/render_widget_host_view_base.h"
14 #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
12 15
13 namespace content { 16 namespace content {
14 17
18 class CrappyCompositingDelegate : public RenderWidgetHostViewBase::CompositingDe legate {
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.
19 public:
20 virtual gfx::GLSurfaceHandle GetCompositingSurface() {
21 gfx::GLSurfaceHandle handle = gfx::GLSurfaceHandle(gfx::kNullPluginWindow, t rue);
22 handle.parent_gpu_process_id = helper_->surface_params_.gpu_process_id;
23 handle.parent_client_id = helper_->surface_params_.client_id;
24 handle.parent_context_id = helper_->surface_params_.context_id;
25 handle.parent_texture_id[0] = helper_->surface_params_.texture_id[0];
26 handle.parent_texture_id[1] = helper_->surface_params_.texture_id[1];
27 handle.sync_point = helper_->surface_params_.sync_point;
28 printf("CrappyCompositingDelegate is giving textures %u and %u\n", handle.pa rent_texture_id[0], handle.parent_texture_id[1]);
29 return handle;
30 }
31 virtual bool ResizeNeedsNewSurface() { return false;}
32 BrowserPluginHostHelper* helper_;
33 CrappyCompositingDelegate(BrowserPluginHostHelper* helper)
34 : helper_(helper) {
35 }
36 virtual void AcceleratedSurfaceBuffersSwapped(
37 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
38 int gpu_host_id) OVERRIDE {
39 printf("CrappyCompositingDelegate is acknowledging a full swap\n");
40 RenderWidgetHostImpl::AcknowledgeBufferPresent(params.route_id, gpu_host_id, 0);
41 }
42 virtual void AcceleratedSurfacePostSubBuffer(
43 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
44 int gpu_host_id) OVERRIDE {
45 printf("CrappyCompositingDelegate is acknowledging a partial swap\n");
46 RenderWidgetHostImpl::AcknowledgeBufferPresent(params.route_id, gpu_host_id, 0);
47 }
48 virtual void AcceleratedSurfaceNew(
49 int32 width_in_pixel, int32 height_in_pixel, uint64* surface_handle, Trans portDIB::Handle* shm_handle) {
50 printf("CrappyCompositingDelegate is making a new surface\n");
51 }
52 virtual void AcceleratedSurfaceRelease(
53 uint64 surface_handle) {
54 printf("CrappyCompositingDelegate is releasing a surface\n");
55 }
56 };
57
15 BrowserPluginHostHelper::BrowserPluginHostHelper( 58 BrowserPluginHostHelper::BrowserPluginHostHelper(
16 BrowserPluginHost* browser_plugin_host, 59 BrowserPluginHost* browser_plugin_host,
17 RenderViewHost* render_view_host) 60 RenderViewHost* render_view_host,
61 const BrowserPluginHostMsg_Surface_Params& params)
18 : RenderViewHostObserver(render_view_host), 62 : RenderViewHostObserver(render_view_host),
19 browser_plugin_host_(browser_plugin_host) { 63 browser_plugin_host_(browser_plugin_host),
64 surface_params_(params) {
65 printf("Constructing helper...");
66 if (browser_plugin_host->embedder_render_process_host()) {
67 printf(" in guest\n");
68 static_cast<RenderWidgetHostViewBase*>(render_view_host->GetView())->SetComp ositingDelegate(scoped_ptr<RenderWidgetHostViewBase::CompositingDelegate>(new Cr appyCompositingDelegate(this)).Pass());
69 } else {
70 printf(" not in guest\n");
71 }
20 } 72 }
21 73
22 BrowserPluginHostHelper::~BrowserPluginHostHelper() { 74 BrowserPluginHostHelper::~BrowserPluginHostHelper() {
23 } 75 }
24 76
25 77
26 bool BrowserPluginHostHelper::OnMessageReceived(const IPC::Message& message) { 78 bool BrowserPluginHostHelper::OnMessageReceived(const IPC::Message& message) {
27 bool handled = true; 79 bool handled = true;
28 IPC_BEGIN_MESSAGE_MAP(BrowserPluginHostHelper, message) 80 IPC_BEGIN_MESSAGE_MAP(BrowserPluginHostHelper, message)
29 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ConnectToChannel, 81 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ConnectToChannel,
30 OnConnectToChannel) 82 OnConnectToChannel)
31 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_NavigateFromEmbedder, 83 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_NavigateFromEmbedder,
32 OnNavigateGuestFromEmbedder) 84 OnNavigateGuestFromEmbedder)
33 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ResizeGuest, OnResizeGuest) 85 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ResizeGuest, OnResizeGuest)
34 IPC_MESSAGE_UNHANDLED(handled = false) 86 IPC_MESSAGE_UNHANDLED(handled = false)
35 IPC_END_MESSAGE_MAP() 87 IPC_END_MESSAGE_MAP()
36 return handled; 88 return handled;
37 } 89 }
38 90
39 void BrowserPluginHostHelper::OnConnectToChannel( 91 void BrowserPluginHostHelper::OnConnectToChannel(
40 const IPC::ChannelHandle& channel_handle) { 92 const IPC::ChannelHandle& channel_handle) {
41 browser_plugin_host_->ConnectEmbedderToChannel( 93 browser_plugin_host_->ConnectEmbedderToChannel(
42 render_view_host(), 94 render_view_host(),
43 channel_handle); 95 channel_handle);
44 } 96 }
45 97
46 void BrowserPluginHostHelper::OnNavigateGuestFromEmbedder( 98 void BrowserPluginHostHelper::OnNavigateGuestFromEmbedder(
47 int32 instance_id, 99 int32 instance_id,
48 long long frame_id, 100 long long frame_id,
49 const std::string& src) { 101 const std::string& src,
102 const BrowserPluginHostMsg_Surface_Params& params) {
50 browser_plugin_host_->NavigateGuestFromEmbedder( 103 browser_plugin_host_->NavigateGuestFromEmbedder(
51 render_view_host(), 104 render_view_host(),
52 instance_id, 105 instance_id,
53 frame_id, 106 frame_id,
54 src); 107 src,
108 params);
55 } 109 }
56 110
57 void BrowserPluginHostHelper::OnResizeGuest(int width, int height) { 111 void BrowserPluginHostHelper::OnResizeGuest(int width, int height) {
58 render_view_host()->GetView()->SetSize(gfx::Size(width, height)); 112 render_view_host()->GetView()->SetSize(gfx::Size(width, height));
59 } 113 }
60 114
61 } // namespace content 115 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698