| 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 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2388 | 2384 |
| 2389 void RenderProcessHostImpl::DecrementWorkerRefCount() { | 2385 void RenderProcessHostImpl::DecrementWorkerRefCount() { |
| 2390 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 2386 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 2391 DCHECK_GT(worker_ref_count_, 0); | 2387 DCHECK_GT(worker_ref_count_, 0); |
| 2392 --worker_ref_count_; | 2388 --worker_ref_count_; |
| 2393 if (worker_ref_count_ == 0) | 2389 if (worker_ref_count_ == 0) |
| 2394 Cleanup(); | 2390 Cleanup(); |
| 2395 } | 2391 } |
| 2396 | 2392 |
| 2397 } // namespace content | 2393 } // namespace content |
| OLD | NEW |