diff options
38 files changed, 127 insertions, 87 deletions
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index 575a6e7..534bf06 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -197,7 +197,7 @@ bool ExtensionHost::IsRenderViewLive() const { } void ExtensionHost::CreateRenderViewSoon(RenderWidgetHostView* host_view) { - render_view_host_->set_view(host_view); + render_view_host_->SetView(host_view); if (render_view_host_->process()->HasConnection()) { // If the process is already started, go ahead and initialize the RenderView // synchronously. The process creation is the real meaty part that we want diff --git a/chrome/browser/notifications/balloon_host.cc b/chrome/browser/notifications/balloon_host.cc index ead868a..f571012 100644 --- a/chrome/browser/notifications/balloon_host.cc +++ b/chrome/browser/notifications/balloon_host.cc @@ -196,7 +196,7 @@ void BalloonHost::Init() { InitRenderWidgetHostView(); DCHECK(render_widget_host_view()); - rvh->set_view(render_widget_host_view()); + rvh->SetView(render_widget_host_view()); rvh->CreateRenderView(string16()); rvh->NavigateToURL(balloon_->notification().content_url()); diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc index 98a2def..5098093 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc @@ -516,7 +516,7 @@ RenderWidgetHostViewGtk::RenderWidgetHostViewGtk(RenderWidgetHost* widget_host) dragged_at_vertical_edge_(0), compositing_surface_(gfx::kNullPluginWindow), last_mouse_down_(NULL) { - host_->set_view(this); + host_->SetView(this); } RenderWidgetHostViewGtk::~RenderWidgetHostViewGtk() { diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.mm b/chrome/browser/renderer_host/render_widget_host_view_mac.mm index 64aa8c0..d7d19cf 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm +++ b/chrome/browser/renderer_host/render_widget_host_view_mac.mm @@ -246,7 +246,7 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget) // hierarchy right after calling us. cocoa_view_ = [[[RenderWidgetHostViewCocoa alloc] initWithRenderWidgetHostViewMac:this] autorelease]; - render_widget_host_->set_view(this); + render_widget_host_->SetView(this); if (render_widget_host_->IsRenderView()) { new SpellCheckRenderViewObserver( diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac_unittest.mm b/chrome/browser/renderer_host/render_widget_host_view_mac_unittest.mm index c7815c2..cdc285c 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_mac_unittest.mm +++ b/chrome/browser/renderer_host/render_widget_host_view_mac_unittest.mm @@ -30,7 +30,7 @@ class RenderWidgetHostViewMacTest : public RenderViewHostTestHarness { } virtual void TearDown() { // See comment in SetUp(). - rvh()->set_view(old_rwhv_); + rvh()->SetView(old_rwhv_); // Make sure the rwhv_mac_ is gone once the superclass's |TearDown()| runs. rwhv_cocoa_.reset(); diff --git a/chrome/browser/renderer_host/render_widget_host_view_views.cc b/chrome/browser/renderer_host/render_widget_host_view_views.cc index 658ab9c..d58f8f8 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_views.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_views.cc @@ -87,7 +87,7 @@ RenderWidgetHostViewViews::RenderWidgetHostViewViews(RenderWidgetHost* host) text_input_type_(ui::TEXT_INPUT_TYPE_NONE), has_composition_text_(false) { set_focusable(true); - host_->set_view(this); + host_->SetView(this); } RenderWidgetHostViewViews::~RenderWidgetHostViewViews() { diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc index fdb5d85..4bdae5d 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc @@ -241,7 +241,7 @@ RenderWidgetHostViewWin::RenderWidgetHostViewWin(RenderWidgetHost* widget) is_loading_(false), overlay_color_(0), text_input_type_(ui::TEXT_INPUT_TYPE_NONE) { - render_widget_host_->set_view(this); + render_widget_host_->SetView(this); registrar_.Add(this, NotificationType::RENDERER_PROCESS_TERMINATED, NotificationService::AllSources()); diff --git a/chrome/browser/tab_contents/thumbnail_generator_unittest.cc b/chrome/browser/tab_contents/thumbnail_generator_unittest.cc index bc356cd..774a77a 100644 --- a/chrome/browser/tab_contents/thumbnail_generator_unittest.cc +++ b/chrome/browser/tab_contents/thumbnail_generator_unittest.cc @@ -62,7 +62,7 @@ class ThumbnailGeneratorTest : public testing::Test { view_.reset(new TestRenderWidgetHostViewWithBackingStoreSkia( widget_.get())); // Paiting will be skipped if there's no view. - widget_->set_view(view_.get()); + widget_->SetView(view_.get()); // Need to send out a create notification for the RWH to get hooked. This is // a little scary in that we don't have a RenderView, but the only listener diff --git a/chrome/test/render_view_test.cc b/chrome/test/render_view_test.cc index 78004b9..47f3995 100644 --- a/chrome/test/render_view_test.cc +++ b/chrome/test/render_view_test.cc @@ -125,7 +125,6 @@ void RenderViewTest::SetUp() { // This needs to pass the mock render thread to the view. view_ = RenderView::Create(&render_thread_, 0, - gfx::kNullPluginWindow, kOpenerId, RendererPreferences(), WebPreferences(), diff --git a/content/browser/renderer_host/browser_render_process_host.cc b/content/browser/renderer_host/browser_render_process_host.cc index 1c2d42d..0ced958 100644 --- a/content/browser/renderer_host/browser_render_process_host.cc +++ b/content/browser/renderer_host/browser_render_process_host.cc @@ -364,7 +364,7 @@ void BrowserRenderProcessHost::CreateMessageFilters() { channel_->AddFilter( GeolocationDispatcherHost::New( id(), profile()->GetGeolocationPermissionContext())); - channel_->AddFilter(new GpuMessageFilter(id())); + channel_->AddFilter(new GpuMessageFilter(id(), widget_helper_.get())); channel_->AddFilter(new PepperFileMessageFilter(id(), profile())); channel_->AddFilter( new PepperMessageFilter(&profile()->GetResourceContext())); @@ -715,6 +715,12 @@ void BrowserRenderProcessHost::ClearTransportDIBCache() { cached_dibs_.clear(); } +void BrowserRenderProcessHost::SetCompositingSurface( + int render_widget_id, + gfx::PluginWindowHandle compositing_surface) { + widget_helper_->SetCompositingSurface(render_widget_id, compositing_surface); +} + bool BrowserRenderProcessHost::Send(IPC::Message* msg) { if (!channel_.get()) { if (!is_initialized_) { diff --git a/content/browser/renderer_host/browser_render_process_host.h b/content/browser/renderer_host/browser_render_process_host.h index c41c489..880809d 100644 --- a/content/browser/renderer_host/browser_render_process_host.h +++ b/content/browser/renderer_host/browser_render_process_host.h @@ -61,6 +61,9 @@ class BrowserRenderProcessHost : public RenderProcessHost, virtual bool FastShutdownIfPossible(); virtual base::ProcessHandle GetHandle(); virtual TransportDIB* GetTransportDIB(TransportDIB::Id dib_id); + virtual void SetCompositingSurface( + int render_widget_id, + gfx::PluginWindowHandle compositing_surface); // IPC::Channel::Sender via RenderProcessHost. virtual bool Send(IPC::Message* msg); diff --git a/content/browser/renderer_host/gpu_message_filter.cc b/content/browser/renderer_host/gpu_message_filter.cc index ce028b6..600de33 100644 --- a/content/browser/renderer_host/gpu_message_filter.cc +++ b/content/browser/renderer_host/gpu_message_filter.cc @@ -10,11 +10,14 @@ #include "base/callback.h" #include "content/browser/gpu/gpu_process_host.h" +#include "content/browser/renderer_host/render_widget_helper.h" #include "content/common/gpu/gpu_messages.h" -GpuMessageFilter::GpuMessageFilter(int render_process_id) +GpuMessageFilter::GpuMessageFilter(int render_process_id, + RenderWidgetHelper* render_widget_helper) : gpu_host_id_(0), - render_process_id_(render_process_id) { + render_process_id_(render_process_id), + render_widget_helper_(render_widget_helper) { } // WeakPtrs to a GpuMessageFilter need to be Invalidated from @@ -153,12 +156,15 @@ void GpuMessageFilter::OnEstablishGpuChannel( } void GpuMessageFilter::OnCreateViewCommandBuffer( - gfx::PluginWindowHandle compositing_surface, int32 render_view_id, const GPUCreateCommandBufferConfig& init_params, IPC::Message* reply) { GpuProcessHost* host = GpuProcessHost::FromID(gpu_host_id_); - if (!host) { + + gfx::PluginWindowHandle compositing_surface = + render_widget_helper_->LookupCompositingSurface(render_view_id); + + if (!host || compositing_surface == gfx::kNullPluginWindow) { // TODO(apatrick): Eventually, this IPC message will be routed to a // GpuProcessStub with a particular routing ID. The error will be set if // the GpuProcessStub with that routing ID is not in the MessageRouter. diff --git a/content/browser/renderer_host/gpu_message_filter.h b/content/browser/renderer_host/gpu_message_filter.h index 7246f5a..d4e3651 100644 --- a/content/browser/renderer_host/gpu_message_filter.h +++ b/content/browser/renderer_host/gpu_message_filter.h @@ -6,6 +6,7 @@ #define CONTENT_BROWSER_RENDERER_HOST_GPU_MESSAGE_FILTER_H_ #pragma once +#include "base/memory/ref_counted.h" #include "content/browser/browser_message_filter.h" #include "content/common/gpu/gpu_process_launch_causes.h" #include "ui/gfx/native_widget_types.h" @@ -14,6 +15,7 @@ class GpuProcessHost; class GpuProcessHostUIShim; struct GPUCreateCommandBufferConfig; struct GPUInfo; +class RenderWidgetHelper; namespace IPC { struct ChannelHandle; @@ -25,7 +27,8 @@ struct ChannelHandle; class GpuMessageFilter : public BrowserMessageFilter, public base::SupportsWeakPtr<GpuMessageFilter> { public: - explicit GpuMessageFilter(int render_process_id); + GpuMessageFilter(int render_process_id, + RenderWidgetHelper* render_widget_helper); // BrowserMessageFilter methods: virtual bool OnMessageReceived(const IPC::Message& message, @@ -41,7 +44,6 @@ class GpuMessageFilter : public BrowserMessageFilter, void OnEstablishGpuChannel(content::CauseForGpuLaunch, IPC::Message* reply); void OnCreateViewCommandBuffer( - gfx::PluginWindowHandle compositing_surface, int32 render_view_id, const GPUCreateCommandBufferConfig& init_params, IPC::Message* reply); @@ -49,6 +51,8 @@ class GpuMessageFilter : public BrowserMessageFilter, int gpu_host_id_; int render_process_id_; + scoped_refptr<RenderWidgetHelper> render_widget_helper_; + DISALLOW_COPY_AND_ASSIGN(GpuMessageFilter); }; diff --git a/content/browser/renderer_host/mock_render_process_host.cc b/content/browser/renderer_host/mock_render_process_host.cc index 2cbfd89..4b27ce3 100644 --- a/content/browser/renderer_host/mock_render_process_host.cc +++ b/content/browser/renderer_host/mock_render_process_host.cc @@ -103,6 +103,11 @@ TransportDIB* MockRenderProcessHost::GetTransportDIB(TransportDIB::Id dib_id) { return transport_dib_; } +void MockRenderProcessHost::SetCompositingSurface( + int render_widget_id, + gfx::PluginWindowHandle compositing_surface) { +} + bool MockRenderProcessHost::OnMessageReceived(const IPC::Message& msg) { return false; } diff --git a/content/browser/renderer_host/mock_render_process_host.h b/content/browser/renderer_host/mock_render_process_host.h index e4ae3db..a785129 100644 --- a/content/browser/renderer_host/mock_render_process_host.h +++ b/content/browser/renderer_host/mock_render_process_host.h @@ -52,6 +52,9 @@ class MockRenderProcessHost : public RenderProcessHost { virtual bool FastShutdownIfPossible(); virtual base::ProcessHandle GetHandle(); virtual TransportDIB* GetTransportDIB(TransportDIB::Id dib_id); + virtual void SetCompositingSurface( + int render_widget_id, + gfx::PluginWindowHandle compositing_surface); // IPC::Channel::Sender via RenderProcessHost. virtual bool Send(IPC::Message* msg); diff --git a/content/browser/renderer_host/render_process_host.h b/content/browser/renderer_host/render_process_host.h index c5b45e0..5035cd4 100644 --- a/content/browser/renderer_host/render_process_host.h +++ b/content/browser/renderer_host/render_process_host.h @@ -14,6 +14,7 @@ #include "base/process_util.h" #include "base/time.h" #include "ipc/ipc_channel_proxy.h" +#include "ui/gfx/native_widget_types.h" #include "ui/gfx/surface/transport_dib.h" class Profile; @@ -226,6 +227,14 @@ class RenderProcessHost : public IPC::Channel::Sender, // still owns the returned DIB. virtual TransportDIB* GetTransportDIB(TransportDIB::Id dib_id) = 0; + // RenderWidgetHost / compositing surface mapping functions ------------------ + + // Set a mapping from a RenderWidgetHost to a compositing surface. Pass a null + // handle to remove the mapping. + virtual void SetCompositingSurface( + int render_widget_id, + gfx::PluginWindowHandle compositing_surface) = 0; + // Static management functions ----------------------------------------------- // Flag to run the renderer in process. This is primarily diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc index 59d65e2..5030cc6 100644 --- a/content/browser/renderer_host/render_view_host.cc +++ b/content/browser/renderer_host/render_view_host.cc @@ -161,9 +161,11 @@ bool RenderViewHost::CreateRenderView(const string16& frame_name) { renderer_initialized_ = true; + process()->SetCompositingSurface(routing_id(), + GetCompositingSurface()); + ViewMsg_New_Params params; params.parent_window = GetNativeViewId(); - params.compositing_surface = GetCompositingSurface(); params.renderer_preferences = delegate_->GetRendererPrefs(process()->profile()); params.web_preferences = delegate_->GetWebkitPrefs(); diff --git a/content/browser/renderer_host/render_widget_helper.cc b/content/browser/renderer_host/render_widget_helper.cc index f297110..cbfa094 100644 --- a/content/browser/renderer_host/render_widget_helper.cc +++ b/content/browser/renderer_host/render_widget_helper.cc @@ -333,3 +333,24 @@ void RenderWidgetHelper::ClearAllocatedDIBs() { allocated_dibs_.clear(); } #endif + +void RenderWidgetHelper::SetCompositingSurface( + int render_widget_id, + gfx::PluginWindowHandle compositing_surface) { + base::AutoLock locked(view_compositing_surface_map_lock_); + if (compositing_surface != gfx::kNullPluginWindow) + view_compositing_surface_map_[render_widget_id] = compositing_surface; + else + view_compositing_surface_map_.erase(render_widget_id); +} + +gfx::PluginWindowHandle RenderWidgetHelper::LookupCompositingSurface( + int render_widget_id) { + base::AutoLock locked(view_compositing_surface_map_lock_); + ViewCompositingSurfaceMap::iterator it = + view_compositing_surface_map_.find(render_widget_id); + if (it == view_compositing_surface_map_.end()) + return gfx::kNullPluginWindow; + + return it->second; +} diff --git a/content/browser/renderer_host/render_widget_helper.h b/content/browser/renderer_host/render_widget_helper.h index 0c7f695..cab0947 100644 --- a/content/browser/renderer_host/render_widget_helper.h +++ b/content/browser/renderer_host/render_widget_helper.h @@ -16,6 +16,7 @@ #include "base/synchronization/waitable_event.h" #include "content/common/window_container_type.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" +#include "ui/gfx/native_widget_types.h" #include "ui/gfx/surface/transport_dib.h" namespace IPC { @@ -117,6 +118,10 @@ class RenderWidgetHelper TransportDIB* MapTransportDIB(TransportDIB::Id dib_id); #endif + // Set a mapping from a RenderWidgetHost to a compositing surface. Pass a null + // handle to remove the mapping. + void SetCompositingSurface(int render_widget_id, + gfx::PluginWindowHandle compositing_surface); // IO THREAD ONLY ----------------------------------------------------------- @@ -145,6 +150,9 @@ class RenderWidgetHelper void FreeTransportDIB(TransportDIB::Id dib_id); #endif + // Lookup the compositing surface corresponding to a widget ID. + gfx::PluginWindowHandle LookupCompositingSurface(int render_widget_id); + private: // A class used to proxy a paint message. PaintMsgProxy objects are created // on the IO thread and destroyed on the UI thread. @@ -200,6 +208,11 @@ class RenderWidgetHelper UpdateMsgProxyMap pending_paints_; base::Lock pending_paints_lock_; + // Maps from view ID to compositing surface. + typedef std::map<int, gfx::PluginWindowHandle> ViewCompositingSurfaceMap; + ViewCompositingSurfaceMap view_compositing_surface_map_; + base::Lock view_compositing_surface_map_lock_; + int render_process_id_; // Event used to implement WaitForUpdateMsg. diff --git a/content/browser/renderer_host/render_widget_host.cc b/content/browser/renderer_host/render_widget_host.cc index b962f6e..4e01606 100644 --- a/content/browser/renderer_host/render_widget_host.cc +++ b/content/browser/renderer_host/render_widget_host.cc @@ -98,12 +98,21 @@ RenderWidgetHost::RenderWidgetHost(RenderProcessHost* process, } RenderWidgetHost::~RenderWidgetHost() { + SetView(NULL); + // Clear our current or cached backing store if either remains. BackingStoreManager::RemoveBackingStore(this); process_->Release(routing_id_); } +void RenderWidgetHost::SetView(RenderWidgetHostView* view) { + view_ = view; + + if (!view_) + process_->SetCompositingSurface(routing_id_, gfx::kNullPluginWindow); +} + gfx::NativeViewId RenderWidgetHost::GetNativeViewId() { if (view_) return gfx::IdFromNativeView(view_->GetNativeView()); @@ -127,9 +136,11 @@ void RenderWidgetHost::Init() { renderer_initialized_ = true; + process_->SetCompositingSurface(routing_id_, + GetCompositingSurface()); + // Send the ack along with the information on placement. - Send(new ViewMsg_CreatingNew_ACK( - routing_id_, GetNativeViewId(), GetCompositingSurface())); + Send(new ViewMsg_CreatingNew_ACK(routing_id_, GetNativeViewId())); WasResized(); } @@ -363,7 +374,7 @@ void RenderWidgetHost::LostCapture() { void RenderWidgetHost::ViewDestroyed() { // TODO(evanm): tracking this may no longer be necessary; // eliminate this function if so. - view_ = NULL; + SetView(NULL); } void RenderWidgetHost::SetIsLoading(bool is_loading) { diff --git a/content/browser/renderer_host/render_widget_host.h b/content/browser/renderer_host/render_widget_host.h index 80f1bc4b..947ef2b 100644 --- a/content/browser/renderer_host/render_widget_host.h +++ b/content/browser/renderer_host/render_widget_host.h @@ -144,7 +144,7 @@ class RenderWidgetHost : public IPC::Channel::Listener, // RenderWidget is being destroyed or the render process crashed. You should // never cache this pointer since it can become NULL if the renderer crashes, // instead you should always ask for it using the accessor. - void set_view(RenderWidgetHostView* view) { view_ = view; } + void SetView(RenderWidgetHostView* view); RenderWidgetHostView* view() const { return view_; } RenderProcessHost* process() const { return process_; } diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc index 0018fe5..17c8108 100644 --- a/content/browser/renderer_host/render_widget_host_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_unittest.cc @@ -260,7 +260,7 @@ class RenderWidgetHostTest : public testing::Test { process_ = new RenderWidgetHostProcess(profile_.get()); host_.reset(new MockRenderWidgetHost(process_, 1)); view_.reset(new TestView(host_.get())); - host_->set_view(view_.get()); + host_->SetView(view_.get()); host_->Init(); } void TearDown() { @@ -416,13 +416,13 @@ TEST_F(RenderWidgetHostTest, ResizeThenCrash) { // Simulate a renderer crash before the update message. Ensure all the // resize ack logic is cleared. Must clear the view first so it doesn't get // deleted. - host_->set_view(NULL); + host_->SetView(NULL); host_->RendererExited(base::TERMINATION_STATUS_PROCESS_CRASHED, -1); EXPECT_FALSE(host_->resize_ack_pending_); EXPECT_EQ(gfx::Size(), host_->in_flight_size_); // Reset the view so we can exit the test cleanly. - host_->set_view(view_.get()); + host_->SetView(view_.get()); } // Tests setting custom background @@ -430,7 +430,7 @@ TEST_F(RenderWidgetHostTest, Background) { #if !defined(OS_MACOSX) scoped_ptr<RenderWidgetHostView> view( RenderWidgetHostView::CreateViewForWidget(host_.get())); - host_->set_view(view.get()); + host_->SetView(view.get()); // Create a checkerboard background to test with. gfx::CanvasSkia canvas(4, 4, true); diff --git a/content/browser/renderer_host/test_render_view_host.cc b/content/browser/renderer_host/test_render_view_host.cc index 6a6b512..00b29ac 100644 --- a/content/browser/renderer_host/test_render_view_host.cc +++ b/content/browser/renderer_host/test_render_view_host.cc @@ -51,7 +51,7 @@ TestRenderViewHost::TestRenderViewHost(SiteInstance* instance, // For normal RenderViewHosts, this is freed when |Shutdown()| is called. // For TestRenderViewHost, the view is explicitly deleted in the destructor // below, because TestRenderWidgetHostView::Destroy() doesn't |delete this|. - set_view(new TestRenderWidgetHostView(this)); + SetView(new TestRenderWidgetHostView(this)); } TestRenderViewHost::~TestRenderViewHost() { diff --git a/content/browser/tab_contents/interstitial_page.cc b/content/browser/tab_contents/interstitial_page.cc index 85edfb9..07c661b 100644 --- a/content/browser/tab_contents/interstitial_page.cc +++ b/content/browser/tab_contents/interstitial_page.cc @@ -426,7 +426,7 @@ TabContentsView* InterstitialPage::CreateTabContentsView() { TabContentsView* tab_contents_view = tab()->view(); RenderWidgetHostView* view = tab_contents_view->CreateViewForWidget(render_view_host_); - render_view_host_->set_view(view); + render_view_host_->SetView(view); render_view_host_->AllowBindings(BindingsPolicy::DOM_AUTOMATION); render_view_host_->CreateRenderView(string16()); diff --git a/content/browser/tab_contents/render_view_host_manager.cc b/content/browser/tab_contents/render_view_host_manager.cc index 48133e4..1a49d4d 100644 --- a/content/browser/tab_contents/render_view_host_manager.cc +++ b/content/browser/tab_contents/render_view_host_manager.cc @@ -814,7 +814,7 @@ void RenderViewHostManager::SwapInRenderViewHost(RenderViewHost* rvh) { // Remove old RenderWidgetHostView with mocked out methods so it can be // replaced with a new one that's a child of |delegate_|'s view. scoped_ptr<RenderWidgetHostView> old_view(render_view_host_->view()); - render_view_host_->set_view(NULL); + render_view_host_->SetView(NULL); delegate_->CreateViewAndSetSizeForRVH(render_view_host_); render_view_host_->ActivateDeferredPluginHandles(); // If the view is gone, then this RenderViewHost died while it was hidden. diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h index eb6d6da..f06f927 100644 --- a/content/common/gpu/gpu_messages.h +++ b/content/common/gpu/gpu_messages.h @@ -208,8 +208,7 @@ IPC_SYNC_MESSAGE_CONTROL1_3(GpuHostMsg_EstablishGpuChannel, // A renderer sends this to the browser process when it wants to // create a GL context associated with the given view_id. -IPC_SYNC_MESSAGE_CONTROL3_1(GpuHostMsg_CreateViewCommandBuffer, - gfx::PluginWindowHandle, /* view */ +IPC_SYNC_MESSAGE_CONTROL2_1(GpuHostMsg_CreateViewCommandBuffer, int32, /* render_view_id */ GPUCreateCommandBufferConfig, /* init_params */ int32 /* route_id */) diff --git a/content/common/view_messages.h b/content/common/view_messages.h index 911cd87..76e5ce3 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -703,9 +703,6 @@ IPC_STRUCT_BEGIN(ViewMsg_New_Params) // The parent window's id. IPC_STRUCT_MEMBER(gfx::NativeViewId, parent_window) - // Surface for accelerated rendering. - IPC_STRUCT_MEMBER(gfx::PluginWindowHandle, compositing_surface) - // Renderer-wide preferences. IPC_STRUCT_MEMBER(RendererPreferences, renderer_preferences) @@ -753,9 +750,8 @@ IPC_MESSAGE_CONTROL1(ViewMsg_New, // Reply in response to ViewHostMsg_ShowView or ViewHostMsg_ShowWidget. // similar to the new command, but used when the renderer created a view // first, and we need to update it. -IPC_MESSAGE_ROUTED2(ViewMsg_CreatingNew_ACK, - gfx::NativeViewId /* parent_hwnd */, - gfx::PluginWindowHandle /* compositing_surface */) +IPC_MESSAGE_ROUTED1(ViewMsg_CreatingNew_ACK, + gfx::NativeViewId /* parent_hwnd */) // Sends updated preferences to the renderer. IPC_MESSAGE_ROUTED1(ViewMsg_SetRendererPrefs, diff --git a/content/renderer/gpu/gpu_channel_host.cc b/content/renderer/gpu/gpu_channel_host.cc index 90d5b73..eeb7d62 100644 --- a/content/renderer/gpu/gpu_channel_host.cc +++ b/content/renderer/gpu/gpu_channel_host.cc @@ -105,7 +105,6 @@ bool GpuChannelHost::Send(IPC::Message* message) { } CommandBufferProxy* GpuChannelHost::CreateViewCommandBuffer( - gfx::PluginWindowHandle compositing_surface, int render_view_id, const std::string& allowed_extensions, const std::vector<int32>& attribs, @@ -122,7 +121,7 @@ CommandBufferProxy* GpuChannelHost::CreateViewCommandBuffer( int32 route_id; if (!RenderThread::current()->Send( new GpuHostMsg_CreateViewCommandBuffer( - compositing_surface, render_view_id, init_params, &route_id))) { + render_view_id, init_params, &route_id))) { return NULL; } diff --git a/content/renderer/gpu/gpu_channel_host.h b/content/renderer/gpu/gpu_channel_host.h index affd128..c193f39 100644 --- a/content/renderer/gpu/gpu_channel_host.h +++ b/content/renderer/gpu/gpu_channel_host.h @@ -68,7 +68,6 @@ class GpuChannelHost : public IPC::Channel::Listener, // Create and connect to a command buffer in the GPU process. CommandBufferProxy* CreateViewCommandBuffer( - gfx::PluginWindowHandle compositing_surface, int render_view_id, const std::string& allowed_extensions, const std::vector<int32>& attribs, diff --git a/content/renderer/gpu/renderer_gl_context.cc b/content/renderer/gpu/renderer_gl_context.cc index bbdf8c0..b245716 100644 --- a/content/renderer/gpu/renderer_gl_context.cc +++ b/content/renderer/gpu/renderer_gl_context.cc @@ -155,7 +155,6 @@ RendererGLContext::~RendererGLContext() { RendererGLContext* RendererGLContext::CreateViewContext( GpuChannelHost* channel, - gfx::PluginWindowHandle render_surface, int render_view_id, const char* allowed_extensions, const int32* attrib_list, @@ -164,7 +163,6 @@ RendererGLContext* RendererGLContext::CreateViewContext( scoped_ptr<RendererGLContext> context(new RendererGLContext(channel)); if (!context->Initialize( true, - render_surface, render_view_id, gfx::Size(), allowed_extensions, @@ -196,7 +194,6 @@ RendererGLContext* RendererGLContext::CreateOffscreenContext( scoped_ptr<RendererGLContext> context(new RendererGLContext(channel)); if (!context->Initialize( false, - gfx::kNullPluginWindow, 0, size, allowed_extensions, @@ -397,7 +394,6 @@ RendererGLContext::RendererGLContext(GpuChannelHost* channel) } bool RendererGLContext::Initialize(bool onscreen, - gfx::PluginWindowHandle render_surface, int render_view_id, const gfx::Size& size, const char* allowed_extensions, @@ -443,19 +439,13 @@ bool RendererGLContext::Initialize(bool onscreen, // Create a proxy to a command buffer in the GPU process. if (onscreen) { - if (render_surface == gfx::kNullPluginWindow) { - LOG(ERROR) << "Invalid surface handle for onscreen context."; - command_buffer_ = NULL; - } else { - TRACE_EVENT0("gpu", - "RendererGLContext::Initialize::CreateViewCommandBuffer"); - command_buffer_ = channel_->CreateViewCommandBuffer( - render_surface, - render_view_id, - allowed_extensions, - attribs, - active_url); - } + TRACE_EVENT0("gpu", + "RendererGLContext::Initialize::CreateViewCommandBuffer"); + command_buffer_ = channel_->CreateViewCommandBuffer( + render_view_id, + allowed_extensions, + attribs, + active_url); } else { command_buffer_ = channel_->CreateOffscreenCommandBuffer( size, diff --git a/content/renderer/gpu/renderer_gl_context.h b/content/renderer/gpu/renderer_gl_context.h index 49cf83f..eb1096c 100644 --- a/content/renderer/gpu/renderer_gl_context.h +++ b/content/renderer/gpu/renderer_gl_context.h @@ -85,7 +85,6 @@ class RendererGLContext : public base::SupportsWeakPtr<RendererGLContext> { // more cross-platform. static RendererGLContext* CreateViewContext( GpuChannelHost* channel, - gfx::PluginWindowHandle render_surface, int render_view_id, const char* allowed_extensions, const int32* attrib_list, @@ -189,7 +188,6 @@ class RendererGLContext : public base::SupportsWeakPtr<RendererGLContext> { explicit RendererGLContext(GpuChannelHost* channel); bool Initialize(bool onscreen, - gfx::PluginWindowHandle render_surface, int render_view_id, const gfx::Size& size, const char* allowed_extensions, diff --git a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc b/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc index c4cf383..b4e0bf1 100644 --- a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc +++ b/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc @@ -114,7 +114,6 @@ bool WebGraphicsContext3DCommandBufferImpl::initialize( web_view_ = web_view; context_ = RendererGLContext::CreateViewContext( host, - renderview->compositing_surface(), renderview->routing_id(), preferred_extensions, attribs, diff --git a/content/renderer/render_thread.cc b/content/renderer/render_thread.cc index 4dcc99b..c6a7118 100644 --- a/content/renderer/render_thread.cc +++ b/content/renderer/render_thread.cc @@ -436,7 +436,6 @@ void RenderThread::OnCreateNewView(const ViewMsg_New_Params& params) { RenderView::Create( this, params.parent_window, - params.compositing_surface, MSG_ROUTING_NONE, params.renderer_preferences, params.web_preferences, diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc index fc28e33..b183d3f 100644 --- a/content/renderer/render_view.cc +++ b/content/renderer/render_view.cc @@ -326,7 +326,6 @@ struct RenderView::PendingFileChooser { RenderView::RenderView(RenderThreadBase* render_thread, gfx::NativeViewId parent_hwnd, - gfx::PluginWindowHandle compositing_surface, int32 opener_id, const RendererPreferences& renderer_prefs, const WebPreferences& webkit_prefs, @@ -383,7 +382,7 @@ RenderView::RenderView(RenderThreadBase* render_thread, // completing initialization. Otherwise, we can finish it now. if (opener_id == MSG_ROUTING_NONE) { did_show_ = true; - CompleteInit(parent_hwnd, compositing_surface); + CompleteInit(parent_hwnd); } g_view_map.Get().insert(std::make_pair(webview(), this)); @@ -470,7 +469,6 @@ RenderView* RenderView::FromWebView(WebView* webview) { RenderView* RenderView::Create( RenderThreadBase* render_thread, gfx::NativeViewId parent_hwnd, - gfx::PluginWindowHandle compositing_surface, int32 opener_id, const RendererPreferences& renderer_prefs, const WebPreferences& webkit_prefs, @@ -482,7 +480,6 @@ RenderView* RenderView::Create( return new RenderView( render_thread, parent_hwnd, - compositing_surface, opener_id, renderer_prefs, webkit_prefs, @@ -1281,7 +1278,6 @@ WebView* RenderView::createView( RenderView* view = RenderView::Create(render_thread_, 0, - gfx::kNullPluginWindow, routing_id_, renderer_preferences_, webkit_preferences_, diff --git a/content/renderer/render_view.h b/content/renderer/render_view.h index 5608bce..444d8555 100644 --- a/content/renderer/render_view.h +++ b/content/renderer/render_view.h @@ -179,7 +179,6 @@ class RenderView : public RenderWidget, static RenderView* Create( RenderThreadBase* render_thread, gfx::NativeViewId parent_hwnd, - gfx::PluginWindowHandle compositing_surface, int32 opener_id, const RendererPreferences& renderer_prefs, const WebPreferences& webkit_prefs, @@ -664,7 +663,6 @@ class RenderView : public RenderWidget, RenderView(RenderThreadBase* render_thread, gfx::NativeViewId parent_hwnd, - gfx::PluginWindowHandle compositing_surface, int32 opener_id, const RendererPreferences& renderer_prefs, const WebPreferences& webkit_prefs, diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc index ab3443b..5cc8d73 100644 --- a/content/renderer/render_widget.cc +++ b/content/renderer/render_widget.cc @@ -88,7 +88,6 @@ RenderWidget::RenderWidget(RenderThreadBase* render_thread, pending_window_rect_count_(0), suppress_next_char_events_(false), is_accelerated_compositing_active_(false), - compositing_surface_(gfx::kNullPluginWindow), animation_update_pending_(false), animation_task_posted_(false), invalidation_task_posted_(false) { @@ -164,12 +163,10 @@ void RenderWidget::DoInit(int32 opener_id, // This is used to complete pending inits and non-pending inits. For non- // pending cases, the parent will be the same as the current parent. This // indicates we do not need to reparent or anything. -void RenderWidget::CompleteInit(gfx::NativeViewId parent_hwnd, - gfx::PluginWindowHandle compositing_surface) { +void RenderWidget::CompleteInit(gfx::NativeViewId parent_hwnd) { DCHECK(routing_id_ != MSG_ROUTING_NONE); host_window_ = parent_hwnd; - compositing_surface_ = compositing_surface; Send(new ViewHostMsg_RenderViewReady(routing_id_)); } @@ -234,11 +231,10 @@ bool RenderWidget::Send(IPC::Message* message) { // Got a response from the browser after the renderer decided to create a new // view. void RenderWidget::OnCreatingNewAck( - gfx::NativeViewId parent, - gfx::PluginWindowHandle compositing_surface) { + gfx::NativeViewId parent) { DCHECK(routing_id_ != MSG_ROUTING_NONE); - CompleteInit(parent, compositing_surface); + CompleteInit(parent); } void RenderWidget::OnClose() { diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h index fde8220..e6c896f8 100644 --- a/content/renderer/render_widget.h +++ b/content/renderer/render_widget.h @@ -77,10 +77,6 @@ class RenderWidget : public IPC::Channel::Listener, // The compositing surface assigned by the RenderWidgetHost // (or RenderViewHost). Will be gfx::kNullPluginWindow if not assigned yet, // in which case we should not create any GPU command buffers with it. - gfx::PluginWindowHandle compositing_surface() const { - return compositing_surface_; - } - // The routing ID assigned by the RenderProcess. Will be MSG_ROUTING_NONE if // not yet assigned a view ID, in which case, the process MUST NOT send // messages with this ID to the parent. @@ -153,8 +149,7 @@ class RenderWidget : public IPC::Channel::Listener, IPC::SyncMessage* create_widget_message); // Finishes creation of a pending view started with Init. - void CompleteInit(gfx::NativeViewId parent, - gfx::PluginWindowHandle compositing_surface); + void CompleteInit(gfx::NativeViewId parent); // Sets whether this RenderWidget has been swapped out to be displayed by // a RenderWidget in a different process. If so, no new IPC messages will be @@ -187,8 +182,7 @@ class RenderWidget : public IPC::Channel::Listener, // RenderWidget IPC message handlers void OnClose(); - void OnCreatingNewAck(gfx::NativeViewId parent, - gfx::PluginWindowHandle compositing_surface); + void OnCreatingNewAck(gfx::NativeViewId parent); virtual void OnResize(const gfx::Size& new_size, const gfx::Rect& resizer_rect); virtual void OnWasHidden(); @@ -433,10 +427,6 @@ class RenderWidget : public IPC::Channel::Listener, // compositor. bool is_accelerated_compositing_active_; - // Handle to a surface that is drawn to when accelerated compositing is - // active. - gfx::PluginWindowHandle compositing_surface_; - base::Time animation_floor_time_; bool animation_update_pending_; bool animation_task_posted_; diff --git a/content/renderer/render_widget_fullscreen_pepper.cc b/content/renderer/render_widget_fullscreen_pepper.cc index eace6b0..b9d3e21 100644 --- a/content/renderer/render_widget_fullscreen_pepper.cc +++ b/content/renderer/render_widget_fullscreen_pepper.cc @@ -343,7 +343,6 @@ void RenderWidgetFullscreenPepper::CreateContext() { }; context_ = RendererGLContext::CreateViewContext( host, - compositing_surface(), routing_id(), "GL_OES_packed_depth_stencil GL_OES_depth24", attribs, |