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