OLD | NEW |
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 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1527 | 1527 |
1528 mark_child_process_activity_time(); | 1528 mark_child_process_activity_time(); |
1529 if (msg.routing_id() == MSG_ROUTING_CONTROL) { | 1529 if (msg.routing_id() == MSG_ROUTING_CONTROL) { |
1530 // Dispatch control messages. | 1530 // Dispatch control messages. |
1531 IPC_BEGIN_MESSAGE_MAP(RenderProcessHostImpl, msg) | 1531 IPC_BEGIN_MESSAGE_MAP(RenderProcessHostImpl, msg) |
1532 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest, | 1532 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest, |
1533 OnShutdownRequest) | 1533 OnShutdownRequest) |
1534 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DumpHandlesDone, | 1534 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DumpHandlesDone, |
1535 OnDumpHandlesDone) | 1535 OnDumpHandlesDone) |
1536 IPC_MESSAGE_HANDLER(ViewHostMsg_SuddenTerminationChanged, | 1536 IPC_MESSAGE_HANDLER(ViewHostMsg_SuddenTerminationChanged, |
1537 OnSuddenTerminationChanged) | 1537 SuddenTerminationChanged) |
1538 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction, | 1538 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction, |
1539 OnUserMetricsRecordAction) | 1539 OnUserMetricsRecordAction) |
1540 IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML) | 1540 IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML) |
1541 IPC_MESSAGE_HANDLER(ViewHostMsg_Close_ACK, OnCloseACK) | 1541 IPC_MESSAGE_HANDLER(ViewHostMsg_Close_ACK, OnCloseACK) |
1542 #if defined(ENABLE_WEBRTC) | 1542 #if defined(ENABLE_WEBRTC) |
1543 IPC_MESSAGE_HANDLER(AecDumpMsg_RegisterAecDumpConsumer, | 1543 IPC_MESSAGE_HANDLER(AecDumpMsg_RegisterAecDumpConsumer, |
1544 OnRegisterAecDumpConsumer) | 1544 OnRegisterAecDumpConsumer) |
1545 IPC_MESSAGE_HANDLER(AecDumpMsg_UnregisterAecDumpConsumer, | 1545 IPC_MESSAGE_HANDLER(AecDumpMsg_UnregisterAecDumpConsumer, |
1546 OnUnregisterAecDumpConsumer) | 1546 OnUnregisterAecDumpConsumer) |
1547 #endif | 1547 #endif |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1693 | 1693 |
1694 void RenderProcessHostImpl::AddPendingView() { | 1694 void RenderProcessHostImpl::AddPendingView() { |
1695 pending_views_++; | 1695 pending_views_++; |
1696 } | 1696 } |
1697 | 1697 |
1698 void RenderProcessHostImpl::RemovePendingView() { | 1698 void RenderProcessHostImpl::RemovePendingView() { |
1699 DCHECK(pending_views_); | 1699 DCHECK(pending_views_); |
1700 pending_views_--; | 1700 pending_views_--; |
1701 } | 1701 } |
1702 | 1702 |
| 1703 void RenderProcessHostImpl::SetSuddenTerminationAllowed(bool enabled) { |
| 1704 sudden_termination_allowed_ = enabled; |
| 1705 } |
| 1706 |
1703 bool RenderProcessHostImpl::SuddenTerminationAllowed() const { | 1707 bool RenderProcessHostImpl::SuddenTerminationAllowed() const { |
1704 return sudden_termination_allowed_; | 1708 return sudden_termination_allowed_; |
1705 } | 1709 } |
1706 | 1710 |
1707 base::TimeDelta RenderProcessHostImpl::GetChildProcessIdleTime() const { | 1711 base::TimeDelta RenderProcessHostImpl::GetChildProcessIdleTime() const { |
1708 return base::TimeTicks::Now() - child_process_activity_time_; | 1712 return base::TimeTicks::Now() - child_process_activity_time_; |
1709 } | 1713 } |
1710 | 1714 |
1711 void RenderProcessHostImpl::ResumeRequestsForView(int route_id) { | 1715 void RenderProcessHostImpl::ResumeRequestsForView(int route_id) { |
1712 widget_helper_->ResumeRequestsForView(route_id); | 1716 widget_helper_->ResumeRequestsForView(route_id); |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2203 NotificationService::current()->Notify( | 2207 NotificationService::current()->Notify( |
2204 NOTIFICATION_RENDERER_PROCESS_CLOSING, | 2208 NOTIFICATION_RENDERER_PROCESS_CLOSING, |
2205 Source<RenderProcessHost>(this), | 2209 Source<RenderProcessHost>(this), |
2206 NotificationService::NoDetails()); | 2210 NotificationService::NoDetails()); |
2207 | 2211 |
2208 mojo_application_host_->WillDestroySoon(); | 2212 mojo_application_host_->WillDestroySoon(); |
2209 | 2213 |
2210 Send(new ChildProcessMsg_Shutdown()); | 2214 Send(new ChildProcessMsg_Shutdown()); |
2211 } | 2215 } |
2212 | 2216 |
2213 void RenderProcessHostImpl::OnSuddenTerminationChanged(bool enabled) { | 2217 void RenderProcessHostImpl::SuddenTerminationChanged(bool enabled) { |
2214 sudden_termination_allowed_ = enabled; | 2218 SetSuddenTerminationAllowed(enabled); |
2215 } | 2219 } |
2216 | 2220 |
2217 void RenderProcessHostImpl::OnDumpHandlesDone() { | 2221 void RenderProcessHostImpl::OnDumpHandlesDone() { |
2218 Cleanup(); | 2222 Cleanup(); |
2219 } | 2223 } |
2220 | 2224 |
2221 void RenderProcessHostImpl::SetBackgrounded(bool backgrounded) { | 2225 void RenderProcessHostImpl::SetBackgrounded(bool backgrounded) { |
2222 // Note: we always set the backgrounded_ value. If the process is NULL | 2226 // Note: we always set the backgrounded_ value. If the process is NULL |
2223 // (and hence hasn't been created yet), we will set the process priority | 2227 // (and hence hasn't been created yet), we will set the process priority |
2224 // later when we create the process. | 2228 // later when we create the process. |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2485 if (worker_ref_count_ == 0) | 2489 if (worker_ref_count_ == 0) |
2486 Cleanup(); | 2490 Cleanup(); |
2487 } | 2491 } |
2488 | 2492 |
2489 void RenderProcessHostImpl::GetAudioOutputControllers( | 2493 void RenderProcessHostImpl::GetAudioOutputControllers( |
2490 const GetAudioOutputControllersCallback& callback) const { | 2494 const GetAudioOutputControllersCallback& callback) const { |
2491 audio_renderer_host()->GetOutputControllers(callback); | 2495 audio_renderer_host()->GetOutputControllers(callback); |
2492 } | 2496 } |
2493 | 2497 |
2494 } // namespace content | 2498 } // namespace content |
OLD | NEW |