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

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

Issue 2580693003: Decouple GamepadSharedMemory into Blink.
Patch Set: Created 4 years 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 (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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "content/public/renderer/content_renderer_client.h" 47 #include "content/public/renderer/content_renderer_client.h"
48 #include "content/public/renderer/media_stream_utils.h" 48 #include "content/public/renderer/media_stream_utils.h"
49 #include "content/public/renderer/render_frame.h" 49 #include "content/public/renderer/render_frame.h"
50 #include "content/renderer/cache_storage/webserviceworkercachestorage_impl.h" 50 #include "content/renderer/cache_storage/webserviceworkercachestorage_impl.h"
51 #include "content/renderer/device_sensors/device_light_event_pump.h" 51 #include "content/renderer/device_sensors/device_light_event_pump.h"
52 #include "content/renderer/device_sensors/device_motion_event_pump.h" 52 #include "content/renderer/device_sensors/device_motion_event_pump.h"
53 #include "content/renderer/device_sensors/device_orientation_event_pump.h" 53 #include "content/renderer/device_sensors/device_orientation_event_pump.h"
54 #include "content/renderer/dom_storage/local_storage_cached_areas.h" 54 #include "content/renderer/dom_storage/local_storage_cached_areas.h"
55 #include "content/renderer/dom_storage/local_storage_namespace.h" 55 #include "content/renderer/dom_storage/local_storage_namespace.h"
56 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" 56 #include "content/renderer/dom_storage/webstoragenamespace_impl.h"
57 #include "content/renderer/gamepad_shared_memory_reader.h"
58 #include "content/renderer/media/audio_decoder.h" 57 #include "content/renderer/media/audio_decoder.h"
59 #include "content/renderer/media/audio_device_factory.h" 58 #include "content/renderer/media/audio_device_factory.h"
60 #include "content/renderer/media/canvas_capture_handler.h" 59 #include "content/renderer/media/canvas_capture_handler.h"
61 #include "content/renderer/media/html_audio_element_capturer_source.h" 60 #include "content/renderer/media/html_audio_element_capturer_source.h"
62 #include "content/renderer/media/html_video_element_capturer_source.h" 61 #include "content/renderer/media/html_video_element_capturer_source.h"
63 #include "content/renderer/media/image_capture_frame_grabber.h" 62 #include "content/renderer/media/image_capture_frame_grabber.h"
64 #include "content/renderer/media/media_recorder_handler.h" 63 #include "content/renderer/media/media_recorder_handler.h"
65 #include "content/renderer/media/renderer_webaudiodevice_impl.h" 64 #include "content/renderer/media/renderer_webaudiodevice_impl.h"
66 #include "content/renderer/media/renderer_webmidiaccessor_impl.h" 65 #include "content/renderer/media/renderer_webmidiaccessor_impl.h"
67 #include "content/renderer/mojo/blink_interface_provider_impl.h" 66 #include "content/renderer/mojo/blink_interface_provider_impl.h"
(...skipping 16 matching lines...) Expand all
84 #include "ppapi/features/features.h" 83 #include "ppapi/features/features.h"
85 #include "services/service_manager/public/cpp/interface_provider.h" 84 #include "services/service_manager/public/cpp/interface_provider.h"
86 #include "storage/common/database/database_identifier.h" 85 #include "storage/common/database/database_identifier.h"
87 #include "storage/common/quota/quota_types.h" 86 #include "storage/common/quota/quota_types.h"
88 #include "third_party/WebKit/public/platform/BlameContext.h" 87 #include "third_party/WebKit/public/platform/BlameContext.h"
89 #include "third_party/WebKit/public/platform/FilePathConversion.h" 88 #include "third_party/WebKit/public/platform/FilePathConversion.h"
90 #include "third_party/WebKit/public/platform/URLConversion.h" 89 #include "third_party/WebKit/public/platform/URLConversion.h"
91 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" 90 #include "third_party/WebKit/public/platform/WebBlobRegistry.h"
92 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" 91 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h"
93 #include "third_party/WebKit/public/platform/WebFileInfo.h" 92 #include "third_party/WebKit/public/platform/WebFileInfo.h"
94 #include "third_party/WebKit/public/platform/WebGamepads.h"
95 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" 93 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h"
96 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" 94 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h"
97 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" 95 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h"
98 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 96 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
99 #include "third_party/WebKit/public/platform/WebURL.h" 97 #include "third_party/WebKit/public/platform/WebURL.h"
100 #include "third_party/WebKit/public/platform/WebVector.h" 98 #include "third_party/WebKit/public/platform/WebVector.h"
101 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eMotionListener.h" 99 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eMotionListener.h"
102 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eOrientationListener.h" 100 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eOrientationListener.h"
103 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul er.h" 101 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul er.h"
104 #include "third_party/WebKit/public/web/WebLocalFrame.h" 102 #include "third_party/WebKit/public/web/WebLocalFrame.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" 139 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h"
142 #endif 140 #endif
143 141
144 using blink::Platform; 142 using blink::Platform;
145 using blink::WebAudioDevice; 143 using blink::WebAudioDevice;
146 using blink::WebBlobRegistry; 144 using blink::WebBlobRegistry;
147 using blink::WebCanvasCaptureHandler; 145 using blink::WebCanvasCaptureHandler;
148 using blink::WebDatabaseObserver; 146 using blink::WebDatabaseObserver;
149 using blink::WebFileInfo; 147 using blink::WebFileInfo;
150 using blink::WebFileSystem; 148 using blink::WebFileSystem;
151 using blink::WebGamepad;
152 using blink::WebGamepads;
153 using blink::WebIDBFactory; 149 using blink::WebIDBFactory;
154 using blink::WebImageCaptureFrameGrabber; 150 using blink::WebImageCaptureFrameGrabber;
155 using blink::WebMIDIAccessor; 151 using blink::WebMIDIAccessor;
156 using blink::WebMediaPlayer; 152 using blink::WebMediaPlayer;
157 using blink::WebMediaRecorderHandler; 153 using blink::WebMediaRecorderHandler;
158 using blink::WebMediaStream; 154 using blink::WebMediaStream;
159 using blink::WebMediaStreamCenter; 155 using blink::WebMediaStreamCenter;
160 using blink::WebMediaStreamCenterClient; 156 using blink::WebMediaStreamCenterClient;
161 using blink::WebMediaStreamTrack; 157 using blink::WebMediaStreamTrack;
162 using blink::WebRTCPeerConnectionHandler; 158 using blink::WebRTCPeerConnectionHandler;
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 799
804 //------------------------------------------------------------------------------ 800 //------------------------------------------------------------------------------
805 801
806 WebBlobRegistry* RendererBlinkPlatformImpl::getBlobRegistry() { 802 WebBlobRegistry* RendererBlinkPlatformImpl::getBlobRegistry() {
807 // blob_registry_ can be NULL when running some tests. 803 // blob_registry_ can be NULL when running some tests.
808 return blob_registry_.get(); 804 return blob_registry_.get();
809 } 805 }
810 806
811 //------------------------------------------------------------------------------ 807 //------------------------------------------------------------------------------
812 808
813 void RendererBlinkPlatformImpl::sampleGamepads(WebGamepads& gamepads) {
ke.he 2016/12/15 14:35:56 Before decoupling, sampleGamepads() is defined in
814 PlatformEventObserverBase* observer =
815 platform_event_observers_.Lookup(blink::WebPlatformEventTypeGamepad);
816 if (!observer)
817 return;
818 static_cast<RendererGamepadProvider*>(observer)->SampleGamepads(gamepads);
819 }
820
821 //------------------------------------------------------------------------------
822
823 WebMediaRecorderHandler* 809 WebMediaRecorderHandler*
824 RendererBlinkPlatformImpl::createMediaRecorderHandler() { 810 RendererBlinkPlatformImpl::createMediaRecorderHandler() {
825 #if BUILDFLAG(ENABLE_WEBRTC) 811 #if BUILDFLAG(ENABLE_WEBRTC)
826 return new content::MediaRecorderHandler(); 812 return new content::MediaRecorderHandler();
827 #else 813 #else
828 return nullptr; 814 return nullptr;
829 #endif 815 #endif
830 } 816 }
831 817
832 //------------------------------------------------------------------------------ 818 //------------------------------------------------------------------------------
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 1159
1174 switch (type) { 1160 switch (type) {
1175 case blink::WebPlatformEventTypeDeviceMotion: 1161 case blink::WebPlatformEventTypeDeviceMotion:
1176 return base::MakeUnique<DeviceMotionEventPump>(thread); 1162 return base::MakeUnique<DeviceMotionEventPump>(thread);
1177 case blink::WebPlatformEventTypeDeviceOrientation: 1163 case blink::WebPlatformEventTypeDeviceOrientation:
1178 return base::MakeUnique<DeviceOrientationEventPump>(thread); 1164 return base::MakeUnique<DeviceOrientationEventPump>(thread);
1179 case blink::WebPlatformEventTypeDeviceOrientationAbsolute: 1165 case blink::WebPlatformEventTypeDeviceOrientationAbsolute:
1180 return base::MakeUnique<DeviceOrientationAbsoluteEventPump>(thread); 1166 return base::MakeUnique<DeviceOrientationAbsoluteEventPump>(thread);
1181 case blink::WebPlatformEventTypeDeviceLight: 1167 case blink::WebPlatformEventTypeDeviceLight:
1182 return base::MakeUnique<DeviceLightEventPump>(thread); 1168 return base::MakeUnique<DeviceLightEventPump>(thread);
1183 case blink::WebPlatformEventTypeGamepad:
1184 return base::MakeUnique<GamepadSharedMemoryReader>(thread);
1185 case blink::WebPlatformEventTypeScreenOrientation: 1169 case blink::WebPlatformEventTypeScreenOrientation:
1186 return base::MakeUnique<ScreenOrientationObserver>(); 1170 return base::MakeUnique<ScreenOrientationObserver>();
1187 default: 1171 default:
1188 // A default statement is required to prevent compilation errors when 1172 // A default statement is required to prevent compilation errors when
1189 // Blink adds a new type. 1173 // Blink adds a new type.
1190 DVLOG(1) << "RendererBlinkPlatformImpl::startListening() with " 1174 DVLOG(1) << "RendererBlinkPlatformImpl::startListening() with "
1191 "unknown type."; 1175 "unknown type.";
1192 } 1176 }
1193 1177
1194 return NULL; 1178 return NULL;
1195 } 1179 }
1196 1180
1197 void RendererBlinkPlatformImpl::SetPlatformEventObserverForTesting( 1181 void RendererBlinkPlatformImpl::SetPlatformEventObserverForTesting(
ke.he 2016/12/15 14:14:43 called by https://cs.chromium.org/chromium/src/con
1198 blink::WebPlatformEventType type, 1182 blink::WebPlatformEventType type,
1199 std::unique_ptr<PlatformEventObserverBase> observer) { 1183 std::unique_ptr<PlatformEventObserverBase> observer) {
1200 if (platform_event_observers_.Lookup(type)) 1184 if (platform_event_observers_.Lookup(type))
1201 platform_event_observers_.Remove(type); 1185 platform_event_observers_.Remove(type);
1202 platform_event_observers_.AddWithID(std::move(observer), type); 1186 platform_event_observers_.AddWithID(std::move(observer), type);
1203 } 1187 }
1204 1188
1205 blink::InterfaceProvider* RendererBlinkPlatformImpl::interfaceProvider() { 1189 blink::InterfaceProvider* RendererBlinkPlatformImpl::interfaceProvider() {
1206 return blink_interface_provider_.get(); 1190 return blink_interface_provider_.get();
1207 } 1191 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 return &trial_token_validator_; 1284 return &trial_token_validator_;
1301 } 1285 }
1302 1286
1303 void RendererBlinkPlatformImpl::workerContextCreated( 1287 void RendererBlinkPlatformImpl::workerContextCreated(
1304 const v8::Local<v8::Context>& worker) { 1288 const v8::Local<v8::Context>& worker) {
1305 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( 1289 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread(
1306 worker); 1290 worker);
1307 } 1291 }
1308 1292
1309 } // namespace content 1293 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698