Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 1963293002: Replacing Indexed DB Chromium IPC with Mojo Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactoring after Passing URLRequestContextGetter. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
11 #include <limits> 11 #include <limits>
12 #include <set>
12 #include <utility> 13 #include <utility>
13 #include <vector> 14 #include <vector>
14 15
15 #include "base/base_switches.h" 16 #include "base/base_switches.h"
16 #include "base/bind.h" 17 #include "base/bind.h"
17 #include "base/bind_helpers.h" 18 #include "base/bind_helpers.h"
18 #include "base/callback.h" 19 #include "base/callback.h"
19 #include "base/command_line.h" 20 #include "base/command_line.h"
20 #include "base/debug/dump_without_crashing.h" 21 #include "base/debug/dump_without_crashing.h"
21 #include "base/feature_list.h" 22 #include "base/feature_list.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" 67 #include "content/browser/dom_storage/dom_storage_context_wrapper.h"
67 #include "content/browser/dom_storage/dom_storage_message_filter.h" 68 #include "content/browser/dom_storage/dom_storage_message_filter.h"
68 #include "content/browser/fileapi/fileapi_message_filter.h" 69 #include "content/browser/fileapi/fileapi_message_filter.h"
69 #include "content/browser/frame_host/render_frame_message_filter.h" 70 #include "content/browser/frame_host/render_frame_message_filter.h"
70 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" 71 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
71 #include "content/browser/gpu/compositor_util.h" 72 #include "content/browser/gpu/compositor_util.h"
72 #include "content/browser/gpu/gpu_data_manager_impl.h" 73 #include "content/browser/gpu/gpu_data_manager_impl.h"
73 #include "content/browser/gpu/gpu_process_host.h" 74 #include "content/browser/gpu/gpu_process_host.h"
74 #include "content/browser/gpu/shader_disk_cache.h" 75 #include "content/browser/gpu/shader_disk_cache.h"
75 #include "content/browser/histogram_message_filter.h" 76 #include "content/browser/histogram_message_filter.h"
77 #include "content/browser/indexed_db/database_factory_impl.h"
78 #include "content/browser/indexed_db/database_impl.h"
76 #include "content/browser/indexed_db/indexed_db_context_impl.h" 79 #include "content/browser/indexed_db/indexed_db_context_impl.h"
77 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h"
78 #include "content/browser/loader/resource_message_filter.h" 80 #include "content/browser/loader/resource_message_filter.h"
79 #include "content/browser/loader/resource_scheduler_filter.h" 81 #include "content/browser/loader/resource_scheduler_filter.h"
80 #include "content/browser/loader/url_loader_factory_impl.h" 82 #include "content/browser/loader/url_loader_factory_impl.h"
81 #include "content/browser/media/capture/audio_mirroring_manager.h" 83 #include "content/browser/media/capture/audio_mirroring_manager.h"
82 #include "content/browser/media/capture/image_capture_impl.h" 84 #include "content/browser/media/capture/image_capture_impl.h"
83 #include "content/browser/media/media_internals.h" 85 #include "content/browser/media/media_internals.h"
84 #include "content/browser/media/midi_host.h" 86 #include "content/browser/media/midi_host.h"
85 #include "content/browser/memory/memory_message_filter.h" 87 #include "content/browser/memory/memory_message_filter.h"
86 #include "content/browser/message_port_message_filter.h" 88 #include "content/browser/message_port_message_filter.h"
87 #include "content/browser/mime_registry_impl.h" 89 #include "content/browser/mime_registry_impl.h"
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 channel_connected_(false), 617 channel_connected_(false),
616 sent_render_process_ready_(false), 618 sent_render_process_ready_(false),
617 #if defined(OS_ANDROID) 619 #if defined(OS_ANDROID)
618 never_signaled_(base::WaitableEvent::ResetPolicy::MANUAL, 620 never_signaled_(base::WaitableEvent::ResetPolicy::MANUAL,
619 base::WaitableEvent::InitialState::NOT_SIGNALED), 621 base::WaitableEvent::InitialState::NOT_SIGNALED),
620 #endif 622 #endif
621 weak_factory_(this) { 623 weak_factory_(this) {
622 widget_helper_ = new RenderWidgetHelper(); 624 widget_helper_ = new RenderWidgetHelper();
623 625
624 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); 626 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID());
627 database_factory_impl_ = new DatabaseFactoryImpl(
628 storage_partition_impl->GetIndexedDBContext(),
629 storage_partition_impl->GetURLRequestContext(), GetID());
625 630
626 CHECK(!BrowserMainRunner::ExitedMainMessageLoop()); 631 CHECK(!BrowserMainRunner::ExitedMainMessageLoop());
627 RegisterHost(GetID(), this); 632 RegisterHost(GetID(), this);
628 g_all_hosts.Get().set_check_on_null_data(true); 633 g_all_hosts.Get().set_check_on_null_data(true);
629 // Initialize |child_process_activity_time_| to a reasonable value. 634 // Initialize |child_process_activity_time_| to a reasonable value.
630 mark_child_process_activity_time(); 635 mark_child_process_activity_time();
631 636
632 if (!GetBrowserContext()->IsOffTheRecord() && 637 if (!GetBrowserContext()->IsOffTheRecord() &&
633 !base::CommandLine::ForCurrentProcess()->HasSwitch( 638 !base::CommandLine::ForCurrentProcess()->HasSwitch(
634 switches::kDisableGpuShaderDiskCache)) { 639 switches::kDisableGpuShaderDiskCache)) {
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 browser_context->GetResourceContext()->GetMediaDeviceIDSalt()); 997 browser_context->GetResourceContext()->GetMediaDeviceIDSalt());
993 AddFilter(audio_renderer_host_.get()); 998 AddFilter(audio_renderer_host_.get());
994 AddFilter( 999 AddFilter(
995 new MidiHost(GetID(), BrowserMainLoop::GetInstance()->midi_manager())); 1000 new MidiHost(GetID(), BrowserMainLoop::GetInstance()->midi_manager()));
996 AddFilter(new VideoCaptureHost(media_stream_manager)); 1001 AddFilter(new VideoCaptureHost(media_stream_manager));
997 AddFilter(new AppCacheDispatcherHost( 1002 AddFilter(new AppCacheDispatcherHost(
998 storage_partition_impl_->GetAppCacheService(), GetID())); 1003 storage_partition_impl_->GetAppCacheService(), GetID()));
999 AddFilter(new ClipboardMessageFilter(blob_storage_context)); 1004 AddFilter(new ClipboardMessageFilter(blob_storage_context));
1000 AddFilter(new DOMStorageMessageFilter( 1005 AddFilter(new DOMStorageMessageFilter(
1001 storage_partition_impl_->GetDOMStorageContext())); 1006 storage_partition_impl_->GetDOMStorageContext()));
1002 AddFilter(new IndexedDBDispatcherHost(
1003 GetID(), storage_partition_impl_->GetURLRequestContext(),
1004 storage_partition_impl_->GetIndexedDBContext(),
1005 blob_storage_context.get()));
1006 1007
1007 #if defined(ENABLE_WEBRTC) 1008 #if defined(ENABLE_WEBRTC)
1008 peer_connection_tracker_host_ = new PeerConnectionTrackerHost( 1009 peer_connection_tracker_host_ = new PeerConnectionTrackerHost(
1009 GetID(), webrtc_eventlog_host_.GetWeakPtr()); 1010 GetID(), webrtc_eventlog_host_.GetWeakPtr());
1010 AddFilter(peer_connection_tracker_host_.get()); 1011 AddFilter(peer_connection_tracker_host_.get());
1011 AddFilter(new MediaStreamDispatcherHost( 1012 AddFilter(new MediaStreamDispatcherHost(
1012 GetID(), browser_context->GetResourceContext()->GetMediaDeviceIDSalt(), 1013 GetID(), browser_context->GetResourceContext()->GetMediaDeviceIDSalt(),
1013 media_stream_manager)); 1014 media_stream_manager));
1014 AddFilter(new MediaStreamTrackMetricsHost()); 1015 AddFilter(new MediaStreamTrackMetricsHost());
1015 #endif 1016 #endif
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 registry->AddInterface(base::Bind(&DeviceOrientationAbsoluteHost::Create)); 1174 registry->AddInterface(base::Bind(&DeviceOrientationAbsoluteHost::Create));
1174 registry->AddInterface( 1175 registry->AddInterface(
1175 base::Bind(&URLLoaderFactoryImpl::Create, resource_message_filter_)); 1176 base::Bind(&URLLoaderFactoryImpl::Create, resource_message_filter_));
1176 1177
1177 // This is to support usage of WebSockets in cases in which there is no 1178 // This is to support usage of WebSockets in cases in which there is no
1178 // associated RenderFrame (e.g., Shared Workers). 1179 // associated RenderFrame (e.g., Shared Workers).
1179 registry->AddInterface( 1180 registry->AddInterface(
1180 base::Bind(&WebSocketManager::CreateWebSocket, GetID(), MSG_ROUTING_NONE), 1181 base::Bind(&WebSocketManager::CreateWebSocket, GetID(), MSG_ROUTING_NONE),
1181 ui_task_runner); 1182 ui_task_runner);
1182 1183
1184 registry->AddInterface(
1185 base::Bind(&RenderProcessHostImpl::CreateIndexedDBFactoryService,
1186 base::Unretained(this)),
1187 storage_partition_impl_->GetIndexedDBContext()->TaskRunner());
1188
1183 GetContentClient()->browser()->ExposeInterfacesToRenderer(registry.get(), 1189 GetContentClient()->browser()->ExposeInterfacesToRenderer(registry.get(),
1184 this); 1190 this);
1185 1191
1186 MojoShellConnection* mojo_shell_connection = 1192 MojoShellConnection* mojo_shell_connection =
1187 BrowserContext::GetMojoShellConnectionFor(browser_context_); 1193 BrowserContext::GetMojoShellConnectionFor(browser_context_);
1188 std::unique_ptr<ConnectionFilterImpl> connection_filter( 1194 std::unique_ptr<ConnectionFilterImpl> connection_filter(
1189 new ConnectionFilterImpl(mojo_child_connection_->child_identity(), 1195 new ConnectionFilterImpl(mojo_child_connection_->child_identity(),
1190 std::move(registry))); 1196 std::move(registry)));
1191 connection_filter_ = 1197 connection_filter_ =
1192 mojo_shell_connection->AddConnectionFilter(std::move(connection_filter)); 1198 mojo_shell_connection->AddConnectionFilter(std::move(connection_filter));
1193 } 1199 }
1194 1200
1201 void RenderProcessHostImpl::CreateIndexedDBFactoryService(
1202 mojo::InterfaceRequest<::indexed_db::mojom::DatabaseFactory> request) {
1203 database_factory_impl_->Bind(std::move(request));
1204 }
1205
1195 void RenderProcessHostImpl::CreateStoragePartitionService( 1206 void RenderProcessHostImpl::CreateStoragePartitionService(
1196 mojo::InterfaceRequest<mojom::StoragePartitionService> request) { 1207 mojo::InterfaceRequest<mojom::StoragePartitionService> request) {
1197 // DO NOT REMOVE THIS COMMAND LINE CHECK WITHOUT SECURITY REVIEW! 1208 // DO NOT REMOVE THIS COMMAND LINE CHECK WITHOUT SECURITY REVIEW!
1198 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1209 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1199 switches::kMojoLocalStorage)) { 1210 switches::kMojoLocalStorage)) {
1200 storage_partition_impl_->Bind(std::move(request)); 1211 storage_partition_impl_->Bind(std::move(request));
1201 } 1212 }
1202 } 1213 }
1203 1214
1204 int RenderProcessHostImpl::GetNextRoutingID() { 1215 int RenderProcessHostImpl::GetNextRoutingID() {
(...skipping 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after
2838 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; 2849 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error;
2839 2850
2840 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias 2851 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias
2841 // enough information here so that we can determine what the bad message was. 2852 // enough information here so that we can determine what the bad message was.
2842 base::debug::Alias(&error); 2853 base::debug::Alias(&error);
2843 bad_message::ReceivedBadMessage(process.get(), 2854 bad_message::ReceivedBadMessage(process.get(),
2844 bad_message::RPH_MOJO_PROCESS_ERROR); 2855 bad_message::RPH_MOJO_PROCESS_ERROR);
2845 } 2856 }
2846 2857
2847 } // namespace content 2858 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698