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

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 Charlie's comments 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 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1486 1486
1487 mark_child_process_activity_time(); 1487 mark_child_process_activity_time();
1488 if (msg.routing_id() == MSG_ROUTING_CONTROL) { 1488 if (msg.routing_id() == MSG_ROUTING_CONTROL) {
1489 // Dispatch control messages. 1489 // Dispatch control messages.
1490 IPC_BEGIN_MESSAGE_MAP(RenderProcessHostImpl, msg) 1490 IPC_BEGIN_MESSAGE_MAP(RenderProcessHostImpl, msg)
1491 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest, 1491 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest,
1492 OnShutdownRequest) 1492 OnShutdownRequest)
1493 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DumpHandlesDone, 1493 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DumpHandlesDone,
1494 OnDumpHandlesDone) 1494 OnDumpHandlesDone)
1495 IPC_MESSAGE_HANDLER(ViewHostMsg_SuddenTerminationChanged, 1495 IPC_MESSAGE_HANDLER(ViewHostMsg_SuddenTerminationChanged,
1496 SuddenTerminationChanged) 1496 OnSuddenTerminationChanged)
1497 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction, 1497 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction,
1498 OnUserMetricsRecordAction) 1498 OnUserMetricsRecordAction)
1499 IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML) 1499 IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML)
1500 IPC_MESSAGE_HANDLER(ViewHostMsg_Close_ACK, OnCloseACK) 1500 IPC_MESSAGE_HANDLER(ViewHostMsg_Close_ACK, OnCloseACK)
1501 #if defined(ENABLE_WEBRTC) 1501 #if defined(ENABLE_WEBRTC)
1502 IPC_MESSAGE_HANDLER(AecDumpMsg_RegisterAecDumpConsumer, 1502 IPC_MESSAGE_HANDLER(AecDumpMsg_RegisterAecDumpConsumer,
1503 OnRegisterAecDumpConsumer) 1503 OnRegisterAecDumpConsumer)
1504 IPC_MESSAGE_HANDLER(AecDumpMsg_UnregisterAecDumpConsumer, 1504 IPC_MESSAGE_HANDLER(AecDumpMsg_UnregisterAecDumpConsumer,
1505 OnUnregisterAecDumpConsumer) 1505 OnUnregisterAecDumpConsumer)
1506 #endif 1506 #endif
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1651 1651
1652 void RenderProcessHostImpl::AddPendingView() { 1652 void RenderProcessHostImpl::AddPendingView() {
1653 pending_views_++; 1653 pending_views_++;
1654 } 1654 }
1655 1655
1656 void RenderProcessHostImpl::RemovePendingView() { 1656 void RenderProcessHostImpl::RemovePendingView() {
1657 DCHECK(pending_views_); 1657 DCHECK(pending_views_);
1658 pending_views_--; 1658 pending_views_--;
1659 } 1659 }
1660 1660
1661 void RenderProcessHostImpl::SetSuddenTerminationAllowed(bool enabled) {
1662 sudden_termination_allowed_ = enabled;
1663 }
1664
1665 bool RenderProcessHostImpl::SuddenTerminationAllowed() const { 1661 bool RenderProcessHostImpl::SuddenTerminationAllowed() const {
1666 return sudden_termination_allowed_; 1662 return sudden_termination_allowed_;
1667 } 1663 }
1668 1664
1669 base::TimeDelta RenderProcessHostImpl::GetChildProcessIdleTime() const { 1665 base::TimeDelta RenderProcessHostImpl::GetChildProcessIdleTime() const {
1670 return base::TimeTicks::Now() - child_process_activity_time_; 1666 return base::TimeTicks::Now() - child_process_activity_time_;
1671 } 1667 }
1672 1668
1673 void RenderProcessHostImpl::ResumeRequestsForView(int route_id) { 1669 void RenderProcessHostImpl::ResumeRequestsForView(int route_id) {
1674 widget_helper_->ResumeRequestsForView(route_id); 1670 widget_helper_->ResumeRequestsForView(route_id);
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
2163 NotificationService::current()->Notify( 2159 NotificationService::current()->Notify(
2164 NOTIFICATION_RENDERER_PROCESS_CLOSING, 2160 NOTIFICATION_RENDERER_PROCESS_CLOSING,
2165 Source<RenderProcessHost>(this), 2161 Source<RenderProcessHost>(this),
2166 NotificationService::NoDetails()); 2162 NotificationService::NoDetails());
2167 2163
2168 mojo_application_host_->WillDestroySoon(); 2164 mojo_application_host_->WillDestroySoon();
2169 2165
2170 Send(new ChildProcessMsg_Shutdown()); 2166 Send(new ChildProcessMsg_Shutdown());
2171 } 2167 }
2172 2168
2173 void RenderProcessHostImpl::SuddenTerminationChanged(bool enabled) { 2169 void RenderProcessHostImpl::OnSuddenTerminationChanged(bool enabled) {
2174 SetSuddenTerminationAllowed(enabled); 2170 sudden_termination_allowed_ = enabled;
2175 } 2171 }
2176 2172
2177 void RenderProcessHostImpl::OnDumpHandlesDone() { 2173 void RenderProcessHostImpl::OnDumpHandlesDone() {
2178 Cleanup(); 2174 Cleanup();
2179 } 2175 }
2180 2176
2181 void RenderProcessHostImpl::SetBackgrounded(bool backgrounded) { 2177 void RenderProcessHostImpl::SetBackgrounded(bool backgrounded) {
2182 // Note: we always set the backgrounded_ value. If the process is NULL 2178 // Note: we always set the backgrounded_ value. If the process is NULL
2183 // (and hence hasn't been created yet), we will set the process priority 2179 // (and hence hasn't been created yet), we will set the process priority
2184 // later when we create the process. 2180 // later when we create the process.
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
2393 if (worker_ref_count_ == 0) 2389 if (worker_ref_count_ == 0)
2394 Cleanup(); 2390 Cleanup();
2395 } 2391 }
2396 2392
2397 void RenderProcessHostImpl::GetAudioOutputControllers( 2393 void RenderProcessHostImpl::GetAudioOutputControllers(
2398 const GetAudioOutputControllersCallback& callback) const { 2394 const GetAudioOutputControllersCallback& callback) const {
2399 audio_renderer_host()->GetOutputControllers(callback); 2395 audio_renderer_host()->GetOutputControllers(callback);
2400 } 2396 }
2401 2397
2402 } // namespace content 2398 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698