| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 #include "content/browser/loader/resource_message_filter.h" | 78 #include "content/browser/loader/resource_message_filter.h" |
| 79 #include "content/browser/loader/resource_scheduler_filter.h" | 79 #include "content/browser/loader/resource_scheduler_filter.h" |
| 80 #include "content/browser/media/capture/audio_mirroring_manager.h" | 80 #include "content/browser/media/capture/audio_mirroring_manager.h" |
| 81 #include "content/browser/media/capture/image_capture_impl.h" | 81 #include "content/browser/media/capture/image_capture_impl.h" |
| 82 #include "content/browser/media/media_internals.h" | 82 #include "content/browser/media/media_internals.h" |
| 83 #include "content/browser/media/midi_host.h" | 83 #include "content/browser/media/midi_host.h" |
| 84 #include "content/browser/memory/memory_message_filter.h" | 84 #include "content/browser/memory/memory_message_filter.h" |
| 85 #include "content/browser/message_port_message_filter.h" | 85 #include "content/browser/message_port_message_filter.h" |
| 86 #include "content/browser/mime_registry_impl.h" | 86 #include "content/browser/mime_registry_impl.h" |
| 87 #include "content/browser/mojo/constants.h" | 87 #include "content/browser/mojo/constants.h" |
| 88 #include "content/browser/mojo/mojo_application_host.h" | |
| 89 #include "content/browser/mojo/mojo_child_connection.h" | 88 #include "content/browser/mojo/mojo_child_connection.h" |
| 90 #include "content/browser/notifications/notification_message_filter.h" | 89 #include "content/browser/notifications/notification_message_filter.h" |
| 91 #include "content/browser/notifications/platform_notification_context_impl.h" | 90 #include "content/browser/notifications/platform_notification_context_impl.h" |
| 92 #include "content/browser/permissions/permission_service_context.h" | 91 #include "content/browser/permissions/permission_service_context.h" |
| 93 #include "content/browser/permissions/permission_service_impl.h" | 92 #include "content/browser/permissions/permission_service_impl.h" |
| 94 #include "content/browser/profiler_message_filter.h" | 93 #include "content/browser/profiler_message_filter.h" |
| 95 #include "content/browser/push_messaging/push_messaging_message_filter.h" | 94 #include "content/browser/push_messaging/push_messaging_message_filter.h" |
| 96 #include "content/browser/quota_dispatcher_host.h" | 95 #include "content/browser/quota_dispatcher_host.h" |
| 97 #include "content/browser/renderer_host/clipboard_message_filter.h" | 96 #include "content/browser/renderer_host/clipboard_message_filter.h" |
| 98 #include "content/browser/renderer_host/database_message_filter.h" | 97 #include "content/browser/renderer_host/database_message_filter.h" |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 BrowserContext* browser_context, | 535 BrowserContext* browser_context, |
| 537 StoragePartitionImpl* storage_partition_impl, | 536 StoragePartitionImpl* storage_partition_impl, |
| 538 bool is_for_guests_only) | 537 bool is_for_guests_only) |
| 539 : fast_shutdown_started_(false), | 538 : fast_shutdown_started_(false), |
| 540 deleting_soon_(false), | 539 deleting_soon_(false), |
| 541 #ifndef NDEBUG | 540 #ifndef NDEBUG |
| 542 is_self_deleted_(false), | 541 is_self_deleted_(false), |
| 543 #endif | 542 #endif |
| 544 pending_views_(0), | 543 pending_views_(0), |
| 545 child_token_(mojo::edk::GenerateRandomToken()), | 544 child_token_(mojo::edk::GenerateRandomToken()), |
| 546 mojo_application_host_(new MojoApplicationHost(child_token_)), | |
| 547 visible_widgets_(0), | 545 visible_widgets_(0), |
| 548 is_process_backgrounded_(false), | 546 is_process_backgrounded_(false), |
| 549 is_initialized_(false), | 547 is_initialized_(false), |
| 550 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), | 548 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), |
| 551 browser_context_(browser_context), | 549 browser_context_(browser_context), |
| 552 storage_partition_impl_(storage_partition_impl), | 550 storage_partition_impl_(storage_partition_impl), |
| 553 sudden_termination_allowed_(true), | 551 sudden_termination_allowed_(true), |
| 554 ignore_input_events_(false), | 552 ignore_input_events_(false), |
| 555 is_for_guests_only_(is_for_guests_only), | 553 is_for_guests_only_(is_for_guests_only), |
| 556 gpu_observer_registered_(false), | 554 gpu_observer_registered_(false), |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 // render process. This ensures that when a test is being run in one of the | 593 // render process. This ensures that when a test is being run in one of the |
| 596 // single process modes, the global attachment broker is the privileged | 594 // single process modes, the global attachment broker is the privileged |
| 597 // attachment broker, rather than an unprivileged attachment broker. | 595 // attachment broker, rather than an unprivileged attachment broker. |
| 598 #if defined(OS_MACOSX) | 596 #if defined(OS_MACOSX) |
| 599 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded( | 597 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded( |
| 600 MachBroker::GetInstance()); | 598 MachBroker::GetInstance()); |
| 601 #else | 599 #else |
| 602 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded(); | 600 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded(); |
| 603 #endif // defined(OS_MACOSX) | 601 #endif // defined(OS_MACOSX) |
| 604 #endif // USE_ATTACHMENT_BROKER | 602 #endif // USE_ATTACHMENT_BROKER |
| 603 |
| 604 shell::Connector* connector = |
| 605 BrowserContext::GetShellConnectorFor(browser_context_); |
| 606 // Some embedders may not initialize Mojo or the shell connector for a browser |
| 607 // context (e.g. Android WebView)... so just fall back to the per-process |
| 608 // connector. |
| 609 if (!connector) { |
| 610 // Additionally, some test code may not initialize the process-wide |
| 611 // MojoShellConnection prior to this point. This class of test code doesn't |
| 612 // care about render processes so we can initialize a dummy one. |
| 613 if (!MojoShellConnection::GetForProcess()) { |
| 614 shell::mojom::ShellClientRequest request = |
| 615 mojo::GetProxy(&test_shell_client_); |
| 616 MojoShellConnection::SetForProcess(MojoShellConnection::Create( |
| 617 std::move(request))); |
| 618 } |
| 619 connector = MojoShellConnection::GetForProcess()->GetConnector(); |
| 620 } |
| 621 mojo_child_connection_.reset(new MojoChildConnection( |
| 622 kRendererMojoApplicationName, |
| 623 base::StringPrintf("%d_%d", id_, instance_id_++), |
| 624 child_token_, |
| 625 connector)); |
| 605 } | 626 } |
| 606 | 627 |
| 607 // static | 628 // static |
| 608 void RenderProcessHostImpl::ShutDownInProcessRenderer() { | 629 void RenderProcessHostImpl::ShutDownInProcessRenderer() { |
| 609 DCHECK(g_run_renderer_in_process_); | 630 DCHECK(g_run_renderer_in_process_); |
| 610 | 631 |
| 611 switch (g_all_hosts.Pointer()->size()) { | 632 switch (g_all_hosts.Pointer()->size()) { |
| 612 case 0: | 633 case 0: |
| 613 return; | 634 return; |
| 614 case 1: { | 635 case 1: { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 void RenderProcessHostImpl::EnableSendQueue() { | 694 void RenderProcessHostImpl::EnableSendQueue() { |
| 674 is_initialized_ = false; | 695 is_initialized_ = false; |
| 675 } | 696 } |
| 676 | 697 |
| 677 bool RenderProcessHostImpl::Init() { | 698 bool RenderProcessHostImpl::Init() { |
| 678 // calling Init() more than once does nothing, this makes it more convenient | 699 // calling Init() more than once does nothing, this makes it more convenient |
| 679 // for the view host which may not be sure in some cases | 700 // for the view host which may not be sure in some cases |
| 680 if (channel_) | 701 if (channel_) |
| 681 return true; | 702 return true; |
| 682 | 703 |
| 683 shell::Connector* connector = | |
| 684 BrowserContext::GetShellConnectorFor(browser_context_); | |
| 685 // Some embedders may not initialize Mojo or the shell connector for a browser | |
| 686 // context (e.g. Android WebView)... so just fall back to the per-process | |
| 687 // connector. | |
| 688 if (!connector) | |
| 689 connector = MojoShellConnection::GetForProcess()->GetConnector(); | |
| 690 mojo_child_connection_.reset(new MojoChildConnection( | |
| 691 kRendererMojoApplicationName, | |
| 692 base::StringPrintf("%d_%d", id_, instance_id_++), | |
| 693 child_token_, | |
| 694 connector)); | |
| 695 | |
| 696 base::CommandLine::StringType renderer_prefix; | 704 base::CommandLine::StringType renderer_prefix; |
| 697 // A command prefix is something prepended to the command line of the spawned | 705 // A command prefix is something prepended to the command line of the spawned |
| 698 // process. | 706 // process. |
| 699 const base::CommandLine& browser_command_line = | 707 const base::CommandLine& browser_command_line = |
| 700 *base::CommandLine::ForCurrentProcess(); | 708 *base::CommandLine::ForCurrentProcess(); |
| 701 renderer_prefix = | 709 renderer_prefix = |
| 702 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); | 710 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); |
| 703 | 711 |
| 704 #if defined(OS_LINUX) | 712 #if defined(OS_LINUX) |
| 705 int flags = renderer_prefix.empty() ? ChildProcessHost::CHILD_ALLOW_SELF | 713 int flags = renderer_prefix.empty() ? ChildProcessHost::CHILD_ALLOW_SELF |
| (...skipping 28 matching lines...) Expand all Loading... |
| 734 // messages flow between the browser and renderer, this thread is required | 742 // messages flow between the browser and renderer, this thread is required |
| 735 // to prevent a deadlock in single-process mode. Since the primordial | 743 // to prevent a deadlock in single-process mode. Since the primordial |
| 736 // thread in the renderer process runs the WebKit code and can sometimes | 744 // thread in the renderer process runs the WebKit code and can sometimes |
| 737 // make blocking calls to the UI thread (i.e. this thread), they need to run | 745 // make blocking calls to the UI thread (i.e. this thread), they need to run |
| 738 // on separate threads. | 746 // on separate threads. |
| 739 in_process_renderer_.reset( | 747 in_process_renderer_.reset( |
| 740 g_renderer_main_thread_factory(InProcessChildThreadParams( | 748 g_renderer_main_thread_factory(InProcessChildThreadParams( |
| 741 channel_id, | 749 channel_id, |
| 742 BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO) | 750 BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO) |
| 743 ->task_runner(), | 751 ->task_runner(), |
| 744 mojo_channel_token_, mojo_application_host_->GetToken()))); | 752 mojo_channel_token_, |
| 753 mojo_child_connection_->shell_client_token()))); |
| 745 | 754 |
| 746 base::Thread::Options options; | 755 base::Thread::Options options; |
| 747 #if defined(OS_WIN) && !defined(OS_MACOSX) | 756 #if defined(OS_WIN) && !defined(OS_MACOSX) |
| 748 // In-process plugins require this to be a UI message loop. | 757 // In-process plugins require this to be a UI message loop. |
| 749 options.message_loop_type = base::MessageLoop::TYPE_UI; | 758 options.message_loop_type = base::MessageLoop::TYPE_UI; |
| 750 #else | 759 #else |
| 751 // We can't have multiple UI loops on Linux and Android, so we don't support | 760 // We can't have multiple UI loops on Linux and Android, so we don't support |
| 752 // in-process plugins. | 761 // in-process plugins. |
| 753 options.message_loop_type = base::MessageLoop::TYPE_DEFAULT; | 762 options.message_loop_type = base::MessageLoop::TYPE_DEFAULT; |
| 754 #endif | 763 #endif |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 GetInterfaceRegistry()->AddInterface( | 1061 GetInterfaceRegistry()->AddInterface( |
| 1053 base::Bind(&RenderProcessHostImpl::CreateStoragePartitionService, | 1062 base::Bind(&RenderProcessHostImpl::CreateStoragePartitionService, |
| 1054 base::Unretained(this))); | 1063 base::Unretained(this))); |
| 1055 | 1064 |
| 1056 GetInterfaceRegistry()->AddInterface( | 1065 GetInterfaceRegistry()->AddInterface( |
| 1057 base::Bind(&MimeRegistryImpl::Create), | 1066 base::Bind(&MimeRegistryImpl::Create), |
| 1058 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | 1067 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); |
| 1059 | 1068 |
| 1060 #if defined(OS_ANDROID) | 1069 #if defined(OS_ANDROID) |
| 1061 ServiceRegistrarAndroid::RegisterProcessHostServices( | 1070 ServiceRegistrarAndroid::RegisterProcessHostServices( |
| 1062 mojo_application_host_->service_registry_android()); | 1071 mojo_child_connection_->service_registry_android()); |
| 1063 #endif | 1072 #endif |
| 1064 | 1073 |
| 1065 GetContentClient()->browser()->ExposeInterfacesToRenderer( | 1074 GetContentClient()->browser()->ExposeInterfacesToRenderer( |
| 1066 mojo_application_host_->interface_registry(), this); | 1075 GetInterfaceRegistry(), this); |
| 1067 } | 1076 } |
| 1068 | 1077 |
| 1069 void RenderProcessHostImpl::CreateStoragePartitionService( | 1078 void RenderProcessHostImpl::CreateStoragePartitionService( |
| 1070 mojo::InterfaceRequest<mojom::StoragePartitionService> request) { | 1079 mojo::InterfaceRequest<mojom::StoragePartitionService> request) { |
| 1071 // DO NOT REMOVE THIS COMMAND LINE CHECK WITHOUT SECURITY REVIEW! | 1080 // DO NOT REMOVE THIS COMMAND LINE CHECK WITHOUT SECURITY REVIEW! |
| 1072 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1081 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1073 switches::kMojoLocalStorage)) { | 1082 switches::kMojoLocalStorage)) { |
| 1074 storage_partition_impl_->Bind(std::move(request)); | 1083 storage_partition_impl_->Bind(std::move(request)); |
| 1075 } | 1084 } |
| 1076 } | 1085 } |
| 1077 | 1086 |
| 1078 int RenderProcessHostImpl::GetNextRoutingID() { | 1087 int RenderProcessHostImpl::GetNextRoutingID() { |
| 1079 return widget_helper_->GetNextRoutingID(); | 1088 return widget_helper_->GetNextRoutingID(); |
| 1080 } | 1089 } |
| 1081 | 1090 |
| 1082 void RenderProcessHostImpl::ResumeDeferredNavigation( | 1091 void RenderProcessHostImpl::ResumeDeferredNavigation( |
| 1083 const GlobalRequestID& request_id) { | 1092 const GlobalRequestID& request_id) { |
| 1084 widget_helper_->ResumeDeferredNavigation(request_id); | 1093 widget_helper_->ResumeDeferredNavigation(request_id); |
| 1085 } | 1094 } |
| 1086 | 1095 |
| 1087 void RenderProcessHostImpl::NotifyTimezoneChange(const std::string& zone_id) { | 1096 void RenderProcessHostImpl::NotifyTimezoneChange(const std::string& zone_id) { |
| 1088 Send(new ViewMsg_TimezoneChange(zone_id)); | 1097 Send(new ViewMsg_TimezoneChange(zone_id)); |
| 1089 } | 1098 } |
| 1090 | 1099 |
| 1091 shell::InterfaceRegistry* RenderProcessHostImpl::GetInterfaceRegistry() { | 1100 shell::InterfaceRegistry* RenderProcessHostImpl::GetInterfaceRegistry() { |
| 1092 DCHECK(mojo_application_host_); | 1101 return GetChildConnection()->GetInterfaceRegistry(); |
| 1093 return mojo_application_host_->interface_registry(); | |
| 1094 } | 1102 } |
| 1095 | 1103 |
| 1096 shell::InterfaceProvider* RenderProcessHostImpl::GetRemoteInterfaces() { | 1104 shell::InterfaceProvider* RenderProcessHostImpl::GetRemoteInterfaces() { |
| 1097 DCHECK(mojo_application_host_); | 1105 return GetChildConnection()->GetRemoteInterfaces(); |
| 1098 return mojo_application_host_->remote_interfaces(); | |
| 1099 } | 1106 } |
| 1100 | 1107 |
| 1101 shell::Connection* RenderProcessHostImpl::GetChildConnection() { | 1108 shell::Connection* RenderProcessHostImpl::GetChildConnection() { |
| 1102 DCHECK(mojo_child_connection_); | 1109 DCHECK(mojo_child_connection_); |
| 1103 return mojo_child_connection_->connection(); | 1110 return mojo_child_connection_->connection(); |
| 1104 } | 1111 } |
| 1105 | 1112 |
| 1106 std::unique_ptr<base::SharedPersistentMemoryAllocator> | 1113 std::unique_ptr<base::SharedPersistentMemoryAllocator> |
| 1107 RenderProcessHostImpl::TakeMetricsAllocator() { | 1114 RenderProcessHostImpl::TakeMetricsAllocator() { |
| 1108 return std::move(metrics_allocator_); | 1115 return std::move(metrics_allocator_); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1329 base::DoubleToString(display::win::GetDPIScale())); | 1336 base::DoubleToString(display::win::GetDPIScale())); |
| 1330 #endif | 1337 #endif |
| 1331 | 1338 |
| 1332 AppendCompositorCommandLineFlags(command_line); | 1339 AppendCompositorCommandLineFlags(command_line); |
| 1333 | 1340 |
| 1334 if (!mojo_channel_token_.empty()) { | 1341 if (!mojo_channel_token_.empty()) { |
| 1335 command_line->AppendSwitchASCII(switches::kMojoChannelToken, | 1342 command_line->AppendSwitchASCII(switches::kMojoChannelToken, |
| 1336 mojo_channel_token_); | 1343 mojo_channel_token_); |
| 1337 } | 1344 } |
| 1338 command_line->AppendSwitchASCII(switches::kMojoApplicationChannelToken, | 1345 command_line->AppendSwitchASCII(switches::kMojoApplicationChannelToken, |
| 1339 mojo_application_host_->GetToken()); | 1346 mojo_child_connection_->shell_client_token()); |
| 1340 } | 1347 } |
| 1341 | 1348 |
| 1342 void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( | 1349 void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( |
| 1343 const base::CommandLine& browser_cmd, | 1350 const base::CommandLine& browser_cmd, |
| 1344 base::CommandLine* renderer_cmd) const { | 1351 base::CommandLine* renderer_cmd) const { |
| 1345 // Propagate the following switches to the renderer command line (along | 1352 // Propagate the following switches to the renderer command line (along |
| 1346 // with any associated values) if present in the browser command line. | 1353 // with any associated values) if present in the browser command line. |
| 1347 static const char* const kSwitchNames[] = { | 1354 static const char* const kSwitchNames[] = { |
| 1348 switches::kAgcStartupMinVolume, | 1355 switches::kAgcStartupMinVolume, |
| 1349 switches::kAecRefinedAdaptiveFilter, | 1356 switches::kAecRefinedAdaptiveFilter, |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1911 // rest of the objects attached to this RenderProcessHost start going | 1918 // rest of the objects attached to this RenderProcessHost start going |
| 1912 // away first, since deleting the channel proxy will post a | 1919 // away first, since deleting the channel proxy will post a |
| 1913 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread. | 1920 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread. |
| 1914 channel_.reset(); | 1921 channel_.reset(); |
| 1915 | 1922 |
| 1916 // The following members should be cleared in ProcessDied() as well! | 1923 // The following members should be cleared in ProcessDied() as well! |
| 1917 message_port_message_filter_ = NULL; | 1924 message_port_message_filter_ = NULL; |
| 1918 | 1925 |
| 1919 RemoveUserData(kSessionStorageHolderKey); | 1926 RemoveUserData(kSessionStorageHolderKey); |
| 1920 | 1927 |
| 1921 // On shutdown, |this| may not be deleted because the deleter is posted to | |
| 1922 // the current MessageLoop, but MessageLoop deletes all its pending | |
| 1923 // callbacks on shutdown. Since the deleter takes |this| as a raw pointer, | |
| 1924 // deleting the callback doesn't delete |this| resulting in a memory leak. | |
| 1925 // Valgrind complains, so delete |mojo_application_host_| explicitly here to | |
| 1926 // stop valgrind from complaining. | |
| 1927 mojo_application_host_.reset(); | |
| 1928 | |
| 1929 // Remove ourself from the list of renderer processes so that we can't be | 1928 // Remove ourself from the list of renderer processes so that we can't be |
| 1930 // reused in between now and when the Delete task runs. | 1929 // reused in between now and when the Delete task runs. |
| 1931 UnregisterHost(GetID()); | 1930 UnregisterHost(GetID()); |
| 1932 } | 1931 } |
| 1933 } | 1932 } |
| 1934 | 1933 |
| 1935 void RenderProcessHostImpl::AddPendingView() { | 1934 void RenderProcessHostImpl::AddPendingView() { |
| 1936 pending_views_++; | 1935 pending_views_++; |
| 1937 } | 1936 } |
| 1938 | 1937 |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2415 delete queued_messages_.front(); | 2414 delete queued_messages_.front(); |
| 2416 queued_messages_.pop(); | 2415 queued_messages_.pop(); |
| 2417 } | 2416 } |
| 2418 UpdateProcessPriority(); | 2417 UpdateProcessPriority(); |
| 2419 DCHECK(!is_process_backgrounded_); | 2418 DCHECK(!is_process_backgrounded_); |
| 2420 | 2419 |
| 2421 // RenderProcessExited observers and RenderProcessGone handlers might | 2420 // RenderProcessExited observers and RenderProcessGone handlers might |
| 2422 // navigate or perform other actions that require a connection. Ensure that | 2421 // navigate or perform other actions that require a connection. Ensure that |
| 2423 // there is one before calling them. | 2422 // there is one before calling them. |
| 2424 child_token_ = mojo::edk::GenerateRandomToken(); | 2423 child_token_ = mojo::edk::GenerateRandomToken(); |
| 2425 mojo_application_host_.reset(new MojoApplicationHost(child_token_)); | 2424 shell::Connector* connector = |
| 2425 BrowserContext::GetShellConnectorFor(browser_context_); |
| 2426 if (!connector) |
| 2427 connector = MojoShellConnection::GetForProcess()->GetConnector(); |
| 2428 mojo_child_connection_.reset(new MojoChildConnection( |
| 2429 kRendererMojoApplicationName, |
| 2430 base::StringPrintf("%d_%d", id_, instance_id_++), |
| 2431 child_token_, |
| 2432 connector)); |
| 2426 | 2433 |
| 2427 within_process_died_observer_ = true; | 2434 within_process_died_observer_ = true; |
| 2428 NotificationService::current()->Notify( | 2435 NotificationService::current()->Notify( |
| 2429 NOTIFICATION_RENDERER_PROCESS_CLOSED, Source<RenderProcessHost>(this), | 2436 NOTIFICATION_RENDERER_PROCESS_CLOSED, Source<RenderProcessHost>(this), |
| 2430 Details<RendererClosedDetails>(&details)); | 2437 Details<RendererClosedDetails>(&details)); |
| 2431 FOR_EACH_OBSERVER(RenderProcessHostObserver, observers_, | 2438 FOR_EACH_OBSERVER(RenderProcessHostObserver, observers_, |
| 2432 RenderProcessExited(this, status, exit_code)); | 2439 RenderProcessExited(this, status, exit_code)); |
| 2433 within_process_died_observer_ = false; | 2440 within_process_died_observer_ = false; |
| 2434 | 2441 |
| 2435 message_port_message_filter_ = NULL; | 2442 message_port_message_filter_ = NULL; |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2819 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 2826 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
| 2820 | 2827 |
| 2821 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias | 2828 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias |
| 2822 // enough information here so that we can determine what the bad message was. | 2829 // enough information here so that we can determine what the bad message was. |
| 2823 base::debug::Alias(&error); | 2830 base::debug::Alias(&error); |
| 2824 bad_message::ReceivedBadMessage(process.get(), | 2831 bad_message::ReceivedBadMessage(process.get(), |
| 2825 bad_message::RPH_MOJO_PROCESS_ERROR); | 2832 bad_message::RPH_MOJO_PROCESS_ERROR); |
| 2826 } | 2833 } |
| 2827 | 2834 |
| 2828 } // namespace content | 2835 } // namespace content |
| OLD | NEW |