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

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

Issue 857213003: Refactor sudden termination (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nits Created 5 years, 10 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 // Represents the browser side of the browser <--> renderer communication 5 // Represents the browser side of the browser <--> renderer communication
6 // channel. There will be one RenderProcessHost per renderer process. 6 // channel. There will be one RenderProcessHost per renderer process.
7 7
8 #include "content/browser/renderer_host/render_process_host_impl.h" 8 #include "content/browser/renderer_host/render_process_host_impl.h"
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after
1488 1488
1489 mark_child_process_activity_time(); 1489 mark_child_process_activity_time();
1490 if (msg.routing_id() == MSG_ROUTING_CONTROL) { 1490 if (msg.routing_id() == MSG_ROUTING_CONTROL) {
1491 // Dispatch control messages. 1491 // Dispatch control messages.
1492 IPC_BEGIN_MESSAGE_MAP(RenderProcessHostImpl, msg) 1492 IPC_BEGIN_MESSAGE_MAP(RenderProcessHostImpl, msg)
1493 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest, 1493 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest,
1494 OnShutdownRequest) 1494 OnShutdownRequest)
1495 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DumpHandlesDone, 1495 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DumpHandlesDone,
1496 OnDumpHandlesDone) 1496 OnDumpHandlesDone)
1497 IPC_MESSAGE_HANDLER(ViewHostMsg_SuddenTerminationChanged, 1497 IPC_MESSAGE_HANDLER(ViewHostMsg_SuddenTerminationChanged,
1498 SuddenTerminationChanged) 1498 OnSuddenTerminationChanged)
1499 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction, 1499 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction,
1500 OnUserMetricsRecordAction) 1500 OnUserMetricsRecordAction)
1501 IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML) 1501 IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML)
1502 IPC_MESSAGE_HANDLER(ViewHostMsg_Close_ACK, OnCloseACK) 1502 IPC_MESSAGE_HANDLER(ViewHostMsg_Close_ACK, OnCloseACK)
1503 #if defined(ENABLE_WEBRTC) 1503 #if defined(ENABLE_WEBRTC)
1504 IPC_MESSAGE_HANDLER(AecDumpMsg_RegisterAecDumpConsumer, 1504 IPC_MESSAGE_HANDLER(AecDumpMsg_RegisterAecDumpConsumer,
1505 OnRegisterAecDumpConsumer) 1505 OnRegisterAecDumpConsumer)
1506 IPC_MESSAGE_HANDLER(AecDumpMsg_UnregisterAecDumpConsumer, 1506 IPC_MESSAGE_HANDLER(AecDumpMsg_UnregisterAecDumpConsumer,
1507 OnUnregisterAecDumpConsumer) 1507 OnUnregisterAecDumpConsumer)
1508 #endif 1508 #endif
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1653 1653
1654 void RenderProcessHostImpl::AddPendingView() { 1654 void RenderProcessHostImpl::AddPendingView() {
1655 pending_views_++; 1655 pending_views_++;
1656 } 1656 }
1657 1657
1658 void RenderProcessHostImpl::RemovePendingView() { 1658 void RenderProcessHostImpl::RemovePendingView() {
1659 DCHECK(pending_views_); 1659 DCHECK(pending_views_);
1660 pending_views_--; 1660 pending_views_--;
1661 } 1661 }
1662 1662
1663 void RenderProcessHostImpl::SetSuddenTerminationAllowed(bool enabled) {
1664 sudden_termination_allowed_ = enabled;
1665 }
1666
1667 bool RenderProcessHostImpl::SuddenTerminationAllowed() const { 1663 bool RenderProcessHostImpl::SuddenTerminationAllowed() const {
1668 return sudden_termination_allowed_; 1664 return sudden_termination_allowed_;
1669 } 1665 }
1670 1666
1671 base::TimeDelta RenderProcessHostImpl::GetChildProcessIdleTime() const { 1667 base::TimeDelta RenderProcessHostImpl::GetChildProcessIdleTime() const {
1672 return base::TimeTicks::Now() - child_process_activity_time_; 1668 return base::TimeTicks::Now() - child_process_activity_time_;
1673 } 1669 }
1674 1670
1675 void RenderProcessHostImpl::ResumeRequestsForView(int route_id) { 1671 void RenderProcessHostImpl::ResumeRequestsForView(int route_id) {
1676 widget_helper_->ResumeRequestsForView(route_id); 1672 widget_helper_->ResumeRequestsForView(route_id);
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
2165 NotificationService::current()->Notify( 2161 NotificationService::current()->Notify(
2166 NOTIFICATION_RENDERER_PROCESS_CLOSING, 2162 NOTIFICATION_RENDERER_PROCESS_CLOSING,
2167 Source<RenderProcessHost>(this), 2163 Source<RenderProcessHost>(this),
2168 NotificationService::NoDetails()); 2164 NotificationService::NoDetails());
2169 2165
2170 mojo_application_host_->WillDestroySoon(); 2166 mojo_application_host_->WillDestroySoon();
2171 2167
2172 Send(new ChildProcessMsg_Shutdown()); 2168 Send(new ChildProcessMsg_Shutdown());
2173 } 2169 }
2174 2170
2175 void RenderProcessHostImpl::SuddenTerminationChanged(bool enabled) { 2171 void RenderProcessHostImpl::OnSuddenTerminationChanged(bool enabled) {
2176 SetSuddenTerminationAllowed(enabled); 2172 sudden_termination_allowed_ = enabled;
2177 } 2173 }
2178 2174
2179 void RenderProcessHostImpl::OnDumpHandlesDone() { 2175 void RenderProcessHostImpl::OnDumpHandlesDone() {
2180 Cleanup(); 2176 Cleanup();
2181 } 2177 }
2182 2178
2183 void RenderProcessHostImpl::SetBackgrounded(bool backgrounded) { 2179 void RenderProcessHostImpl::SetBackgrounded(bool backgrounded) {
2184 // Note: we always set the backgrounded_ value. If the process is NULL 2180 // Note: we always set the backgrounded_ value. If the process is NULL
2185 // (and hence hasn't been created yet), we will set the process priority 2181 // (and hence hasn't been created yet), we will set the process priority
2186 // later when we create the process. 2182 // later when we create the process.
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
2395 if (worker_ref_count_ == 0) 2391 if (worker_ref_count_ == 0)
2396 Cleanup(); 2392 Cleanup();
2397 } 2393 }
2398 2394
2399 void RenderProcessHostImpl::GetAudioOutputControllers( 2395 void RenderProcessHostImpl::GetAudioOutputControllers(
2400 const GetAudioOutputControllersCallback& callback) const { 2396 const GetAudioOutputControllersCallback& callback) const {
2401 audio_renderer_host()->GetOutputControllers(callback); 2397 audio_renderer_host()->GetOutputControllers(callback);
2402 } 2398 }
2403 2399
2404 } // namespace content 2400 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.h ('k') | content/browser/renderer_host/render_view_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698