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

Side by Side Diff: content/renderer/renderer_blink_platform_impl.cc

Issue 2643063002: Refactor Blink's ServiceConnector and add ability to mock in layout tests (Closed)
Patch Set: Fix build Created 3 years, 9 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
« no previous file with comments | « content/renderer/renderer_blink_platform_impl.h ('k') | content/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "content/renderer/renderer_blink_platform_impl.h" 5 #include "content/renderer/renderer_blink_platform_impl.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 24 matching lines...) Expand all
35 #include "content/child/storage_util.h" 35 #include "content/child/storage_util.h"
36 #include "content/child/thread_safe_sender.h" 36 #include "content/child/thread_safe_sender.h"
37 #include "content/child/web_database_observer_impl.h" 37 #include "content/child/web_database_observer_impl.h"
38 #include "content/child/web_url_loader_impl.h" 38 #include "content/child/web_url_loader_impl.h"
39 #include "content/child/webfileutilities_impl.h" 39 #include "content/child/webfileutilities_impl.h"
40 #include "content/child/webmessageportchannel_impl.h" 40 #include "content/child/webmessageportchannel_impl.h"
41 #include "content/common/file_utilities_messages.h" 41 #include "content/common/file_utilities_messages.h"
42 #include "content/common/frame_messages.h" 42 #include "content/common/frame_messages.h"
43 #include "content/common/render_process_messages.h" 43 #include "content/common/render_process_messages.h"
44 #include "content/public/common/content_switches.h" 44 #include "content/public/common/content_switches.h"
45 #include "content/public/common/service_manager_connection.h"
45 #include "content/public/common/webplugininfo.h" 46 #include "content/public/common/webplugininfo.h"
46 #include "content/public/renderer/content_renderer_client.h" 47 #include "content/public/renderer/content_renderer_client.h"
47 #include "content/public/renderer/media_stream_utils.h" 48 #include "content/public/renderer/media_stream_utils.h"
48 #include "content/public/renderer/render_frame.h" 49 #include "content/public/renderer/render_frame.h"
49 #include "content/renderer/cache_storage/webserviceworkercachestorage_impl.h" 50 #include "content/renderer/cache_storage/webserviceworkercachestorage_impl.h"
50 #include "content/renderer/device_sensors/device_light_event_pump.h" 51 #include "content/renderer/device_sensors/device_light_event_pump.h"
51 #include "content/renderer/device_sensors/device_motion_event_pump.h" 52 #include "content/renderer/device_sensors/device_motion_event_pump.h"
52 #include "content/renderer/device_sensors/device_orientation_event_pump.h" 53 #include "content/renderer/device_sensors/device_orientation_event_pump.h"
53 #include "content/renderer/dom_storage/local_storage_cached_areas.h" 54 #include "content/renderer/dom_storage/local_storage_cached_areas.h"
54 #include "content/renderer/dom_storage/local_storage_namespace.h" 55 #include "content/renderer/dom_storage/local_storage_namespace.h"
(...skipping 16 matching lines...) Expand all
71 #include "content/renderer/webpublicsuffixlist_impl.h" 72 #include "content/renderer/webpublicsuffixlist_impl.h"
72 #include "gpu/command_buffer/client/gles2_interface.h" 73 #include "gpu/command_buffer/client/gles2_interface.h"
73 #include "gpu/config/gpu_info.h" 74 #include "gpu/config/gpu_info.h"
74 #include "gpu/ipc/client/gpu_channel_host.h" 75 #include "gpu/ipc/client/gpu_channel_host.h"
75 #include "gpu/ipc/common/gpu_stream_constants.h" 76 #include "gpu/ipc/common/gpu_stream_constants.h"
76 #include "ipc/ipc_sync_message_filter.h" 77 #include "ipc/ipc_sync_message_filter.h"
77 #include "media/audio/audio_output_device.h" 78 #include "media/audio/audio_output_device.h"
78 #include "media/blink/webcontentdecryptionmodule_impl.h" 79 #include "media/blink/webcontentdecryptionmodule_impl.h"
79 #include "media/filters/stream_parser_factory.h" 80 #include "media/filters/stream_parser_factory.h"
80 #include "ppapi/features/features.h" 81 #include "ppapi/features/features.h"
82 #include "services/service_manager/public/cpp/connector.h"
81 #include "services/service_manager/public/cpp/interface_provider.h" 83 #include "services/service_manager/public/cpp/interface_provider.h"
82 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" 84 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h"
83 #include "storage/common/database/database_identifier.h" 85 #include "storage/common/database/database_identifier.h"
84 #include "storage/common/quota/quota_types.h" 86 #include "storage/common/quota/quota_types.h"
85 #include "third_party/WebKit/public/platform/BlameContext.h" 87 #include "third_party/WebKit/public/platform/BlameContext.h"
86 #include "third_party/WebKit/public/platform/FilePathConversion.h" 88 #include "third_party/WebKit/public/platform/FilePathConversion.h"
87 #include "third_party/WebKit/public/platform/URLConversion.h" 89 #include "third_party/WebKit/public/platform/URLConversion.h"
88 #include "third_party/WebKit/public/platform/WebAudioLatencyHint.h" 90 #include "third_party/WebKit/public/platform/WebAudioLatencyHint.h"
89 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" 91 #include "third_party/WebKit/public/platform/WebBlobRegistry.h"
90 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" 92 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 : BlinkPlatformImpl(renderer_scheduler->DefaultTaskRunner()), 244 : BlinkPlatformImpl(renderer_scheduler->DefaultTaskRunner()),
243 main_thread_(renderer_scheduler->CreateMainThread()), 245 main_thread_(renderer_scheduler->CreateMainThread()),
244 clipboard_delegate_(new RendererClipboardDelegate), 246 clipboard_delegate_(new RendererClipboardDelegate),
245 clipboard_(new WebClipboardImpl(clipboard_delegate_.get())), 247 clipboard_(new WebClipboardImpl(clipboard_delegate_.get())),
246 sudden_termination_disables_(0), 248 sudden_termination_disables_(0),
247 plugin_refresh_allowed_(true), 249 plugin_refresh_allowed_(true),
248 default_task_runner_(renderer_scheduler->DefaultTaskRunner()), 250 default_task_runner_(renderer_scheduler->DefaultTaskRunner()),
249 loading_task_runner_(renderer_scheduler->LoadingTaskRunner()), 251 loading_task_runner_(renderer_scheduler->LoadingTaskRunner()),
250 web_scrollbar_behavior_(new WebScrollbarBehaviorImpl), 252 web_scrollbar_behavior_(new WebScrollbarBehaviorImpl),
251 renderer_scheduler_(renderer_scheduler), 253 renderer_scheduler_(renderer_scheduler),
254 blink_connector_(new BlinkConnectorImpl(nullptr)),
252 blink_interface_provider_(new BlinkInterfaceProviderImpl(connector)) { 255 blink_interface_provider_(new BlinkInterfaceProviderImpl(connector)) {
253 #if !defined(OS_ANDROID) && !defined(OS_WIN) 256 #if !defined(OS_ANDROID) && !defined(OS_WIN)
254 if (g_sandbox_enabled && sandboxEnabled()) { 257 if (g_sandbox_enabled && sandboxEnabled()) {
255 sandbox_support_.reset(new RendererBlinkPlatformImpl::SandboxSupport); 258 sandbox_support_.reset(new RendererBlinkPlatformImpl::SandboxSupport);
256 } else { 259 } else {
257 DVLOG(1) << "Disabling sandbox support for testing."; 260 DVLOG(1) << "Disabling sandbox support for testing.";
258 } 261 }
259 #endif 262 #endif
260 263
261 // RenderThread may not exist in some tests. 264 // RenderThread may not exist in some tests.
262 if (RenderThreadImpl::current()) { 265 if (RenderThreadImpl::current()) {
266 blink_connector_->SetConnector(RenderThreadImpl::current()
267 ->GetServiceManagerConnection()
268 ->GetConnector()
269 ->Clone());
263 sync_message_filter_ = RenderThreadImpl::current()->sync_message_filter(); 270 sync_message_filter_ = RenderThreadImpl::current()->sync_message_filter();
264 thread_safe_sender_ = RenderThreadImpl::current()->thread_safe_sender(); 271 thread_safe_sender_ = RenderThreadImpl::current()->thread_safe_sender();
265 quota_message_filter_ = RenderThreadImpl::current()->quota_message_filter(); 272 quota_message_filter_ = RenderThreadImpl::current()->quota_message_filter();
266 shared_bitmap_manager_ = 273 shared_bitmap_manager_ =
267 RenderThreadImpl::current()->shared_bitmap_manager(); 274 RenderThreadImpl::current()->shared_bitmap_manager();
268 blob_registry_.reset(new WebBlobRegistryImpl( 275 blob_registry_.reset(new WebBlobRegistryImpl(
269 RenderThreadImpl::current()->GetIOTaskRunner().get(), 276 RenderThreadImpl::current()->GetIOTaskRunner().get(),
270 base::ThreadTaskRunnerHandle::Get(), thread_safe_sender_.get())); 277 base::ThreadTaskRunnerHandle::Get(), thread_safe_sender_.get()));
271 web_idb_factory_.reset(new WebIDBFactoryImpl( 278 web_idb_factory_.reset(new WebIDBFactoryImpl(
272 sync_message_filter_, 279 sync_message_filter_,
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 } 1151 }
1145 1152
1146 void RendererBlinkPlatformImpl::SetPlatformEventObserverForTesting( 1153 void RendererBlinkPlatformImpl::SetPlatformEventObserverForTesting(
1147 blink::WebPlatformEventType type, 1154 blink::WebPlatformEventType type,
1148 std::unique_ptr<PlatformEventObserverBase> observer) { 1155 std::unique_ptr<PlatformEventObserverBase> observer) {
1149 if (platform_event_observers_.Lookup(type)) 1156 if (platform_event_observers_.Lookup(type))
1150 platform_event_observers_.Remove(type); 1157 platform_event_observers_.Remove(type);
1151 platform_event_observers_.AddWithID(std::move(observer), type); 1158 platform_event_observers_.AddWithID(std::move(observer), type);
1152 } 1159 }
1153 1160
1161 BlinkConnectorImpl* RendererBlinkPlatformImpl::connector() {
1162 return blink_connector_.get();
1163 }
1164
1154 blink::InterfaceProvider* RendererBlinkPlatformImpl::interfaceProvider() { 1165 blink::InterfaceProvider* RendererBlinkPlatformImpl::interfaceProvider() {
1155 return blink_interface_provider_.get(); 1166 return blink_interface_provider_.get();
1156 } 1167 }
1157 1168
1158 void RendererBlinkPlatformImpl::startListening( 1169 void RendererBlinkPlatformImpl::startListening(
1159 blink::WebPlatformEventType type, 1170 blink::WebPlatformEventType type,
1160 blink::WebPlatformEventListener* listener) { 1171 blink::WebPlatformEventListener* listener) {
1161 PlatformEventObserverBase* observer = platform_event_observers_.Lookup(type); 1172 PlatformEventObserverBase* observer = platform_event_observers_.Lookup(type);
1162 if (!observer) { 1173 if (!observer) {
1163 std::unique_ptr<PlatformEventObserverBase> new_observer = 1174 std::unique_ptr<PlatformEventObserverBase> new_observer =
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 //------------------------------------------------------------------------------ 1269 //------------------------------------------------------------------------------
1259 void RendererBlinkPlatformImpl::requestPurgeMemory() { 1270 void RendererBlinkPlatformImpl::requestPurgeMemory() {
1260 // TODO(tasak|bashi): We should use ChildMemoryCoordinator here, but 1271 // TODO(tasak|bashi): We should use ChildMemoryCoordinator here, but
1261 // ChildMemoryCoordinator isn't always available as it's only initialized 1272 // ChildMemoryCoordinator isn't always available as it's only initialized
1262 // when kMemoryCoordinatorV0 is enabled. 1273 // when kMemoryCoordinatorV0 is enabled.
1263 // Use ChildMemoryCoordinator when memory coordinator is always enabled. 1274 // Use ChildMemoryCoordinator when memory coordinator is always enabled.
1264 base::MemoryCoordinatorClientRegistry::GetInstance()->PurgeMemory(); 1275 base::MemoryCoordinatorClientRegistry::GetInstance()->PurgeMemory();
1265 } 1276 }
1266 1277
1267 } // namespace content 1278 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/renderer_blink_platform_impl.h ('k') | content/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698