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