| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 #include "content/browser/media/media_internals.h" | 83 #include "content/browser/media/media_internals.h" |
| 84 #include "content/browser/media/midi_host.h" | 84 #include "content/browser/media/midi_host.h" |
| 85 #include "content/browser/memory/memory_coordinator.h" | 85 #include "content/browser/memory/memory_coordinator.h" |
| 86 #include "content/browser/memory/memory_message_filter.h" | 86 #include "content/browser/memory/memory_message_filter.h" |
| 87 #include "content/browser/message_port_message_filter.h" | 87 #include "content/browser/message_port_message_filter.h" |
| 88 #include "content/browser/mime_registry_impl.h" | 88 #include "content/browser/mime_registry_impl.h" |
| 89 #include "content/browser/notifications/notification_message_filter.h" | 89 #include "content/browser/notifications/notification_message_filter.h" |
| 90 #include "content/browser/notifications/platform_notification_context_impl.h" | 90 #include "content/browser/notifications/platform_notification_context_impl.h" |
| 91 #include "content/browser/permissions/permission_service_context.h" | 91 #include "content/browser/permissions/permission_service_context.h" |
| 92 #include "content/browser/permissions/permission_service_impl.h" | 92 #include "content/browser/permissions/permission_service_impl.h" |
| 93 #include "content/browser/power_monitor_message_broadcaster.h" |
| 93 #include "content/browser/profiler_message_filter.h" | 94 #include "content/browser/profiler_message_filter.h" |
| 94 #include "content/browser/push_messaging/push_messaging_message_filter.h" | 95 #include "content/browser/push_messaging/push_messaging_message_filter.h" |
| 95 #include "content/browser/quota_dispatcher_host.h" | 96 #include "content/browser/quota_dispatcher_host.h" |
| 96 #include "content/browser/renderer_host/clipboard_message_filter.h" | 97 #include "content/browser/renderer_host/clipboard_message_filter.h" |
| 97 #include "content/browser/renderer_host/database_message_filter.h" | 98 #include "content/browser/renderer_host/database_message_filter.h" |
| 98 #include "content/browser/renderer_host/file_utilities_message_filter.h" | 99 #include "content/browser/renderer_host/file_utilities_message_filter.h" |
| 99 #include "content/browser/renderer_host/gamepad_browser_message_filter.h" | 100 #include "content/browser/renderer_host/gamepad_browser_message_filter.h" |
| 100 #include "content/browser/renderer_host/media/audio_input_renderer_host.h" | 101 #include "content/browser/renderer_host/media/audio_input_renderer_host.h" |
| 101 #include "content/browser/renderer_host/media/audio_renderer_host.h" | 102 #include "content/browser/renderer_host/media/audio_renderer_host.h" |
| 102 #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h" | 103 #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h" |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 is_process_backgrounded_(false), | 678 is_process_backgrounded_(false), |
| 678 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), | 679 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), |
| 679 browser_context_(browser_context), | 680 browser_context_(browser_context), |
| 680 storage_partition_impl_(storage_partition_impl), | 681 storage_partition_impl_(storage_partition_impl), |
| 681 sudden_termination_allowed_(true), | 682 sudden_termination_allowed_(true), |
| 682 ignore_input_events_(false), | 683 ignore_input_events_(false), |
| 683 is_for_guests_only_(is_for_guests_only), | 684 is_for_guests_only_(is_for_guests_only), |
| 684 gpu_observer_registered_(false), | 685 gpu_observer_registered_(false), |
| 685 delayed_cleanup_needed_(false), | 686 delayed_cleanup_needed_(false), |
| 686 within_process_died_observer_(false), | 687 within_process_died_observer_(false), |
| 687 power_monitor_broadcaster_(this), | |
| 688 #if defined(ENABLE_WEBRTC) | 688 #if defined(ENABLE_WEBRTC) |
| 689 webrtc_eventlog_host_(id_), | 689 webrtc_eventlog_host_(id_), |
| 690 #endif | 690 #endif |
| 691 max_worker_count_(0), | 691 max_worker_count_(0), |
| 692 permission_service_context_(new PermissionServiceContext(this)), | 692 permission_service_context_(new PermissionServiceContext(this)), |
| 693 channel_connected_(false), | 693 channel_connected_(false), |
| 694 sent_render_process_ready_(false), | 694 sent_render_process_ready_(false), |
| 695 #if defined(OS_ANDROID) | 695 #if defined(OS_ANDROID) |
| 696 never_signaled_(base::WaitableEvent::ResetPolicy::MANUAL, | 696 never_signaled_(base::WaitableEvent::ResetPolicy::MANUAL, |
| 697 base::WaitableEvent::InitialState::NOT_SIGNALED), | 697 base::WaitableEvent::InitialState::NOT_SIGNALED), |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 channel_->Pause(); | 914 channel_->Pause(); |
| 915 | 915 |
| 916 fast_shutdown_started_ = false; | 916 fast_shutdown_started_ = false; |
| 917 } | 917 } |
| 918 | 918 |
| 919 if (!gpu_observer_registered_) { | 919 if (!gpu_observer_registered_) { |
| 920 gpu_observer_registered_ = true; | 920 gpu_observer_registered_ = true; |
| 921 ui::GpuSwitchingManager::GetInstance()->AddObserver(this); | 921 ui::GpuSwitchingManager::GetInstance()->AddObserver(this); |
| 922 } | 922 } |
| 923 | 923 |
| 924 power_monitor_broadcaster_.Init(); | |
| 925 | |
| 926 is_initialized_ = true; | 924 is_initialized_ = true; |
| 927 init_time_ = base::TimeTicks::Now(); | 925 init_time_ = base::TimeTicks::Now(); |
| 928 return true; | 926 return true; |
| 929 } | 927 } |
| 930 | 928 |
| 931 void RenderProcessHostImpl::InitializeChannelProxy() { | 929 void RenderProcessHostImpl::InitializeChannelProxy() { |
| 932 // Generate a token used to identify the new child process. | 930 // Generate a token used to identify the new child process. |
| 933 child_token_ = mojo::edk::GenerateRandomToken(); | 931 child_token_ = mojo::edk::GenerateRandomToken(); |
| 934 | 932 |
| 935 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = | 933 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1260 // BrowserMainLoop, which owns TimeZoneMonitor, is alive for the lifetime of | 1258 // BrowserMainLoop, which owns TimeZoneMonitor, is alive for the lifetime of |
| 1261 // Mojo communication (see BrowserMainLoop::ShutdownThreadsAndCleanUp(), | 1259 // Mojo communication (see BrowserMainLoop::ShutdownThreadsAndCleanUp(), |
| 1262 // which shuts down Mojo). Hence, passing that TimeZoneMonitor instance as | 1260 // which shuts down Mojo). Hence, passing that TimeZoneMonitor instance as |
| 1263 // a raw pointer here is safe. | 1261 // a raw pointer here is safe. |
| 1264 AddUIThreadInterface( | 1262 AddUIThreadInterface( |
| 1265 registry.get(), | 1263 registry.get(), |
| 1266 base::Bind(&device::TimeZoneMonitor::Bind, | 1264 base::Bind(&device::TimeZoneMonitor::Bind, |
| 1267 base::Unretained( | 1265 base::Unretained( |
| 1268 BrowserMainLoop::GetInstance()->time_zone_monitor()))); | 1266 BrowserMainLoop::GetInstance()->time_zone_monitor()))); |
| 1269 | 1267 |
| 1268 AddUIThreadInterface(registry.get(), |
| 1269 base::Bind(&PowerMonitorMessageBroadcaster::Create)); |
| 1270 |
| 1270 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner = | 1271 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner = |
| 1271 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE); | 1272 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE); |
| 1272 registry->AddInterface(base::Bind(&MimeRegistryImpl::Create), | 1273 registry->AddInterface(base::Bind(&MimeRegistryImpl::Create), |
| 1273 file_task_runner); | 1274 file_task_runner); |
| 1274 #if defined(USE_MINIKIN_HYPHENATION) | 1275 #if defined(USE_MINIKIN_HYPHENATION) |
| 1275 registry->AddInterface(base::Bind(&hyphenation::HyphenationImpl::Create), | 1276 registry->AddInterface(base::Bind(&hyphenation::HyphenationImpl::Create), |
| 1276 file_task_runner); | 1277 file_task_runner); |
| 1277 #endif | 1278 #endif |
| 1278 | 1279 |
| 1279 // These callbacks will be run immediately on the IO thread. | 1280 // These callbacks will be run immediately on the IO thread. |
| (...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3000 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 3001 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
| 3001 | 3002 |
| 3002 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias | 3003 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias |
| 3003 // enough information here so that we can determine what the bad message was. | 3004 // enough information here so that we can determine what the bad message was. |
| 3004 base::debug::Alias(&error); | 3005 base::debug::Alias(&error); |
| 3005 bad_message::ReceivedBadMessage(render_process_id, | 3006 bad_message::ReceivedBadMessage(render_process_id, |
| 3006 bad_message::RPH_MOJO_PROCESS_ERROR); | 3007 bad_message::RPH_MOJO_PROCESS_ERROR); |
| 3007 } | 3008 } |
| 3008 | 3009 |
| 3009 } // namespace content | 3010 } // namespace content |
| OLD | NEW |