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

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

Issue 2857263003: Task Manager should listen to WebContentsObserver::RenderFrameCreated. (Closed)
Patch Set: Tweaked the comments as suggested in the CR feedback Created 3 years, 7 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_view_host_impl.h" 5 #include "content/browser/renderer_host/render_view_host_impl.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 frames_ref_count_(0), 203 frames_ref_count_(0),
204 delegate_(delegate), 204 delegate_(delegate),
205 instance_(static_cast<SiteInstanceImpl*>(instance)), 205 instance_(static_cast<SiteInstanceImpl*>(instance)),
206 is_active_(!swapped_out), 206 is_active_(!swapped_out),
207 is_swapped_out_(swapped_out), 207 is_swapped_out_(swapped_out),
208 main_frame_routing_id_(main_frame_routing_id), 208 main_frame_routing_id_(main_frame_routing_id),
209 is_waiting_for_close_ack_(false), 209 is_waiting_for_close_ack_(false),
210 sudden_termination_allowed_(false), 210 sudden_termination_allowed_(false),
211 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), 211 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING),
212 updating_web_preferences_(false), 212 updating_web_preferences_(false),
213 render_view_ready_on_process_launch_(false),
214 weak_factory_(this) { 213 weak_factory_(this) {
215 DCHECK(instance_.get()); 214 DCHECK(instance_.get());
216 CHECK(delegate_); // http://crbug.com/82827 215 CHECK(delegate_); // http://crbug.com/82827
217 216
218 GetWidget()->set_owner_delegate(this); 217 GetWidget()->set_owner_delegate(this);
219 218
220 GetProcess()->AddObserver(this); 219 GetProcess()->AddObserver(this);
221 220
222 // New views may be created during RenderProcessHost::ProcessDied(), within a 221 // New views may be created during RenderProcessHost::ProcessDied(), within a
223 // brief window where the internal ChannelProxy is null. This ensures that the 222 // brief window where the internal ChannelProxy is null. This ensures that the
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 } 608 }
610 609
611 void RenderViewHostImpl::ClosePageIgnoringUnloadEvents() { 610 void RenderViewHostImpl::ClosePageIgnoringUnloadEvents() {
612 close_timeout_->Stop(); 611 close_timeout_->Stop();
613 is_waiting_for_close_ack_ = false; 612 is_waiting_for_close_ack_ = false;
614 613
615 sudden_termination_allowed_ = true; 614 sudden_termination_allowed_ = true;
616 delegate_->Close(this); 615 delegate_->Close(this);
617 } 616 }
618 617
619 void RenderViewHostImpl::RenderProcessReady(RenderProcessHost* host) {
620 if (render_view_ready_on_process_launch_) {
621 render_view_ready_on_process_launch_ = false;
622 RenderViewReady();
623 }
624 }
625
626 void RenderViewHostImpl::RenderProcessExited(RenderProcessHost* host, 618 void RenderViewHostImpl::RenderProcessExited(RenderProcessHost* host,
627 base::TerminationStatus status, 619 base::TerminationStatus status,
628 int exit_code) { 620 int exit_code) {
629 if (!GetWidget()->renderer_initialized()) 621 if (!GetWidget()->renderer_initialized())
630 return; 622 return;
631 623
632 GetWidget()->RendererExited(status, exit_code); 624 GetWidget()->RendererExited(status, exit_code);
633 delegate_->RenderViewTerminated(this, status, exit_code); 625 delegate_->RenderViewTerminated(this, status, exit_code);
634 } 626 }
635 627
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 930
939 void RenderViewHostImpl::NotifyMoveOrResizeStarted() { 931 void RenderViewHostImpl::NotifyMoveOrResizeStarted() {
940 Send(new ViewMsg_MoveOrResizeStarted(GetRoutingID())); 932 Send(new ViewMsg_MoveOrResizeStarted(GetRoutingID()));
941 } 933 }
942 934
943 void RenderViewHostImpl::SelectWordAroundCaret() { 935 void RenderViewHostImpl::SelectWordAroundCaret() {
944 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); 936 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID()));
945 } 937 }
946 938
947 void RenderViewHostImpl::PostRenderViewReady() { 939 void RenderViewHostImpl::PostRenderViewReady() {
948 if (GetProcess()->IsReady()) { 940 GetProcess()->PostTaskWhenProcessIsReady(base::Bind(
949 BrowserThread::PostTask( 941 &RenderViewHostImpl::RenderViewReady, weak_factory_.GetWeakPtr()));
950 BrowserThread::UI,
951 FROM_HERE,
952 base::Bind(&RenderViewHostImpl::RenderViewReady,
953 weak_factory_.GetWeakPtr()));
954 } else {
955 render_view_ready_on_process_launch_ = true;
956 }
957 } 942 }
958 943
959 void RenderViewHostImpl::RenderViewReady() { 944 void RenderViewHostImpl::RenderViewReady() {
945 DCHECK_CURRENTLY_ON(BrowserThread::UI);
960 delegate_->RenderViewReady(this); 946 delegate_->RenderViewReady(this);
961 } 947 }
962 948
963 void RenderViewHostImpl::ClosePageTimeout() { 949 void RenderViewHostImpl::ClosePageTimeout() {
964 if (delegate_->ShouldIgnoreUnresponsiveRenderer()) 950 if (delegate_->ShouldIgnoreUnresponsiveRenderer())
965 return; 951 return;
966 952
967 ClosePageIgnoringUnloadEvents(); 953 ClosePageIgnoringUnloadEvents();
968 } 954 }
969 955
970 } // namespace content 956 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.h ('k') | content/public/browser/render_frame_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698