| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 #include "content/renderer/cache_storage/webserviceworkercachestorage_impl.h" | 51 #include "content/renderer/cache_storage/webserviceworkercachestorage_impl.h" |
| 52 #include "content/renderer/device_sensors/device_light_event_pump.h" | 52 #include "content/renderer/device_sensors/device_light_event_pump.h" |
| 53 #include "content/renderer/device_sensors/device_motion_event_pump.h" | 53 #include "content/renderer/device_sensors/device_motion_event_pump.h" |
| 54 #include "content/renderer/device_sensors/device_orientation_event_pump.h" | 54 #include "content/renderer/device_sensors/device_orientation_event_pump.h" |
| 55 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" | 55 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" |
| 56 #include "content/renderer/gamepad_shared_memory_reader.h" | 56 #include "content/renderer/gamepad_shared_memory_reader.h" |
| 57 #include "content/renderer/media/audio_decoder.h" | 57 #include "content/renderer/media/audio_decoder.h" |
| 58 #include "content/renderer/media/media_recorder_handler.h" | 58 #include "content/renderer/media/media_recorder_handler.h" |
| 59 #include "content/renderer/media/renderer_webaudiodevice_impl.h" | 59 #include "content/renderer/media/renderer_webaudiodevice_impl.h" |
| 60 #include "content/renderer/media/renderer_webmidiaccessor_impl.h" | 60 #include "content/renderer/media/renderer_webmidiaccessor_impl.h" |
| 61 #include "content/renderer/media/rtc_certificate_generator.h" |
| 61 #include "content/renderer/render_thread_impl.h" | 62 #include "content/renderer/render_thread_impl.h" |
| 62 #include "content/renderer/renderer_clipboard_delegate.h" | 63 #include "content/renderer/renderer_clipboard_delegate.h" |
| 63 #include "content/renderer/screen_orientation/screen_orientation_observer.h" | 64 #include "content/renderer/screen_orientation/screen_orientation_observer.h" |
| 64 #include "content/renderer/webclipboard_impl.h" | 65 #include "content/renderer/webclipboard_impl.h" |
| 65 #include "content/renderer/webgraphicscontext3d_provider_impl.h" | 66 #include "content/renderer/webgraphicscontext3d_provider_impl.h" |
| 66 #include "content/renderer/webpublicsuffixlist_impl.h" | 67 #include "content/renderer/webpublicsuffixlist_impl.h" |
| 67 #include "gpu/config/gpu_info.h" | 68 #include "gpu/config/gpu_info.h" |
| 68 #include "ipc/ipc_sync_message_filter.h" | 69 #include "ipc/ipc_sync_message_filter.h" |
| 69 #include "media/audio/audio_output_device.h" | 70 #include "media/audio/audio_output_device.h" |
| 70 #include "media/base/audio_hardware_config.h" | 71 #include "media/base/audio_hardware_config.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 if (!file_utilities_) { | 296 if (!file_utilities_) { |
| 296 file_utilities_.reset(new FileUtilities(thread_safe_sender_.get())); | 297 file_utilities_.reset(new FileUtilities(thread_safe_sender_.get())); |
| 297 file_utilities_->set_sandbox_enabled(sandboxEnabled()); | 298 file_utilities_->set_sandbox_enabled(sandboxEnabled()); |
| 298 } | 299 } |
| 299 return file_utilities_.get(); | 300 return file_utilities_.get(); |
| 300 } | 301 } |
| 301 | 302 |
| 302 blink::WebSandboxSupport* RendererBlinkPlatformImpl::sandboxSupport() { | 303 blink::WebSandboxSupport* RendererBlinkPlatformImpl::sandboxSupport() { |
| 303 #if defined(OS_ANDROID) || defined(OS_WIN) | 304 #if defined(OS_ANDROID) || defined(OS_WIN) |
| 304 // These platforms do not require sandbox support. | 305 // These platforms do not require sandbox support. |
| 305 return NULL; | 306 return nullptr; |
| 306 #else | 307 #else |
| 307 return sandbox_support_.get(); | 308 return sandbox_support_.get(); |
| 308 #endif | 309 #endif |
| 309 } | 310 } |
| 310 | 311 |
| 311 blink::WebCookieJar* RendererBlinkPlatformImpl::cookieJar() { | 312 blink::WebCookieJar* RendererBlinkPlatformImpl::cookieJar() { |
| 312 NOTREACHED() << "Use WebFrameClient::cookieJar() instead!"; | 313 NOTREACHED() << "Use WebFrameClient::cookieJar() instead!"; |
| 313 return NULL; | 314 return nullptr; |
| 314 } | 315 } |
| 315 | 316 |
| 316 blink::WebThemeEngine* RendererBlinkPlatformImpl::themeEngine() { | 317 blink::WebThemeEngine* RendererBlinkPlatformImpl::themeEngine() { |
| 317 blink::WebThemeEngine* theme_engine = | 318 blink::WebThemeEngine* theme_engine = |
| 318 GetContentClient()->renderer()->OverrideThemeEngine(); | 319 GetContentClient()->renderer()->OverrideThemeEngine(); |
| 319 if (theme_engine) | 320 if (theme_engine) |
| 320 return theme_engine; | 321 return theme_engine; |
| 321 return BlinkPlatformImpl::themeEngine(); | 322 return BlinkPlatformImpl::themeEngine(); |
| 322 } | 323 } |
| 323 | 324 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 0); | 382 0); |
| 382 if (sudden_termination_disables_ != 0) | 383 if (sudden_termination_disables_ != 0) |
| 383 return; | 384 return; |
| 384 } else { | 385 } else { |
| 385 sudden_termination_disables_++; | 386 sudden_termination_disables_++; |
| 386 if (sudden_termination_disables_ != 1) | 387 if (sudden_termination_disables_ != 1) |
| 387 return; | 388 return; |
| 388 } | 389 } |
| 389 | 390 |
| 390 RenderThread* thread = RenderThread::Get(); | 391 RenderThread* thread = RenderThread::Get(); |
| 391 if (thread) // NULL in unittests. | 392 if (thread) // nullptr in unittests. |
| 392 thread->Send(new RenderProcessHostMsg_SuddenTerminationChanged(enabled)); | 393 thread->Send(new RenderProcessHostMsg_SuddenTerminationChanged(enabled)); |
| 393 } | 394 } |
| 394 | 395 |
| 395 WebStorageNamespace* RendererBlinkPlatformImpl::createLocalStorageNamespace() { | 396 WebStorageNamespace* RendererBlinkPlatformImpl::createLocalStorageNamespace() { |
| 396 return new WebStorageNamespaceImpl(); | 397 return new WebStorageNamespaceImpl(); |
| 397 } | 398 } |
| 398 | 399 |
| 399 | 400 |
| 400 //------------------------------------------------------------------------------ | 401 //------------------------------------------------------------------------------ |
| 401 | 402 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 #if defined(OS_MACOSX) | 543 #if defined(OS_MACOSX) |
| 543 | 544 |
| 544 bool RendererBlinkPlatformImpl::SandboxSupport::loadFont(NSFont* src_font, | 545 bool RendererBlinkPlatformImpl::SandboxSupport::loadFont(NSFont* src_font, |
| 545 CGFontRef* out, | 546 CGFontRef* out, |
| 546 uint32* font_id) { | 547 uint32* font_id) { |
| 547 uint32 font_data_size; | 548 uint32 font_data_size; |
| 548 FontDescriptor src_font_descriptor(src_font); | 549 FontDescriptor src_font_descriptor(src_font); |
| 549 base::SharedMemoryHandle font_data; | 550 base::SharedMemoryHandle font_data; |
| 550 if (!RenderThread::Get()->Send(new RenderProcessHostMsg_LoadFont( | 551 if (!RenderThread::Get()->Send(new RenderProcessHostMsg_LoadFont( |
| 551 src_font_descriptor, &font_data_size, &font_data, font_id))) { | 552 src_font_descriptor, &font_data_size, &font_data, font_id))) { |
| 552 *out = NULL; | 553 *out = nullptr; |
| 553 *font_id = 0; | 554 *font_id = 0; |
| 554 return false; | 555 return false; |
| 555 } | 556 } |
| 556 | 557 |
| 557 if (font_data_size == 0 || font_data == base::SharedMemory::NULLHandle() || | 558 if (font_data_size == 0 || font_data == base::SharedMemory::NULLHandle() || |
| 558 *font_id == 0) { | 559 *font_id == 0) { |
| 559 LOG(ERROR) << "Bad response from RenderProcessHostMsg_LoadFont() for " << | 560 LOG(ERROR) << "Bad response from RenderProcessHostMsg_LoadFont() for " << |
| 560 src_font_descriptor.font_name; | 561 src_font_descriptor.font_name; |
| 561 *out = NULL; | 562 *out = nullptr; |
| 562 *font_id = 0; | 563 *font_id = 0; |
| 563 return false; | 564 return false; |
| 564 } | 565 } |
| 565 | 566 |
| 566 // TODO(jeremy): Need to call back into WebKit to make sure that the font | 567 // TODO(jeremy): Need to call back into WebKit to make sure that the font |
| 567 // isn't already activated, based on the font id. If it's already | 568 // isn't already activated, based on the font id. If it's already |
| 568 // activated, don't reactivate it here - crbug.com/72727 . | 569 // activated, don't reactivate it here - crbug.com/72727 . |
| 569 | 570 |
| 570 return FontLoader::CGFontRefFromBuffer(font_data, font_data_size, out); | 571 return FontLoader::CGFontRefFromBuffer(font_data, font_data_size, out); |
| 571 } | 572 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 GpuChannelHost* host = thread->EstablishGpuChannelSync( | 648 GpuChannelHost* host = thread->EstablishGpuChannelSync( |
| 648 CAUSE_FOR_GPU_LAUNCH_CANVAS_2D); | 649 CAUSE_FOR_GPU_LAUNCH_CANVAS_2D); |
| 649 if (!host) | 650 if (!host) |
| 650 return false; | 651 return false; |
| 651 | 652 |
| 652 return host->gpu_info().SupportsAccelerated2dCanvas(); | 653 return host->gpu_info().SupportsAccelerated2dCanvas(); |
| 653 } | 654 } |
| 654 | 655 |
| 655 bool RendererBlinkPlatformImpl::isThreadedCompositingEnabled() { | 656 bool RendererBlinkPlatformImpl::isThreadedCompositingEnabled() { |
| 656 RenderThreadImpl* thread = RenderThreadImpl::current(); | 657 RenderThreadImpl* thread = RenderThreadImpl::current(); |
| 657 // thread can be NULL in tests. | 658 // thread can be nullptr in tests. |
| 658 return thread && thread->compositor_task_runner().get(); | 659 return thread && thread->compositor_task_runner().get(); |
| 659 } | 660 } |
| 660 | 661 |
| 661 bool RendererBlinkPlatformImpl::isThreadedAnimationEnabled() { | 662 bool RendererBlinkPlatformImpl::isThreadedAnimationEnabled() { |
| 662 RenderThreadImpl* thread = RenderThreadImpl::current(); | 663 RenderThreadImpl* thread = RenderThreadImpl::current(); |
| 663 return thread ? thread->IsThreadedAnimationEnabled() : true; | 664 return thread ? thread->IsThreadedAnimationEnabled() : true; |
| 664 } | 665 } |
| 665 | 666 |
| 666 double RendererBlinkPlatformImpl::audioHardwareSampleRate() { | 667 double RendererBlinkPlatformImpl::audioHardwareSampleRate() { |
| 667 RenderThreadImpl* thread = RenderThreadImpl::current(); | 668 RenderThreadImpl* thread = RenderThreadImpl::current(); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 | 853 |
| 853 //------------------------------------------------------------------------------ | 854 //------------------------------------------------------------------------------ |
| 854 | 855 |
| 855 blink::WebScrollbarBehavior* RendererBlinkPlatformImpl::scrollbarBehavior() { | 856 blink::WebScrollbarBehavior* RendererBlinkPlatformImpl::scrollbarBehavior() { |
| 856 return web_scrollbar_behavior_.get(); | 857 return web_scrollbar_behavior_.get(); |
| 857 } | 858 } |
| 858 | 859 |
| 859 //------------------------------------------------------------------------------ | 860 //------------------------------------------------------------------------------ |
| 860 | 861 |
| 861 WebBlobRegistry* RendererBlinkPlatformImpl::blobRegistry() { | 862 WebBlobRegistry* RendererBlinkPlatformImpl::blobRegistry() { |
| 862 // blob_registry_ can be NULL when running some tests. | 863 // blob_registry_ can be nullptr when running some tests. |
| 863 return blob_registry_.get(); | 864 return blob_registry_.get(); |
| 864 } | 865 } |
| 865 | 866 |
| 866 //------------------------------------------------------------------------------ | 867 //------------------------------------------------------------------------------ |
| 867 | 868 |
| 868 void RendererBlinkPlatformImpl::sampleGamepads(WebGamepads& gamepads) { | 869 void RendererBlinkPlatformImpl::sampleGamepads(WebGamepads& gamepads) { |
| 869 PlatformEventObserverBase* observer = | 870 PlatformEventObserverBase* observer = |
| 870 platform_event_observers_.Lookup(blink::WebPlatformEventGamepad); | 871 platform_event_observers_.Lookup(blink::WebPlatformEventGamepad); |
| 871 if (!observer) | 872 if (!observer) |
| 872 return; | 873 return; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 885 } | 886 } |
| 886 | 887 |
| 887 //------------------------------------------------------------------------------ | 888 //------------------------------------------------------------------------------ |
| 888 | 889 |
| 889 WebRTCPeerConnectionHandler* | 890 WebRTCPeerConnectionHandler* |
| 890 RendererBlinkPlatformImpl::createRTCPeerConnectionHandler( | 891 RendererBlinkPlatformImpl::createRTCPeerConnectionHandler( |
| 891 WebRTCPeerConnectionHandlerClient* client) { | 892 WebRTCPeerConnectionHandlerClient* client) { |
| 892 RenderThreadImpl* render_thread = RenderThreadImpl::current(); | 893 RenderThreadImpl* render_thread = RenderThreadImpl::current(); |
| 893 DCHECK(render_thread); | 894 DCHECK(render_thread); |
| 894 if (!render_thread) | 895 if (!render_thread) |
| 895 return NULL; | 896 return nullptr; |
| 896 | 897 |
| 897 #if defined(ENABLE_WEBRTC) | 898 #if defined(ENABLE_WEBRTC) |
| 898 WebRTCPeerConnectionHandler* peer_connection_handler = | 899 WebRTCPeerConnectionHandler* peer_connection_handler = |
| 899 GetContentClient()->renderer()->OverrideCreateWebRTCPeerConnectionHandler( | 900 GetContentClient()->renderer()->OverrideCreateWebRTCPeerConnectionHandler( |
| 900 client); | 901 client); |
| 901 if (peer_connection_handler) | 902 if (peer_connection_handler) |
| 902 return peer_connection_handler; | 903 return peer_connection_handler; |
| 903 | 904 |
| 904 PeerConnectionDependencyFactory* rtc_dependency_factory = | 905 PeerConnectionDependencyFactory* rtc_dependency_factory = |
| 905 render_thread->GetPeerConnectionDependencyFactory(); | 906 render_thread->GetPeerConnectionDependencyFactory(); |
| 906 return rtc_dependency_factory->CreateRTCPeerConnectionHandler(client); | 907 return rtc_dependency_factory->CreateRTCPeerConnectionHandler(client); |
| 907 #else | 908 #else |
| 908 return NULL; | 909 return nullptr; |
| 909 #endif // defined(ENABLE_WEBRTC) | 910 #endif // defined(ENABLE_WEBRTC) |
| 910 } | 911 } |
| 911 | 912 |
| 913 //------------------------------------------------------------------------------ |
| 914 |
| 915 blink::WebRTCCertificateGenerator* |
| 916 RendererBlinkPlatformImpl::createRTCCertificateGenerator() { |
| 917 #if defined(ENABLE_WEBRTC) |
| 918 return new RTCCertificateGenerator(); |
| 919 #else |
| 920 return nullptr; |
| 921 #endif // defined(ENABLE_WEBRTC) |
| 922 } |
| 923 |
| 912 //------------------------------------------------------------------------------ | 924 //------------------------------------------------------------------------------ |
| 913 | 925 |
| 914 WebMediaStreamCenter* RendererBlinkPlatformImpl::createMediaStreamCenter( | 926 WebMediaStreamCenter* RendererBlinkPlatformImpl::createMediaStreamCenter( |
| 915 WebMediaStreamCenterClient* client) { | 927 WebMediaStreamCenterClient* client) { |
| 916 RenderThreadImpl* render_thread = RenderThreadImpl::current(); | 928 RenderThreadImpl* render_thread = RenderThreadImpl::current(); |
| 917 DCHECK(render_thread); | 929 DCHECK(render_thread); |
| 918 if (!render_thread) | 930 if (!render_thread) |
| 919 return NULL; | 931 return nullptr; |
| 920 return render_thread->CreateMediaStreamCenter(client); | 932 return render_thread->CreateMediaStreamCenter(client); |
| 921 } | 933 } |
| 922 | 934 |
| 923 // static | 935 // static |
| 924 bool RendererBlinkPlatformImpl::SetSandboxEnabledForTesting(bool enable) { | 936 bool RendererBlinkPlatformImpl::SetSandboxEnabledForTesting(bool enable) { |
| 925 bool was_enabled = g_sandbox_enabled; | 937 bool was_enabled = g_sandbox_enabled; |
| 926 g_sandbox_enabled = enable; | 938 g_sandbox_enabled = enable; |
| 927 return was_enabled; | 939 return was_enabled; |
| 928 } | 940 } |
| 929 | 941 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 943 new RenderProcessHostMsg_GetProcessMemorySizes( | 955 new RenderProcessHostMsg_GetProcessMemorySizes( |
| 944 private_bytes, shared_bytes)); | 956 private_bytes, shared_bytes)); |
| 945 return true; | 957 return true; |
| 946 } | 958 } |
| 947 | 959 |
| 948 //------------------------------------------------------------------------------ | 960 //------------------------------------------------------------------------------ |
| 949 | 961 |
| 950 blink::WebGraphicsContext3D* | 962 blink::WebGraphicsContext3D* |
| 951 RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D( | 963 RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D( |
| 952 const blink::WebGraphicsContext3D::Attributes& attributes) { | 964 const blink::WebGraphicsContext3D::Attributes& attributes) { |
| 953 return createOffscreenGraphicsContext3D(attributes, NULL); | 965 return createOffscreenGraphicsContext3D(attributes, nullptr); |
| 954 } | 966 } |
| 955 | 967 |
| 956 blink::WebGraphicsContext3D* | 968 blink::WebGraphicsContext3D* |
| 957 RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D( | 969 RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D( |
| 958 const blink::WebGraphicsContext3D::Attributes& attributes, | 970 const blink::WebGraphicsContext3D::Attributes& attributes, |
| 959 blink::WebGraphicsContext3D* share_context) { | 971 blink::WebGraphicsContext3D* share_context) { |
| 960 return createOffscreenGraphicsContext3D(attributes, share_context, NULL); | 972 return createOffscreenGraphicsContext3D(attributes, share_context, nullptr); |
| 961 } | 973 } |
| 962 | 974 |
| 963 blink::WebGraphicsContext3D* | 975 blink::WebGraphicsContext3D* |
| 964 RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D( | 976 RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D( |
| 965 const blink::WebGraphicsContext3D::Attributes& attributes, | 977 const blink::WebGraphicsContext3D::Attributes& attributes, |
| 966 blink::WebGraphicsContext3D* share_context, | 978 blink::WebGraphicsContext3D* share_context, |
| 967 blink::WebGLInfo* gl_info) { | 979 blink::WebGLInfo* gl_info) { |
| 968 if (!RenderThreadImpl::current()) | 980 if (!RenderThreadImpl::current()) |
| 969 return NULL; | 981 return nullptr; |
| 970 | 982 |
| 971 scoped_refptr<GpuChannelHost> gpu_channel_host( | 983 scoped_refptr<GpuChannelHost> gpu_channel_host( |
| 972 RenderThreadImpl::current()->EstablishGpuChannelSync( | 984 RenderThreadImpl::current()->EstablishGpuChannelSync( |
| 973 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
); | 985 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
); |
| 974 | 986 |
| 975 if (gpu_channel_host.get() && gl_info) { | 987 if (gpu_channel_host.get() && gl_info) { |
| 976 const gpu::GPUInfo& gpu_info = gpu_channel_host->gpu_info(); | 988 const gpu::GPUInfo& gpu_info = gpu_channel_host->gpu_info(); |
| 977 switch (gpu_info.context_info_state) { | 989 switch (gpu_info.context_info_state) { |
| 978 case gpu::kCollectInfoSuccess: | 990 case gpu::kCollectInfoSuccess: |
| 979 case gpu::kCollectInfoNonFatalFailure: | 991 case gpu::kCollectInfoNonFatalFailure: |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1004 gpu_channel_host.get(), | 1016 gpu_channel_host.get(), |
| 1005 attributes, | 1017 attributes, |
| 1006 lose_context_when_out_of_memory, | 1018 lose_context_when_out_of_memory, |
| 1007 GURL(attributes.topDocumentURL), | 1019 GURL(attributes.topDocumentURL), |
| 1008 limits, | 1020 limits, |
| 1009 static_cast<WebGraphicsContext3DCommandBufferImpl*>(share_context))); | 1021 static_cast<WebGraphicsContext3DCommandBufferImpl*>(share_context))); |
| 1010 | 1022 |
| 1011 // Most likely the GPU process exited and the attempt to reconnect to it | 1023 // Most likely the GPU process exited and the attempt to reconnect to it |
| 1012 // failed. Need to try to restore the context again later. | 1024 // failed. Need to try to restore the context again later. |
| 1013 if (!context || !context->InitializeOnCurrentThread()) | 1025 if (!context || !context->InitializeOnCurrentThread()) |
| 1014 return NULL; | 1026 return nullptr; |
| 1015 return context.release(); | 1027 return context.release(); |
| 1016 } | 1028 } |
| 1017 | 1029 |
| 1018 //------------------------------------------------------------------------------ | 1030 //------------------------------------------------------------------------------ |
| 1019 | 1031 |
| 1020 blink::WebGraphicsContext3DProvider* | 1032 blink::WebGraphicsContext3DProvider* |
| 1021 RendererBlinkPlatformImpl::createSharedOffscreenGraphicsContext3DProvider() { | 1033 RendererBlinkPlatformImpl::createSharedOffscreenGraphicsContext3DProvider() { |
| 1022 scoped_refptr<cc_blink::ContextProviderWebContext> provider = | 1034 scoped_refptr<cc_blink::ContextProviderWebContext> provider = |
| 1023 RenderThreadImpl::current()->SharedMainThreadContextProvider(); | 1035 RenderThreadImpl::current()->SharedMainThreadContextProvider(); |
| 1024 if (!provider.get()) | 1036 if (!provider.get()) |
| 1025 return NULL; | 1037 return nullptr; |
| 1026 return new WebGraphicsContext3DProviderImpl(provider); | 1038 return new WebGraphicsContext3DProviderImpl(provider); |
| 1027 } | 1039 } |
| 1028 | 1040 |
| 1029 //------------------------------------------------------------------------------ | 1041 //------------------------------------------------------------------------------ |
| 1030 | 1042 |
| 1031 blink::WebCompositorSupport* RendererBlinkPlatformImpl::compositorSupport() { | 1043 blink::WebCompositorSupport* RendererBlinkPlatformImpl::compositorSupport() { |
| 1032 return &compositor_support_; | 1044 return &compositor_support_; |
| 1033 } | 1045 } |
| 1034 | 1046 |
| 1035 //------------------------------------------------------------------------------ | 1047 //------------------------------------------------------------------------------ |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1102 // static | 1114 // static |
| 1103 PlatformEventObserverBase* | 1115 PlatformEventObserverBase* |
| 1104 RendererBlinkPlatformImpl::CreatePlatformEventObserverFromType( | 1116 RendererBlinkPlatformImpl::CreatePlatformEventObserverFromType( |
| 1105 blink::WebPlatformEventType type) { | 1117 blink::WebPlatformEventType type) { |
| 1106 RenderThread* thread = RenderThreadImpl::current(); | 1118 RenderThread* thread = RenderThreadImpl::current(); |
| 1107 | 1119 |
| 1108 // When running layout tests, those observers should not listen to the actual | 1120 // When running layout tests, those observers should not listen to the actual |
| 1109 // hardware changes. In order to make that happen, they will receive a null | 1121 // hardware changes. In order to make that happen, they will receive a null |
| 1110 // thread. | 1122 // thread. |
| 1111 if (thread && RenderThreadImpl::current()->layout_test_mode()) | 1123 if (thread && RenderThreadImpl::current()->layout_test_mode()) |
| 1112 thread = NULL; | 1124 thread = nullptr; |
| 1113 | 1125 |
| 1114 switch (type) { | 1126 switch (type) { |
| 1115 case blink::WebPlatformEventDeviceMotion: | 1127 case blink::WebPlatformEventDeviceMotion: |
| 1116 return new DeviceMotionEventPump(thread); | 1128 return new DeviceMotionEventPump(thread); |
| 1117 case blink::WebPlatformEventDeviceOrientation: | 1129 case blink::WebPlatformEventDeviceOrientation: |
| 1118 return new DeviceOrientationEventPump(thread); | 1130 return new DeviceOrientationEventPump(thread); |
| 1119 case blink::WebPlatformEventDeviceLight: | 1131 case blink::WebPlatformEventDeviceLight: |
| 1120 return new DeviceLightEventPump(thread); | 1132 return new DeviceLightEventPump(thread); |
| 1121 case blink::WebPlatformEventGamepad: | 1133 case blink::WebPlatformEventGamepad: |
| 1122 return new GamepadSharedMemoryReader(thread); | 1134 return new GamepadSharedMemoryReader(thread); |
| 1123 case blink::WebPlatformEventScreenOrientation: | 1135 case blink::WebPlatformEventScreenOrientation: |
| 1124 return new ScreenOrientationObserver(); | 1136 return new ScreenOrientationObserver(); |
| 1125 default: | 1137 default: |
| 1126 // A default statement is required to prevent compilation errors when | 1138 // A default statement is required to prevent compilation errors when |
| 1127 // Blink adds a new type. | 1139 // Blink adds a new type. |
| 1128 DVLOG(1) << "RendererBlinkPlatformImpl::startListening() with " | 1140 DVLOG(1) << "RendererBlinkPlatformImpl::startListening() with " |
| 1129 "unknown type."; | 1141 "unknown type."; |
| 1130 } | 1142 } |
| 1131 | 1143 |
| 1132 return NULL; | 1144 return nullptr; |
| 1133 } | 1145 } |
| 1134 | 1146 |
| 1135 void RendererBlinkPlatformImpl::SetPlatformEventObserverForTesting( | 1147 void RendererBlinkPlatformImpl::SetPlatformEventObserverForTesting( |
| 1136 blink::WebPlatformEventType type, | 1148 blink::WebPlatformEventType type, |
| 1137 scoped_ptr<PlatformEventObserverBase> observer) { | 1149 scoped_ptr<PlatformEventObserverBase> observer) { |
| 1138 DCHECK(type != blink::WebPlatformEventBattery); | 1150 DCHECK(type != blink::WebPlatformEventBattery); |
| 1139 | 1151 |
| 1140 if (platform_event_observers_.Lookup(type)) | 1152 if (platform_event_observers_.Lookup(type)) |
| 1141 platform_event_observers_.Remove(type); | 1153 platform_event_observers_.Remove(type); |
| 1142 platform_event_observers_.AddWithID(observer.release(), type); | 1154 platform_event_observers_.AddWithID(observer.release(), type); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1245 //------------------------------------------------------------------------------ | 1257 //------------------------------------------------------------------------------ |
| 1246 | 1258 |
| 1247 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( | 1259 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( |
| 1248 const blink::WebBatteryStatus& status) { | 1260 const blink::WebBatteryStatus& status) { |
| 1249 if (!g_test_battery_status_listener) | 1261 if (!g_test_battery_status_listener) |
| 1250 return; | 1262 return; |
| 1251 g_test_battery_status_listener->updateBatteryStatus(status); | 1263 g_test_battery_status_listener->updateBatteryStatus(status); |
| 1252 } | 1264 } |
| 1253 | 1265 |
| 1254 } // namespace content | 1266 } // namespace content |
| OLD | NEW |