OLD | NEW |
---|---|
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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
53 #include "content/renderer/cache_storage/webserviceworkercachestorage_impl.h" | 53 #include "content/renderer/cache_storage/webserviceworkercachestorage_impl.h" |
54 #include "content/renderer/device_sensors/device_light_event_pump.h" | 54 #include "content/renderer/device_sensors/device_light_event_pump.h" |
55 #include "content/renderer/device_sensors/device_motion_event_pump.h" | 55 #include "content/renderer/device_sensors/device_motion_event_pump.h" |
56 #include "content/renderer/device_sensors/device_orientation_event_pump.h" | 56 #include "content/renderer/device_sensors/device_orientation_event_pump.h" |
57 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" | 57 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" |
58 #include "content/renderer/gamepad_shared_memory_reader.h" | 58 #include "content/renderer/gamepad_shared_memory_reader.h" |
59 #include "content/renderer/media/audio_decoder.h" | 59 #include "content/renderer/media/audio_decoder.h" |
60 #include "content/renderer/media/media_recorder_handler.h" | 60 #include "content/renderer/media/media_recorder_handler.h" |
61 #include "content/renderer/media/renderer_webaudiodevice_impl.h" | 61 #include "content/renderer/media/renderer_webaudiodevice_impl.h" |
62 #include "content/renderer/media/renderer_webmidiaccessor_impl.h" | 62 #include "content/renderer/media/renderer_webmidiaccessor_impl.h" |
63 #include "content/renderer/media/rtc_certificate_generator.h" | |
63 #include "content/renderer/render_thread_impl.h" | 64 #include "content/renderer/render_thread_impl.h" |
64 #include "content/renderer/renderer_clipboard_delegate.h" | 65 #include "content/renderer/renderer_clipboard_delegate.h" |
65 #include "content/renderer/screen_orientation/screen_orientation_observer.h" | 66 #include "content/renderer/screen_orientation/screen_orientation_observer.h" |
66 #include "content/renderer/webclipboard_impl.h" | 67 #include "content/renderer/webclipboard_impl.h" |
67 #include "content/renderer/webgraphicscontext3d_provider_impl.h" | 68 #include "content/renderer/webgraphicscontext3d_provider_impl.h" |
68 #include "content/renderer/webpublicsuffixlist_impl.h" | 69 #include "content/renderer/webpublicsuffixlist_impl.h" |
69 #include "gpu/config/gpu_info.h" | 70 #include "gpu/config/gpu_info.h" |
70 #include "ipc/ipc_sync_message_filter.h" | 71 #include "ipc/ipc_sync_message_filter.h" |
71 #include "media/audio/audio_output_device.h" | 72 #include "media/audio/audio_output_device.h" |
72 #include "media/base/audio_hardware_config.h" | 73 #include "media/base/audio_hardware_config.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
311 if (!file_utilities_) { | 312 if (!file_utilities_) { |
312 file_utilities_.reset(new FileUtilities(thread_safe_sender_.get())); | 313 file_utilities_.reset(new FileUtilities(thread_safe_sender_.get())); |
313 file_utilities_->set_sandbox_enabled(sandboxEnabled()); | 314 file_utilities_->set_sandbox_enabled(sandboxEnabled()); |
314 } | 315 } |
315 return file_utilities_.get(); | 316 return file_utilities_.get(); |
316 } | 317 } |
317 | 318 |
318 blink::WebSandboxSupport* RendererBlinkPlatformImpl::sandboxSupport() { | 319 blink::WebSandboxSupport* RendererBlinkPlatformImpl::sandboxSupport() { |
319 #if defined(OS_ANDROID) || defined(OS_WIN) | 320 #if defined(OS_ANDROID) || defined(OS_WIN) |
320 // These platforms do not require sandbox support. | 321 // These platforms do not require sandbox support. |
321 return NULL; | 322 return nullptr; |
322 #else | 323 #else |
323 return sandbox_support_.get(); | 324 return sandbox_support_.get(); |
324 #endif | 325 #endif |
325 } | 326 } |
326 | 327 |
327 blink::WebCookieJar* RendererBlinkPlatformImpl::cookieJar() { | 328 blink::WebCookieJar* RendererBlinkPlatformImpl::cookieJar() { |
328 NOTREACHED() << "Use WebFrameClient::cookieJar() instead!"; | 329 NOTREACHED() << "Use WebFrameClient::cookieJar() instead!"; |
329 return NULL; | 330 return nullptr; |
330 } | 331 } |
331 | 332 |
332 blink::WebThemeEngine* RendererBlinkPlatformImpl::themeEngine() { | 333 blink::WebThemeEngine* RendererBlinkPlatformImpl::themeEngine() { |
333 blink::WebThemeEngine* theme_engine = | 334 blink::WebThemeEngine* theme_engine = |
334 GetContentClient()->renderer()->OverrideThemeEngine(); | 335 GetContentClient()->renderer()->OverrideThemeEngine(); |
335 if (theme_engine) | 336 if (theme_engine) |
336 return theme_engine; | 337 return theme_engine; |
337 return BlinkPlatformImpl::themeEngine(); | 338 return BlinkPlatformImpl::themeEngine(); |
338 } | 339 } |
339 | 340 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
397 0); | 398 0); |
398 if (sudden_termination_disables_ != 0) | 399 if (sudden_termination_disables_ != 0) |
399 return; | 400 return; |
400 } else { | 401 } else { |
401 sudden_termination_disables_++; | 402 sudden_termination_disables_++; |
402 if (sudden_termination_disables_ != 1) | 403 if (sudden_termination_disables_ != 1) |
403 return; | 404 return; |
404 } | 405 } |
405 | 406 |
406 RenderThread* thread = RenderThread::Get(); | 407 RenderThread* thread = RenderThread::Get(); |
407 if (thread) // NULL in unittests. | 408 if (thread) // nullptr in unittests. |
408 thread->Send(new RenderProcessHostMsg_SuddenTerminationChanged(enabled)); | 409 thread->Send(new RenderProcessHostMsg_SuddenTerminationChanged(enabled)); |
409 } | 410 } |
410 | 411 |
411 WebStorageNamespace* RendererBlinkPlatformImpl::createLocalStorageNamespace() { | 412 WebStorageNamespace* RendererBlinkPlatformImpl::createLocalStorageNamespace() { |
412 return new WebStorageNamespaceImpl(); | 413 return new WebStorageNamespaceImpl(); |
413 } | 414 } |
414 | 415 |
415 | 416 |
416 //------------------------------------------------------------------------------ | 417 //------------------------------------------------------------------------------ |
417 | 418 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
558 #if defined(OS_MACOSX) | 559 #if defined(OS_MACOSX) |
559 | 560 |
560 bool RendererBlinkPlatformImpl::SandboxSupport::loadFont(NSFont* src_font, | 561 bool RendererBlinkPlatformImpl::SandboxSupport::loadFont(NSFont* src_font, |
561 CGFontRef* out, | 562 CGFontRef* out, |
562 uint32* font_id) { | 563 uint32* font_id) { |
563 uint32 font_data_size; | 564 uint32 font_data_size; |
564 FontDescriptor src_font_descriptor(src_font); | 565 FontDescriptor src_font_descriptor(src_font); |
565 base::SharedMemoryHandle font_data; | 566 base::SharedMemoryHandle font_data; |
566 if (!RenderThread::Get()->Send(new RenderProcessHostMsg_LoadFont( | 567 if (!RenderThread::Get()->Send(new RenderProcessHostMsg_LoadFont( |
567 src_font_descriptor, &font_data_size, &font_data, font_id))) { | 568 src_font_descriptor, &font_data_size, &font_data, font_id))) { |
568 *out = NULL; | 569 *out = nullptr; |
569 *font_id = 0; | 570 *font_id = 0; |
570 return false; | 571 return false; |
571 } | 572 } |
572 | 573 |
573 if (font_data_size == 0 || font_data == base::SharedMemory::NULLHandle() || | 574 if (font_data_size == 0 || font_data == base::SharedMemory::NULLHandle() || |
574 *font_id == 0) { | 575 *font_id == 0) { |
575 LOG(ERROR) << "Bad response from RenderProcessHostMsg_LoadFont() for " << | 576 LOG(ERROR) << "Bad response from RenderProcessHostMsg_LoadFont() for " << |
576 src_font_descriptor.font_name; | 577 src_font_descriptor.font_name; |
577 *out = NULL; | 578 *out = nullptr; |
jochen (gone - plz use gerrit)
2015/10/20 12:27:35
please don't change code unrelated to your CL
hbos_chromium
2015/10/20 15:42:23
Acknowledged. Changed back to old NULL usage.
| |
578 *font_id = 0; | 579 *font_id = 0; |
579 return false; | 580 return false; |
580 } | 581 } |
581 | 582 |
582 // TODO(jeremy): Need to call back into WebKit to make sure that the font | 583 // TODO(jeremy): Need to call back into WebKit to make sure that the font |
583 // isn't already activated, based on the font id. If it's already | 584 // isn't already activated, based on the font id. If it's already |
584 // activated, don't reactivate it here - crbug.com/72727 . | 585 // activated, don't reactivate it here - crbug.com/72727 . |
585 | 586 |
586 return FontLoader::CGFontRefFromBuffer(font_data, font_data_size, out); | 587 return FontLoader::CGFontRefFromBuffer(font_data, font_data_size, out); |
587 } | 588 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
663 GpuChannelHost* host = thread->EstablishGpuChannelSync( | 664 GpuChannelHost* host = thread->EstablishGpuChannelSync( |
664 CAUSE_FOR_GPU_LAUNCH_CANVAS_2D); | 665 CAUSE_FOR_GPU_LAUNCH_CANVAS_2D); |
665 if (!host) | 666 if (!host) |
666 return false; | 667 return false; |
667 | 668 |
668 return host->gpu_info().SupportsAccelerated2dCanvas(); | 669 return host->gpu_info().SupportsAccelerated2dCanvas(); |
669 } | 670 } |
670 | 671 |
671 bool RendererBlinkPlatformImpl::isThreadedCompositingEnabled() { | 672 bool RendererBlinkPlatformImpl::isThreadedCompositingEnabled() { |
672 RenderThreadImpl* thread = RenderThreadImpl::current(); | 673 RenderThreadImpl* thread = RenderThreadImpl::current(); |
673 // thread can be NULL in tests. | 674 // thread can be nullptr in tests. |
674 return thread && thread->compositor_task_runner().get(); | 675 return thread && thread->compositor_task_runner().get(); |
675 } | 676 } |
676 | 677 |
677 bool RendererBlinkPlatformImpl::isThreadedAnimationEnabled() { | 678 bool RendererBlinkPlatformImpl::isThreadedAnimationEnabled() { |
678 RenderThreadImpl* thread = RenderThreadImpl::current(); | 679 RenderThreadImpl* thread = RenderThreadImpl::current(); |
679 return thread ? thread->IsThreadedAnimationEnabled() : true; | 680 return thread ? thread->IsThreadedAnimationEnabled() : true; |
680 } | 681 } |
681 | 682 |
682 double RendererBlinkPlatformImpl::audioHardwareSampleRate() { | 683 double RendererBlinkPlatformImpl::audioHardwareSampleRate() { |
683 RenderThreadImpl* thread = RenderThreadImpl::current(); | 684 RenderThreadImpl* thread = RenderThreadImpl::current(); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
868 | 869 |
869 //------------------------------------------------------------------------------ | 870 //------------------------------------------------------------------------------ |
870 | 871 |
871 blink::WebScrollbarBehavior* RendererBlinkPlatformImpl::scrollbarBehavior() { | 872 blink::WebScrollbarBehavior* RendererBlinkPlatformImpl::scrollbarBehavior() { |
872 return web_scrollbar_behavior_.get(); | 873 return web_scrollbar_behavior_.get(); |
873 } | 874 } |
874 | 875 |
875 //------------------------------------------------------------------------------ | 876 //------------------------------------------------------------------------------ |
876 | 877 |
877 WebBlobRegistry* RendererBlinkPlatformImpl::blobRegistry() { | 878 WebBlobRegistry* RendererBlinkPlatformImpl::blobRegistry() { |
878 // blob_registry_ can be NULL when running some tests. | 879 // blob_registry_ can be nullptr when running some tests. |
879 return blob_registry_.get(); | 880 return blob_registry_.get(); |
880 } | 881 } |
881 | 882 |
882 //------------------------------------------------------------------------------ | 883 //------------------------------------------------------------------------------ |
883 | 884 |
884 void RendererBlinkPlatformImpl::sampleGamepads(WebGamepads& gamepads) { | 885 void RendererBlinkPlatformImpl::sampleGamepads(WebGamepads& gamepads) { |
885 PlatformEventObserverBase* observer = | 886 PlatformEventObserverBase* observer = |
886 platform_event_observers_.Lookup(blink::WebPlatformEventGamepad); | 887 platform_event_observers_.Lookup(blink::WebPlatformEventGamepad); |
887 if (!observer) | 888 if (!observer) |
888 return; | 889 return; |
(...skipping 12 matching lines...) Expand all Loading... | |
901 } | 902 } |
902 | 903 |
903 //------------------------------------------------------------------------------ | 904 //------------------------------------------------------------------------------ |
904 | 905 |
905 WebRTCPeerConnectionHandler* | 906 WebRTCPeerConnectionHandler* |
906 RendererBlinkPlatformImpl::createRTCPeerConnectionHandler( | 907 RendererBlinkPlatformImpl::createRTCPeerConnectionHandler( |
907 WebRTCPeerConnectionHandlerClient* client) { | 908 WebRTCPeerConnectionHandlerClient* client) { |
908 RenderThreadImpl* render_thread = RenderThreadImpl::current(); | 909 RenderThreadImpl* render_thread = RenderThreadImpl::current(); |
909 DCHECK(render_thread); | 910 DCHECK(render_thread); |
910 if (!render_thread) | 911 if (!render_thread) |
911 return NULL; | 912 return nullptr; |
912 | 913 |
913 #if defined(ENABLE_WEBRTC) | 914 #if defined(ENABLE_WEBRTC) |
914 WebRTCPeerConnectionHandler* peer_connection_handler = | 915 WebRTCPeerConnectionHandler* peer_connection_handler = |
915 GetContentClient()->renderer()->OverrideCreateWebRTCPeerConnectionHandler( | 916 GetContentClient()->renderer()->OverrideCreateWebRTCPeerConnectionHandler( |
916 client); | 917 client); |
917 if (peer_connection_handler) | 918 if (peer_connection_handler) |
918 return peer_connection_handler; | 919 return peer_connection_handler; |
919 | 920 |
920 PeerConnectionDependencyFactory* rtc_dependency_factory = | 921 PeerConnectionDependencyFactory* rtc_dependency_factory = |
921 render_thread->GetPeerConnectionDependencyFactory(); | 922 render_thread->GetPeerConnectionDependencyFactory(); |
922 return rtc_dependency_factory->CreateRTCPeerConnectionHandler(client); | 923 return rtc_dependency_factory->CreateRTCPeerConnectionHandler(client); |
923 #else | 924 #else |
924 return NULL; | 925 return nullptr; |
925 #endif // defined(ENABLE_WEBRTC) | 926 #endif // defined(ENABLE_WEBRTC) |
926 } | 927 } |
927 | 928 |
929 //------------------------------------------------------------------------------ | |
930 | |
931 blink::WebRTCCertificateGenerator* | |
932 RendererBlinkPlatformImpl::createRTCCertificateGenerator() { | |
933 #if defined(ENABLE_WEBRTC) | |
934 return new RTCCertificateGenerator(); | |
935 #else | |
936 return nullptr; | |
937 #endif // defined(ENABLE_WEBRTC) | |
938 } | |
939 | |
928 //------------------------------------------------------------------------------ | 940 //------------------------------------------------------------------------------ |
929 | 941 |
930 WebMediaStreamCenter* RendererBlinkPlatformImpl::createMediaStreamCenter( | 942 WebMediaStreamCenter* RendererBlinkPlatformImpl::createMediaStreamCenter( |
931 WebMediaStreamCenterClient* client) { | 943 WebMediaStreamCenterClient* client) { |
932 RenderThreadImpl* render_thread = RenderThreadImpl::current(); | 944 RenderThreadImpl* render_thread = RenderThreadImpl::current(); |
933 DCHECK(render_thread); | 945 DCHECK(render_thread); |
934 if (!render_thread) | 946 if (!render_thread) |
935 return NULL; | 947 return nullptr; |
936 return render_thread->CreateMediaStreamCenter(client); | 948 return render_thread->CreateMediaStreamCenter(client); |
937 } | 949 } |
938 | 950 |
939 // static | 951 // static |
940 bool RendererBlinkPlatformImpl::SetSandboxEnabledForTesting(bool enable) { | 952 bool RendererBlinkPlatformImpl::SetSandboxEnabledForTesting(bool enable) { |
941 bool was_enabled = g_sandbox_enabled; | 953 bool was_enabled = g_sandbox_enabled; |
942 g_sandbox_enabled = enable; | 954 g_sandbox_enabled = enable; |
943 return was_enabled; | 955 return was_enabled; |
944 } | 956 } |
945 | 957 |
(...skipping 13 matching lines...) Expand all Loading... | |
959 new RenderProcessHostMsg_GetProcessMemorySizes( | 971 new RenderProcessHostMsg_GetProcessMemorySizes( |
960 private_bytes, shared_bytes)); | 972 private_bytes, shared_bytes)); |
961 return true; | 973 return true; |
962 } | 974 } |
963 | 975 |
964 //------------------------------------------------------------------------------ | 976 //------------------------------------------------------------------------------ |
965 | 977 |
966 blink::WebGraphicsContext3D* | 978 blink::WebGraphicsContext3D* |
967 RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D( | 979 RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D( |
968 const blink::WebGraphicsContext3D::Attributes& attributes) { | 980 const blink::WebGraphicsContext3D::Attributes& attributes) { |
969 return createOffscreenGraphicsContext3D(attributes, NULL); | 981 return createOffscreenGraphicsContext3D(attributes, nullptr); |
970 } | 982 } |
971 | 983 |
972 blink::WebGraphicsContext3D* | 984 blink::WebGraphicsContext3D* |
973 RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D( | 985 RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D( |
974 const blink::WebGraphicsContext3D::Attributes& attributes, | 986 const blink::WebGraphicsContext3D::Attributes& attributes, |
975 blink::WebGraphicsContext3D* share_context) { | 987 blink::WebGraphicsContext3D* share_context) { |
976 return createOffscreenGraphicsContext3D(attributes, share_context, NULL); | 988 return createOffscreenGraphicsContext3D(attributes, share_context, nullptr); |
977 } | 989 } |
978 | 990 |
979 blink::WebGraphicsContext3D* | 991 blink::WebGraphicsContext3D* |
980 RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D( | 992 RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D( |
981 const blink::WebGraphicsContext3D::Attributes& attributes, | 993 const blink::WebGraphicsContext3D::Attributes& attributes, |
982 blink::WebGraphicsContext3D* share_context, | 994 blink::WebGraphicsContext3D* share_context, |
983 blink::WebGLInfo* gl_info) { | 995 blink::WebGLInfo* gl_info) { |
984 if (!RenderThreadImpl::current()) | 996 if (!RenderThreadImpl::current()) |
985 return NULL; | 997 return nullptr; |
986 | 998 |
987 scoped_refptr<GpuChannelHost> gpu_channel_host( | 999 scoped_refptr<GpuChannelHost> gpu_channel_host( |
988 RenderThreadImpl::current()->EstablishGpuChannelSync( | 1000 RenderThreadImpl::current()->EstablishGpuChannelSync( |
989 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) ); | 1001 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) ); |
990 | 1002 |
991 if (gpu_channel_host.get() && gl_info) { | 1003 if (gpu_channel_host.get() && gl_info) { |
992 const gpu::GPUInfo& gpu_info = gpu_channel_host->gpu_info(); | 1004 const gpu::GPUInfo& gpu_info = gpu_channel_host->gpu_info(); |
993 switch (gpu_info.context_info_state) { | 1005 switch (gpu_info.context_info_state) { |
994 case gpu::kCollectInfoSuccess: | 1006 case gpu::kCollectInfoSuccess: |
995 case gpu::kCollectInfoNonFatalFailure: | 1007 case gpu::kCollectInfoNonFatalFailure: |
(...skipping 24 matching lines...) Expand all Loading... | |
1020 gpu_channel_host.get(), | 1032 gpu_channel_host.get(), |
1021 attributes, | 1033 attributes, |
1022 lose_context_when_out_of_memory, | 1034 lose_context_when_out_of_memory, |
1023 GURL(attributes.topDocumentURL), | 1035 GURL(attributes.topDocumentURL), |
1024 limits, | 1036 limits, |
1025 static_cast<WebGraphicsContext3DCommandBufferImpl*>(share_context))); | 1037 static_cast<WebGraphicsContext3DCommandBufferImpl*>(share_context))); |
1026 | 1038 |
1027 // Most likely the GPU process exited and the attempt to reconnect to it | 1039 // Most likely the GPU process exited and the attempt to reconnect to it |
1028 // failed. Need to try to restore the context again later. | 1040 // failed. Need to try to restore the context again later. |
1029 if (!context || !context->InitializeOnCurrentThread()) | 1041 if (!context || !context->InitializeOnCurrentThread()) |
1030 return NULL; | 1042 return nullptr; |
1031 return context.release(); | 1043 return context.release(); |
1032 } | 1044 } |
1033 | 1045 |
1034 //------------------------------------------------------------------------------ | 1046 //------------------------------------------------------------------------------ |
1035 | 1047 |
1036 blink::WebGraphicsContext3DProvider* | 1048 blink::WebGraphicsContext3DProvider* |
1037 RendererBlinkPlatformImpl::createSharedOffscreenGraphicsContext3DProvider() { | 1049 RendererBlinkPlatformImpl::createSharedOffscreenGraphicsContext3DProvider() { |
1038 scoped_refptr<cc_blink::ContextProviderWebContext> provider = | 1050 scoped_refptr<cc_blink::ContextProviderWebContext> provider = |
1039 RenderThreadImpl::current()->SharedMainThreadContextProvider(); | 1051 RenderThreadImpl::current()->SharedMainThreadContextProvider(); |
1040 if (!provider.get()) | 1052 if (!provider.get()) |
1041 return NULL; | 1053 return nullptr; |
1042 return new WebGraphicsContext3DProviderImpl(provider); | 1054 return new WebGraphicsContext3DProviderImpl(provider); |
1043 } | 1055 } |
1044 | 1056 |
1045 //------------------------------------------------------------------------------ | 1057 //------------------------------------------------------------------------------ |
1046 | 1058 |
1047 blink::WebCompositorSupport* RendererBlinkPlatformImpl::compositorSupport() { | 1059 blink::WebCompositorSupport* RendererBlinkPlatformImpl::compositorSupport() { |
1048 return &compositor_support_; | 1060 return &compositor_support_; |
1049 } | 1061 } |
1050 | 1062 |
1051 //------------------------------------------------------------------------------ | 1063 //------------------------------------------------------------------------------ |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1118 // static | 1130 // static |
1119 PlatformEventObserverBase* | 1131 PlatformEventObserverBase* |
1120 RendererBlinkPlatformImpl::CreatePlatformEventObserverFromType( | 1132 RendererBlinkPlatformImpl::CreatePlatformEventObserverFromType( |
1121 blink::WebPlatformEventType type) { | 1133 blink::WebPlatformEventType type) { |
1122 RenderThread* thread = RenderThreadImpl::current(); | 1134 RenderThread* thread = RenderThreadImpl::current(); |
1123 | 1135 |
1124 // When running layout tests, those observers should not listen to the actual | 1136 // When running layout tests, those observers should not listen to the actual |
1125 // hardware changes. In order to make that happen, they will receive a null | 1137 // hardware changes. In order to make that happen, they will receive a null |
1126 // thread. | 1138 // thread. |
1127 if (thread && RenderThreadImpl::current()->layout_test_mode()) | 1139 if (thread && RenderThreadImpl::current()->layout_test_mode()) |
1128 thread = NULL; | 1140 thread = nullptr; |
1129 | 1141 |
1130 switch (type) { | 1142 switch (type) { |
1131 case blink::WebPlatformEventDeviceMotion: | 1143 case blink::WebPlatformEventDeviceMotion: |
1132 return new DeviceMotionEventPump(thread); | 1144 return new DeviceMotionEventPump(thread); |
1133 case blink::WebPlatformEventDeviceOrientation: | 1145 case blink::WebPlatformEventDeviceOrientation: |
1134 return new DeviceOrientationEventPump(thread); | 1146 return new DeviceOrientationEventPump(thread); |
1135 case blink::WebPlatformEventDeviceLight: | 1147 case blink::WebPlatformEventDeviceLight: |
1136 return new DeviceLightEventPump(thread); | 1148 return new DeviceLightEventPump(thread); |
1137 case blink::WebPlatformEventGamepad: | 1149 case blink::WebPlatformEventGamepad: |
1138 return new GamepadSharedMemoryReader(thread); | 1150 return new GamepadSharedMemoryReader(thread); |
1139 case blink::WebPlatformEventScreenOrientation: | 1151 case blink::WebPlatformEventScreenOrientation: |
1140 return new ScreenOrientationObserver(); | 1152 return new ScreenOrientationObserver(); |
1141 default: | 1153 default: |
1142 // A default statement is required to prevent compilation errors when | 1154 // A default statement is required to prevent compilation errors when |
1143 // Blink adds a new type. | 1155 // Blink adds a new type. |
1144 DVLOG(1) << "RendererBlinkPlatformImpl::startListening() with " | 1156 DVLOG(1) << "RendererBlinkPlatformImpl::startListening() with " |
1145 "unknown type."; | 1157 "unknown type."; |
1146 } | 1158 } |
1147 | 1159 |
1148 return NULL; | 1160 return nullptr; |
1149 } | 1161 } |
1150 | 1162 |
1151 void RendererBlinkPlatformImpl::SetPlatformEventObserverForTesting( | 1163 void RendererBlinkPlatformImpl::SetPlatformEventObserverForTesting( |
1152 blink::WebPlatformEventType type, | 1164 blink::WebPlatformEventType type, |
1153 scoped_ptr<PlatformEventObserverBase> observer) { | 1165 scoped_ptr<PlatformEventObserverBase> observer) { |
1154 DCHECK(type != blink::WebPlatformEventBattery); | 1166 DCHECK(type != blink::WebPlatformEventBattery); |
1155 | 1167 |
1156 if (platform_event_observers_.Lookup(type)) | 1168 if (platform_event_observers_.Lookup(type)) |
1157 platform_event_observers_.Remove(type); | 1169 platform_event_observers_.Remove(type); |
1158 platform_event_observers_.AddWithID(observer.release(), type); | 1170 platform_event_observers_.AddWithID(observer.release(), type); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1261 //------------------------------------------------------------------------------ | 1273 //------------------------------------------------------------------------------ |
1262 | 1274 |
1263 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( | 1275 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( |
1264 const blink::WebBatteryStatus& status) { | 1276 const blink::WebBatteryStatus& status) { |
1265 if (!g_test_battery_status_listener) | 1277 if (!g_test_battery_status_listener) |
1266 return; | 1278 return; |
1267 g_test_battery_status_listener->updateBatteryStatus(status); | 1279 g_test_battery_status_listener->updateBatteryStatus(status); |
1268 } | 1280 } |
1269 | 1281 |
1270 } // namespace content | 1282 } // namespace content |
OLD | NEW |