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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 647613002: Fix RenderWidgetHostViewGuest leak. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add is_guest_view_hack_ to RWHV Created 6 years, 2 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/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 new_contents->RenderViewCreated(new_contents->GetRenderViewHost()); 1524 new_contents->RenderViewCreated(new_contents->GetRenderViewHost());
1525 1525
1526 // Save the window for later if we're not suppressing the opener (since it 1526 // Save the window for later if we're not suppressing the opener (since it
1527 // will be shown immediately). 1527 // will be shown immediately).
1528 if (!params.opener_suppressed) { 1528 if (!params.opener_suppressed) {
1529 if (!is_guest) { 1529 if (!is_guest) {
1530 WebContentsView* new_view = new_contents->view_.get(); 1530 WebContentsView* new_view = new_contents->view_.get();
1531 1531
1532 // TODO(brettw): It seems bogus that we have to call this function on the 1532 // TODO(brettw): It seems bogus that we have to call this function on the
1533 // newly created object and give it one of its own member variables. 1533 // newly created object and give it one of its own member variables.
1534 new_view->CreateViewForWidget(new_contents->GetRenderViewHost()); 1534 new_view->CreateViewForWidget(new_contents->GetRenderViewHost(), false);
1535 } 1535 }
1536 // Save the created window associated with the route so we can show it 1536 // Save the created window associated with the route so we can show it
1537 // later. 1537 // later.
1538 DCHECK_NE(MSG_ROUTING_NONE, route_id); 1538 DCHECK_NE(MSG_ROUTING_NONE, route_id);
1539 pending_contents_[route_id] = new_contents; 1539 pending_contents_[route_id] = new_contents;
1540 AddDestructionObserver(new_contents); 1540 AddDestructionObserver(new_contents);
1541 } 1541 }
1542 1542
1543 if (delegate_) { 1543 if (delegate_) {
1544 delegate_->WebContentsCreated( 1544 delegate_->WebContentsCreated(
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1597 } 1597 }
1598 return; 1598 return;
1599 } 1599 }
1600 1600
1601 RenderWidgetHostImpl* widget_host = 1601 RenderWidgetHostImpl* widget_host =
1602 new RenderWidgetHostImpl(this, process, route_id, IsHidden()); 1602 new RenderWidgetHostImpl(this, process, route_id, IsHidden());
1603 created_widgets_.insert(widget_host); 1603 created_widgets_.insert(widget_host);
1604 1604
1605 RenderWidgetHostViewBase* widget_view = 1605 RenderWidgetHostViewBase* widget_view =
1606 static_cast<RenderWidgetHostViewBase*>( 1606 static_cast<RenderWidgetHostViewBase*>(
1607 view_->CreateViewForPopupWidget(widget_host)); 1607 view_->CreateViewForPopupWidget(widget_host, false));
1608 if (!widget_view) 1608 if (!widget_view)
1609 return; 1609 return;
1610 if (!is_fullscreen) { 1610 if (!is_fullscreen) {
1611 // Popups should not get activated. 1611 // Popups should not get activated.
1612 widget_view->SetPopupType(popup_type); 1612 widget_view->SetPopupType(popup_type);
1613 } 1613 }
1614 // Save the created widget associated with the route so we can show it later. 1614 // Save the created widget associated with the route so we can show it later.
1615 pending_widget_views_[route_id] = widget_view; 1615 pending_widget_views_[route_id] = widget_view;
1616 1616
1617 #if defined(OS_MACOSX) 1617 #if defined(OS_MACOSX)
(...skipping 2467 matching lines...) Expand 10 before | Expand all | Expand 10 after
4085 RenderWidgetHostViewBase* rwh_view; 4085 RenderWidgetHostViewBase* rwh_view;
4086 // TODO(kenrb): RenderWidgetHostViewChildFrame special casing is temporary 4086 // TODO(kenrb): RenderWidgetHostViewChildFrame special casing is temporary
4087 // until RenderWidgetHost is attached to RenderFrameHost. We need to special 4087 // until RenderWidgetHost is attached to RenderFrameHost. We need to special
4088 // case this because RWH is still a base class of RenderViewHost, and child 4088 // case this because RWH is still a base class of RenderViewHost, and child
4089 // frame RWHVs are unique in that they do not have their own WebContents. 4089 // frame RWHVs are unique in that they do not have their own WebContents.
4090 if (!for_main_frame_navigation) { 4090 if (!for_main_frame_navigation) {
4091 RenderWidgetHostViewChildFrame* rwh_view_child = 4091 RenderWidgetHostViewChildFrame* rwh_view_child =
4092 new RenderWidgetHostViewChildFrame(render_view_host); 4092 new RenderWidgetHostViewChildFrame(render_view_host);
4093 rwh_view = rwh_view_child; 4093 rwh_view = rwh_view_child;
4094 } else { 4094 } else {
4095 rwh_view = view_->CreateViewForWidget(render_view_host); 4095 rwh_view = view_->CreateViewForWidget(render_view_host, false);
4096 } 4096 }
4097 4097
4098 // Now that the RenderView has been created, we need to tell it its size. 4098 // Now that the RenderView has been created, we need to tell it its size.
4099 if (rwh_view) 4099 if (rwh_view)
4100 rwh_view->SetSize(GetSizeForNewRenderView()); 4100 rwh_view->SetSize(GetSizeForNewRenderView());
4101 4101
4102 // Make sure we use the correct starting page_id in the new RenderView. 4102 // Make sure we use the correct starting page_id in the new RenderView.
4103 UpdateMaxPageIDIfNecessary(render_view_host); 4103 UpdateMaxPageIDIfNecessary(render_view_host);
4104 int32 max_page_id = 4104 int32 max_page_id =
4105 GetMaxPageIDForSiteInstance(render_view_host->GetSiteInstance()); 4105 GetMaxPageIDForSiteInstance(render_view_host->GetSiteInstance());
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
4325 node->render_manager()->ResumeResponseDeferredAtStart(); 4325 node->render_manager()->ResumeResponseDeferredAtStart();
4326 } 4326 }
4327 4327
4328 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4328 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4329 force_disable_overscroll_content_ = force_disable; 4329 force_disable_overscroll_content_ = force_disable;
4330 if (view_) 4330 if (view_)
4331 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4331 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4332 } 4332 }
4333 4333
4334 } // namespace content 4334 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698