| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 is_for_guests_only_(is_for_guests_only), | 608 is_for_guests_only_(is_for_guests_only), |
| 609 gpu_observer_registered_(false), | 609 gpu_observer_registered_(false), |
| 610 delayed_cleanup_needed_(false), | 610 delayed_cleanup_needed_(false), |
| 611 within_process_died_observer_(false), | 611 within_process_died_observer_(false), |
| 612 power_monitor_broadcaster_(this), | 612 power_monitor_broadcaster_(this), |
| 613 #if defined(ENABLE_WEBRTC) | 613 #if defined(ENABLE_WEBRTC) |
| 614 webrtc_eventlog_host_(id_), | 614 webrtc_eventlog_host_(id_), |
| 615 #endif | 615 #endif |
| 616 worker_ref_count_(0), | 616 worker_ref_count_(0), |
| 617 max_worker_count_(0), | 617 max_worker_count_(0), |
| 618 worker_ref_count_disabled_(false), |
| 618 permission_service_context_(new PermissionServiceContext(this)), | 619 permission_service_context_(new PermissionServiceContext(this)), |
| 619 channel_connected_(false), | 620 channel_connected_(false), |
| 620 sent_render_process_ready_(false), | 621 sent_render_process_ready_(false), |
| 621 #if defined(OS_ANDROID) | 622 #if defined(OS_ANDROID) |
| 622 never_signaled_(base::WaitableEvent::ResetPolicy::MANUAL, | 623 never_signaled_(base::WaitableEvent::ResetPolicy::MANUAL, |
| 623 base::WaitableEvent::InitialState::NOT_SIGNALED), | 624 base::WaitableEvent::InitialState::NOT_SIGNALED), |
| 624 #endif | 625 #endif |
| 625 weak_factory_(this) { | 626 weak_factory_(this) { |
| 626 widget_helper_ = new RenderWidgetHelper(); | 627 widget_helper_ = new RenderWidgetHelper(); |
| 627 | 628 |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 return manager->GetCdm(render_frame_id, cdm_id); | 1242 return manager->GetCdm(render_frame_id, cdm_id); |
| 1242 } | 1243 } |
| 1243 #endif | 1244 #endif |
| 1244 | 1245 |
| 1245 bool RenderProcessHostImpl::IsProcessBackgrounded() const { | 1246 bool RenderProcessHostImpl::IsProcessBackgrounded() const { |
| 1246 return is_process_backgrounded_; | 1247 return is_process_backgrounded_; |
| 1247 } | 1248 } |
| 1248 | 1249 |
| 1249 void RenderProcessHostImpl::IncrementWorkerRefCount() { | 1250 void RenderProcessHostImpl::IncrementWorkerRefCount() { |
| 1250 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1251 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1252 DCHECK(!worker_ref_count_disabled_); |
| 1251 ++worker_ref_count_; | 1253 ++worker_ref_count_; |
| 1252 if (worker_ref_count_ > max_worker_count_) | 1254 if (worker_ref_count_ > max_worker_count_) |
| 1253 max_worker_count_ = worker_ref_count_; | 1255 max_worker_count_ = worker_ref_count_; |
| 1254 } | 1256 } |
| 1255 | 1257 |
| 1256 void RenderProcessHostImpl::DecrementWorkerRefCount() { | 1258 void RenderProcessHostImpl::DecrementWorkerRefCount() { |
| 1257 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1259 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1260 DCHECK(!worker_ref_count_disabled_); |
| 1258 DCHECK_GT(worker_ref_count_, 0); | 1261 DCHECK_GT(worker_ref_count_, 0); |
| 1259 --worker_ref_count_; | 1262 --worker_ref_count_; |
| 1260 if (worker_ref_count_ == 0) | 1263 if (worker_ref_count_ == 0) |
| 1261 Cleanup(); | 1264 Cleanup(); |
| 1262 } | 1265 } |
| 1263 | 1266 |
| 1267 void RenderProcessHostImpl::ForceReleaseWorkerRefCount() { |
| 1268 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1269 worker_ref_count_disabled_ = true; |
| 1270 if (!worker_ref_count_) |
| 1271 return; |
| 1272 worker_ref_count_ = 0; |
| 1273 Cleanup(); |
| 1274 } |
| 1275 |
| 1264 void RenderProcessHostImpl::PurgeAndSuspend() { | 1276 void RenderProcessHostImpl::PurgeAndSuspend() { |
| 1265 Send(new ChildProcessMsg_PurgeAndSuspend()); | 1277 Send(new ChildProcessMsg_PurgeAndSuspend()); |
| 1266 } | 1278 } |
| 1267 | 1279 |
| 1268 void RenderProcessHostImpl::AddRoute(int32_t routing_id, | 1280 void RenderProcessHostImpl::AddRoute(int32_t routing_id, |
| 1269 IPC::Listener* listener) { | 1281 IPC::Listener* listener) { |
| 1270 CHECK(!listeners_.Lookup(routing_id)) << "Found Routing ID Conflict: " | 1282 CHECK(!listeners_.Lookup(routing_id)) << "Found Routing ID Conflict: " |
| 1271 << routing_id; | 1283 << routing_id; |
| 1272 listeners_.AddWithID(listener, routing_id); | 1284 listeners_.AddWithID(listener, routing_id); |
| 1273 } | 1285 } |
| (...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2841 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 2853 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
| 2842 | 2854 |
| 2843 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias | 2855 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias |
| 2844 // enough information here so that we can determine what the bad message was. | 2856 // enough information here so that we can determine what the bad message was. |
| 2845 base::debug::Alias(&error); | 2857 base::debug::Alias(&error); |
| 2846 bad_message::ReceivedBadMessage(process.get(), | 2858 bad_message::ReceivedBadMessage(process.get(), |
| 2847 bad_message::RPH_MOJO_PROCESS_ERROR); | 2859 bad_message::RPH_MOJO_PROCESS_ERROR); |
| 2848 } | 2860 } |
| 2849 | 2861 |
| 2850 } // namespace content | 2862 } // namespace content |
| OLD | NEW |