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

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 851333005: Revert of Make RenderFrame(Host) own a RenderWidget(Host). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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/renderer_host/render_widget_host_impl.h" 5 #include "content/browser/renderer_host/render_widget_host_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 ignore_input_events_(false), 177 ignore_input_events_(false),
178 input_method_active_(false), 178 input_method_active_(false),
179 text_direction_updated_(false), 179 text_direction_updated_(false),
180 text_direction_(blink::WebTextDirectionLeftToRight), 180 text_direction_(blink::WebTextDirectionLeftToRight),
181 text_direction_canceled_(false), 181 text_direction_canceled_(false),
182 suppress_next_char_events_(false), 182 suppress_next_char_events_(false),
183 pending_mouse_lock_request_(false), 183 pending_mouse_lock_request_(false),
184 allow_privileged_mouse_lock_(false), 184 allow_privileged_mouse_lock_(false),
185 has_touch_handler_(false), 185 has_touch_handler_(false),
186 next_browser_snapshot_id_(1), 186 next_browser_snapshot_id_(1),
187 owned_by_render_frame_host_(false),
188 weak_factory_(this) { 187 weak_factory_(this) {
189 CHECK(delegate_); 188 CHECK(delegate_);
190 if (routing_id_ == MSG_ROUTING_NONE) { 189 if (routing_id_ == MSG_ROUTING_NONE) {
191 routing_id_ = process_->GetNextRoutingID(); 190 routing_id_ = process_->GetNextRoutingID();
192 surface_id_ = GpuSurfaceTracker::Get()->AddSurfaceForRenderer( 191 surface_id_ = GpuSurfaceTracker::Get()->AddSurfaceForRenderer(
193 process_->GetID(), 192 process_->GetID(),
194 routing_id_); 193 routing_id_);
195 } else { 194 } else {
196 // TODO(piman): This is a O(N) lookup, where we could forward the 195 // TODO(piman): This is a O(N) lookup, where we could forward the
197 // information from the RenderWidgetHelper. The problem is that doing so 196 // information from the RenderWidgetHelper. The problem is that doing so
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 GpuSurfaceTracker::Get()->SetSurfaceHandle( 407 GpuSurfaceTracker::Get()->SetSurfaceHandle(
409 surface_id_, GetCompositingSurface()); 408 surface_id_, GetCompositingSurface());
410 409
411 // Send the ack along with the information on placement. 410 // Send the ack along with the information on placement.
412 Send(new ViewMsg_CreatingNew_ACK(routing_id_)); 411 Send(new ViewMsg_CreatingNew_ACK(routing_id_));
413 GetProcess()->ResumeRequestsForView(routing_id_); 412 GetProcess()->ResumeRequestsForView(routing_id_);
414 413
415 WasResized(); 414 WasResized();
416 } 415 }
417 416
418 void RenderWidgetHostImpl::InitForFrame() {
419 DCHECK(process_->HasConnection());
420 renderer_initialized_ = true;
421 }
422
423 void RenderWidgetHostImpl::Shutdown() { 417 void RenderWidgetHostImpl::Shutdown() {
424 RejectMouseLockOrUnlockIfNecessary(); 418 RejectMouseLockOrUnlockIfNecessary();
425 419
426 if (process_->HasConnection()) { 420 if (process_->HasConnection()) {
427 // Tell the renderer object to close. 421 // Tell the renderer object to close.
428 bool rv = Send(new ViewMsg_Close(routing_id_)); 422 bool rv = Send(new ViewMsg_Close(routing_id_));
429 DCHECK(rv); 423 DCHECK(rv);
430 } 424 }
431 425
432 Destroy(); 426 Destroy();
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 } 1305 }
1312 1306
1313 void RenderWidgetHostImpl::SetAutoResize(bool enable, 1307 void RenderWidgetHostImpl::SetAutoResize(bool enable,
1314 const gfx::Size& min_size, 1308 const gfx::Size& min_size,
1315 const gfx::Size& max_size) { 1309 const gfx::Size& max_size) {
1316 auto_resize_enabled_ = enable; 1310 auto_resize_enabled_ = enable;
1317 min_size_for_auto_resize_ = min_size; 1311 min_size_for_auto_resize_ = min_size;
1318 max_size_for_auto_resize_ = max_size; 1312 max_size_for_auto_resize_ = max_size;
1319 } 1313 }
1320 1314
1321 void RenderWidgetHostImpl::Cleanup() {
1322 if (view_) {
1323 view_->Destroy();
1324 view_ = nullptr;
1325 }
1326 }
1327
1328 void RenderWidgetHostImpl::Destroy() { 1315 void RenderWidgetHostImpl::Destroy() {
1329 NotificationService::current()->Notify( 1316 NotificationService::current()->Notify(
1330 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, 1317 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED,
1331 Source<RenderWidgetHost>(this), 1318 Source<RenderWidgetHost>(this),
1332 NotificationService::NoDetails()); 1319 NotificationService::NoDetails());
1333 1320
1334 // Tell the view to die. 1321 // Tell the view to die.
1335 // Note that in the process of the view shutting down, it can call a ton 1322 // Note that in the process of the view shutting down, it can call a ton
1336 // of other messages on us. So if you do any other deinitialization here, 1323 // of other messages on us. So if you do any other deinitialization here,
1337 // do it after this call to view_->Destroy(). 1324 // do it after this call to view_->Destroy().
1338 if (view_) { 1325 if (view_)
1339 view_->Destroy(); 1326 view_->Destroy();
1340 view_ = nullptr;
1341 }
1342 1327
1343 delete this; 1328 delete this;
1344 } 1329 }
1345 1330
1346 void RenderWidgetHostImpl::RendererIsUnresponsive() { 1331 void RenderWidgetHostImpl::RendererIsUnresponsive() {
1347 NotificationService::current()->Notify( 1332 NotificationService::current()->Notify(
1348 NOTIFICATION_RENDER_WIDGET_HOST_HANG, 1333 NOTIFICATION_RENDER_WIDGET_HOST_HANG,
1349 Source<RenderWidgetHost>(this), 1334 Source<RenderWidgetHost>(this),
1350 NotificationService::NoDetails()); 1335 NotificationService::NoDetails());
1351 is_unresponsive_ = true; 1336 is_unresponsive_ = true;
1352 NotifyRendererUnresponsive(); 1337 NotifyRendererUnresponsive();
1353 } 1338 }
1354 1339
1355 void RenderWidgetHostImpl::RendererIsResponsive() { 1340 void RenderWidgetHostImpl::RendererIsResponsive() {
1356 if (is_unresponsive_) { 1341 if (is_unresponsive_) {
1357 is_unresponsive_ = false; 1342 is_unresponsive_ = false;
1358 NotifyRendererResponsive(); 1343 NotifyRendererResponsive();
1359 } 1344 }
1360 } 1345 }
1361 1346
1362 void RenderWidgetHostImpl::OnRenderViewReady() { 1347 void RenderWidgetHostImpl::OnRenderViewReady() {
1363 SendScreenRects(); 1348 SendScreenRects();
1364 WasResized(); 1349 WasResized();
1365 } 1350 }
1366 1351
1367 void RenderWidgetHostImpl::OnRenderProcessGone(int status, int exit_code) { 1352 void RenderWidgetHostImpl::OnRenderProcessGone(int status, int exit_code) {
1368 // RenderFrameHost owns a RenderWidgetHost when it needs one, in which case 1353 // TODO(evanm): This synchronously ends up calling "delete this".
1369 // it handles destruction. 1354 // Is that really what we want in response to this message? I'm matching
1370 if (!owned_by_render_frame_host_) { 1355 // previous behavior of the code here.
1371 // TODO(evanm): This synchronously ends up calling "delete this". 1356 Destroy();
1372 // Is that really what we want in response to this message? I'm matching
1373 // previous behavior of the code here.
1374 Destroy();
1375 } else {
1376 RendererExited(static_cast<base::TerminationStatus>(status), exit_code);
1377 }
1378 } 1357 }
1379 1358
1380 void RenderWidgetHostImpl::OnClose() { 1359 void RenderWidgetHostImpl::OnClose() {
1381 Shutdown(); 1360 Shutdown();
1382 } 1361 }
1383 1362
1384 void RenderWidgetHostImpl::OnSetTooltipText( 1363 void RenderWidgetHostImpl::OnSetTooltipText(
1385 const base::string16& tooltip_text, 1364 const base::string16& tooltip_text,
1386 WebTextDirection text_direction_hint) { 1365 WebTextDirection text_direction_hint) {
1387 // First, add directionality marks around tooltip text if necessary. 1366 // First, add directionality marks around tooltip text if necessary.
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
2184 } 2163 }
2185 #endif 2164 #endif
2186 2165
2187 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { 2166 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() {
2188 if (view_) 2167 if (view_)
2189 return view_->PreferredReadbackFormat(); 2168 return view_->PreferredReadbackFormat();
2190 return kN32_SkColorType; 2169 return kN32_SkColorType;
2191 } 2170 }
2192 2171
2193 } // namespace content 2172 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/browser/site_per_process_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698