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

Side by Side Diff: content/browser/web_contents/web_contents_view_guest.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_view_guest.h" 5 #include "content/browser/web_contents/web_contents_view_guest.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "content/browser/browser_plugin/browser_plugin_embedder.h" 8 #include "content/browser/browser_plugin/browser_plugin_embedder.h"
9 #include "content/browser/browser_plugin/browser_plugin_guest.h" 9 #include "content/browser/browser_plugin/browser_plugin_guest.h"
10 #include "content/browser/frame_host/interstitial_page_impl.h" 10 #include "content/browser/frame_host/interstitial_page_impl.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 } 133 }
134 #endif 134 #endif
135 135
136 void WebContentsViewGuest::CreateView(const gfx::Size& initial_size, 136 void WebContentsViewGuest::CreateView(const gfx::Size& initial_size,
137 gfx::NativeView context) { 137 gfx::NativeView context) {
138 platform_view_->CreateView(initial_size, context); 138 platform_view_->CreateView(initial_size, context);
139 size_ = initial_size; 139 size_ = initial_size;
140 } 140 }
141 141
142 RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForWidget( 142 RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForWidget(
143 RenderWidgetHost* render_widget_host) { 143 RenderWidgetHost* render_widget_host, bool is_guest_view_hack) {
144 if (render_widget_host->GetView()) { 144 if (render_widget_host->GetView()) {
145 // During testing, the view will already be set up in most cases to the 145 // During testing, the view will already be set up in most cases to the
146 // test view, so we don't want to clobber it with a real one. To verify that 146 // test view, so we don't want to clobber it with a real one. To verify that
147 // this actually is happening (and somebody isn't accidentally creating the 147 // this actually is happening (and somebody isn't accidentally creating the
148 // view twice), we check for the RVH Factory, which will be set when we're 148 // view twice), we check for the RVH Factory, which will be set when we're
149 // making special ones (which go along with the special views). 149 // making special ones (which go along with the special views).
150 DCHECK(RenderViewHostFactory::has_factory()); 150 DCHECK(RenderViewHostFactory::has_factory());
151 return static_cast<RenderWidgetHostViewBase*>( 151 return static_cast<RenderWidgetHostViewBase*>(
152 render_widget_host->GetView()); 152 render_widget_host->GetView());
153 } 153 }
154 154
155 RenderWidgetHostViewBase* platform_widget = 155 RenderWidgetHostViewBase* platform_widget =
156 platform_view_->CreateViewForWidget(render_widget_host); 156 platform_view_->CreateViewForWidget(render_widget_host, true);
157 157
158 return new RenderWidgetHostViewGuest(render_widget_host, 158 return new RenderWidgetHostViewGuest(render_widget_host,
159 guest_, 159 guest_,
160 platform_widget); 160 platform_widget->GetWeakPtr());
161 } 161 }
162 162
163 RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForPopupWidget( 163 RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForPopupWidget(
164 RenderWidgetHost* render_widget_host) { 164 RenderWidgetHost* render_widget_host, bool is_guest_view_hack) {
165 return platform_view_->CreateViewForPopupWidget(render_widget_host); 165 return platform_view_->CreateViewForPopupWidget(render_widget_host, true);
piman 2014/10/14 23:48:06 I don't think we should pass true. This is called
lazyboy 2014/10/15 04:50:11 Oh that's right, these views don't have a wrapped
166 } 166 }
167 167
168 void WebContentsViewGuest::SetPageTitle(const base::string16& title) { 168 void WebContentsViewGuest::SetPageTitle(const base::string16& title) {
169 } 169 }
170 170
171 void WebContentsViewGuest::RenderViewCreated(RenderViewHost* host) { 171 void WebContentsViewGuest::RenderViewCreated(RenderViewHost* host) {
172 platform_view_->RenderViewCreated(host); 172 platform_view_->RenderViewCreated(host);
173 } 173 }
174 174
175 void WebContentsViewGuest::RenderViewSwappedIn(RenderViewHost* host) { 175 void WebContentsViewGuest::RenderViewSwappedIn(RenderViewHost* host) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 embedder_render_view_host->GetDelegate()->GetDelegateView(); 249 embedder_render_view_host->GetDelegate()->GetDelegateView();
250 if (view) { 250 if (view) {
251 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.StartDrag")); 251 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.StartDrag"));
252 view->StartDragging(drop_data, ops, image, image_offset, event_info); 252 view->StartDragging(drop_data, ops, image, image_offset, event_info);
253 } else { 253 } else {
254 embedder_web_contents->SystemDragEnded(); 254 embedder_web_contents->SystemDragEnded();
255 } 255 }
256 } 256 }
257 257
258 } // namespace content 258 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698