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 <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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 #include "third_party/WebKit/public/platform/BlameContext.h" | 87 #include "third_party/WebKit/public/platform/BlameContext.h" |
88 #include "third_party/WebKit/public/platform/FilePathConversion.h" | 88 #include "third_party/WebKit/public/platform/FilePathConversion.h" |
89 #include "third_party/WebKit/public/platform/URLConversion.h" | 89 #include "third_party/WebKit/public/platform/URLConversion.h" |
90 #include "third_party/WebKit/public/platform/WebAudioLatencyHint.h" | 90 #include "third_party/WebKit/public/platform/WebAudioLatencyHint.h" |
91 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" | 91 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" |
92 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" | 92 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" |
93 #include "third_party/WebKit/public/platform/WebFileInfo.h" | 93 #include "third_party/WebKit/public/platform/WebFileInfo.h" |
94 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" | 94 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" |
95 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" | 95 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" |
96 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" | 96 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" |
97 #include "third_party/WebKit/public/platform/WebRTCPeerConnectionHandler.h" | |
98 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 97 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
99 #include "third_party/WebKit/public/platform/WebThread.h" | 98 #include "third_party/WebKit/public/platform/WebThread.h" |
100 #include "third_party/WebKit/public/platform/WebURL.h" | 99 #include "third_party/WebKit/public/platform/WebURL.h" |
101 #include "third_party/WebKit/public/platform/WebVector.h" | 100 #include "third_party/WebKit/public/platform/WebVector.h" |
102 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic
eMotionListener.h" | 101 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic
eMotionListener.h" |
103 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic
eOrientationListener.h" | 102 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic
eOrientationListener.h" |
104 #include "third_party/WebKit/public/platform/modules/webmidi/WebMIDIAccessor.h" | |
105 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" | 103 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" |
106 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 104 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
107 #include "url/gurl.h" | 105 #include "url/gurl.h" |
108 | 106 |
109 #if defined(OS_MACOSX) | 107 #if defined(OS_MACOSX) |
110 #include "content/common/mac/font_descriptor.h" | 108 #include "content/common/mac/font_descriptor.h" |
111 #include "content/common/mac/font_loader.h" | 109 #include "content/common/mac/font_loader.h" |
112 #include "content/renderer/webscrollbarbehavior_impl_mac.h" | 110 #include "content/renderer/webscrollbarbehavior_impl_mac.h" |
113 #include "third_party/WebKit/public/platform/mac/WebSandboxSupport.h" | 111 #include "third_party/WebKit/public/platform/mac/WebSandboxSupport.h" |
114 #endif | 112 #endif |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 using blink::Platform; | 144 using blink::Platform; |
147 using blink::WebAudioDevice; | 145 using blink::WebAudioDevice; |
148 using blink::WebAudioLatencyHint; | 146 using blink::WebAudioLatencyHint; |
149 using blink::WebBlobRegistry; | 147 using blink::WebBlobRegistry; |
150 using blink::WebCanvasCaptureHandler; | 148 using blink::WebCanvasCaptureHandler; |
151 using blink::WebDatabaseObserver; | 149 using blink::WebDatabaseObserver; |
152 using blink::WebFileInfo; | 150 using blink::WebFileInfo; |
153 using blink::WebFileSystem; | 151 using blink::WebFileSystem; |
154 using blink::WebIDBFactory; | 152 using blink::WebIDBFactory; |
155 using blink::WebImageCaptureFrameGrabber; | 153 using blink::WebImageCaptureFrameGrabber; |
| 154 using blink::WebMIDIAccessor; |
156 using blink::WebMediaPlayer; | 155 using blink::WebMediaPlayer; |
157 using blink::WebMediaRecorderHandler; | 156 using blink::WebMediaRecorderHandler; |
158 using blink::WebMediaStream; | 157 using blink::WebMediaStream; |
159 using blink::WebMediaStreamCenter; | 158 using blink::WebMediaStreamCenter; |
160 using blink::WebMediaStreamCenterClient; | 159 using blink::WebMediaStreamCenterClient; |
161 using blink::WebMediaStreamTrack; | 160 using blink::WebMediaStreamTrack; |
162 using blink::WebRTCPeerConnectionHandler; | 161 using blink::WebRTCPeerConnectionHandler; |
163 using blink::WebRTCPeerConnectionHandlerClient; | 162 using blink::WebRTCPeerConnectionHandlerClient; |
164 using blink::WebStorageNamespace; | 163 using blink::WebStorageNamespace; |
165 using blink::WebSize; | 164 using blink::WebSize; |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 sudden_termination_disables_++; | 459 sudden_termination_disables_++; |
461 if (sudden_termination_disables_ != 1) | 460 if (sudden_termination_disables_ != 1) |
462 return; | 461 return; |
463 } | 462 } |
464 | 463 |
465 RenderThread* thread = RenderThread::Get(); | 464 RenderThread* thread = RenderThread::Get(); |
466 if (thread) // NULL in unittests. | 465 if (thread) // NULL in unittests. |
467 thread->Send(new RenderProcessHostMsg_SuddenTerminationChanged(enabled)); | 466 thread->Send(new RenderProcessHostMsg_SuddenTerminationChanged(enabled)); |
468 } | 467 } |
469 | 468 |
470 std::unique_ptr<WebStorageNamespace> | 469 WebStorageNamespace* RendererBlinkPlatformImpl::CreateLocalStorageNamespace() { |
471 RendererBlinkPlatformImpl::CreateLocalStorageNamespace() { | |
472 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 470 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
473 switches::kMojoLocalStorage)) { | 471 switches::kMojoLocalStorage)) { |
474 if (!local_storage_cached_areas_) { | 472 if (!local_storage_cached_areas_) { |
475 local_storage_cached_areas_.reset(new LocalStorageCachedAreas( | 473 local_storage_cached_areas_.reset(new LocalStorageCachedAreas( |
476 RenderThreadImpl::current()->GetStoragePartitionService())); | 474 RenderThreadImpl::current()->GetStoragePartitionService())); |
477 } | 475 } |
478 return base::MakeUnique<LocalStorageNamespace>( | 476 return new LocalStorageNamespace(local_storage_cached_areas_.get()); |
479 local_storage_cached_areas_.get()); | |
480 } | 477 } |
481 | 478 |
482 return base::MakeUnique<WebStorageNamespaceImpl>(); | 479 return new WebStorageNamespaceImpl(); |
483 } | 480 } |
484 | 481 |
485 | 482 |
486 //------------------------------------------------------------------------------ | 483 //------------------------------------------------------------------------------ |
487 | 484 |
488 WebIDBFactory* RendererBlinkPlatformImpl::IdbFactory() { | 485 WebIDBFactory* RendererBlinkPlatformImpl::IdbFactory() { |
489 return web_idb_factory_.get(); | 486 return web_idb_factory_.get(); |
490 } | 487 } |
491 | 488 |
492 //------------------------------------------------------------------------------ | 489 //------------------------------------------------------------------------------ |
493 | 490 |
494 std::unique_ptr<blink::WebServiceWorkerCacheStorage> | 491 blink::WebServiceWorkerCacheStorage* RendererBlinkPlatformImpl::CacheStorage( |
495 RendererBlinkPlatformImpl::CreateCacheStorage( | |
496 const blink::WebSecurityOrigin& security_origin) { | 492 const blink::WebSecurityOrigin& security_origin) { |
497 return base::MakeUnique<WebServiceWorkerCacheStorageImpl>( | 493 return new WebServiceWorkerCacheStorageImpl(thread_safe_sender_.get(), |
498 thread_safe_sender_.get(), security_origin); | 494 security_origin); |
499 } | 495 } |
500 | 496 |
501 //------------------------------------------------------------------------------ | 497 //------------------------------------------------------------------------------ |
502 | 498 |
503 WebFileSystem* RendererBlinkPlatformImpl::FileSystem() { | 499 WebFileSystem* RendererBlinkPlatformImpl::FileSystem() { |
504 return WebFileSystemImpl::ThreadSpecificInstance(default_task_runner_); | 500 return WebFileSystemImpl::ThreadSpecificInstance(default_task_runner_); |
505 } | 501 } |
506 | 502 |
507 WebString RendererBlinkPlatformImpl::FileSystemCreateOriginIdentifier( | 503 WebString RendererBlinkPlatformImpl::FileSystemCreateOriginIdentifier( |
508 const blink::WebSecurityOrigin& origin) { | 504 const blink::WebSecurityOrigin& origin) { |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 } | 677 } |
682 | 678 |
683 unsigned RendererBlinkPlatformImpl::AudioHardwareOutputChannels() { | 679 unsigned RendererBlinkPlatformImpl::AudioHardwareOutputChannels() { |
684 return GetAudioHardwareParams().channels(); | 680 return GetAudioHardwareParams().channels(); |
685 } | 681 } |
686 | 682 |
687 WebDatabaseObserver* RendererBlinkPlatformImpl::DatabaseObserver() { | 683 WebDatabaseObserver* RendererBlinkPlatformImpl::DatabaseObserver() { |
688 return web_database_observer_impl_.get(); | 684 return web_database_observer_impl_.get(); |
689 } | 685 } |
690 | 686 |
691 std::unique_ptr<WebAudioDevice> RendererBlinkPlatformImpl::CreateAudioDevice( | 687 WebAudioDevice* RendererBlinkPlatformImpl::CreateAudioDevice( |
692 unsigned input_channels, | 688 unsigned input_channels, |
693 unsigned channels, | 689 unsigned channels, |
694 const blink::WebAudioLatencyHint& latency_hint, | 690 const blink::WebAudioLatencyHint& latency_hint, |
695 WebAudioDevice::RenderCallback* callback, | 691 WebAudioDevice::RenderCallback* callback, |
696 const blink::WebString& input_device_id, | 692 const blink::WebString& input_device_id, |
697 const blink::WebSecurityOrigin& security_origin) { | 693 const blink::WebSecurityOrigin& security_origin) { |
698 // Use a mock for testing. | 694 // Use a mock for testing. |
699 std::unique_ptr<blink::WebAudioDevice> mock_device = | 695 blink::WebAudioDevice* mock_device = |
700 GetContentClient()->renderer()->OverrideCreateAudioDevice(latency_hint); | 696 GetContentClient()->renderer()->OverrideCreateAudioDevice(latency_hint); |
701 if (mock_device) | 697 if (mock_device) |
702 return mock_device; | 698 return mock_device; |
703 | 699 |
704 // The |channels| does not exactly identify the channel layout of the | 700 // The |channels| does not exactly identify the channel layout of the |
705 // device. The switch statement below assigns a best guess to the channel | 701 // device. The switch statement below assigns a best guess to the channel |
706 // layout based on number of channels. | 702 // layout based on number of channels. |
707 media::ChannelLayout layout = media::GuessChannelLayout(channels); | 703 media::ChannelLayout layout = media::GuessChannelLayout(channels); |
708 if (layout == media::CHANNEL_LAYOUT_UNSUPPORTED) | 704 if (layout == media::CHANNEL_LAYOUT_UNSUPPORTED) |
709 layout = media::CHANNEL_LAYOUT_DISCRETE; | 705 layout = media::CHANNEL_LAYOUT_DISCRETE; |
(...skipping 12 matching lines...) Expand all Loading... |
722 bool RendererBlinkPlatformImpl::LoadAudioResource( | 718 bool RendererBlinkPlatformImpl::LoadAudioResource( |
723 blink::WebAudioBus* destination_bus, | 719 blink::WebAudioBus* destination_bus, |
724 const char* audio_file_data, | 720 const char* audio_file_data, |
725 size_t data_size) { | 721 size_t data_size) { |
726 return DecodeAudioFileData( | 722 return DecodeAudioFileData( |
727 destination_bus, audio_file_data, data_size); | 723 destination_bus, audio_file_data, data_size); |
728 } | 724 } |
729 | 725 |
730 //------------------------------------------------------------------------------ | 726 //------------------------------------------------------------------------------ |
731 | 727 |
732 std::unique_ptr<blink::WebMIDIAccessor> | 728 blink::WebMIDIAccessor* RendererBlinkPlatformImpl::CreateMIDIAccessor( |
733 RendererBlinkPlatformImpl::CreateMIDIAccessor( | |
734 blink::WebMIDIAccessorClient* client) { | 729 blink::WebMIDIAccessorClient* client) { |
735 std::unique_ptr<blink::WebMIDIAccessor> accessor = | 730 blink::WebMIDIAccessor* accessor = |
736 GetContentClient()->renderer()->OverrideCreateMIDIAccessor(client); | 731 GetContentClient()->renderer()->OverrideCreateMIDIAccessor(client); |
737 if (accessor) | 732 if (accessor) |
738 return accessor; | 733 return accessor; |
739 | 734 |
740 return base::MakeUnique<RendererWebMIDIAccessorImpl>(client); | 735 return new RendererWebMIDIAccessorImpl(client); |
741 } | 736 } |
742 | 737 |
743 void RendererBlinkPlatformImpl::GetPluginList( | 738 void RendererBlinkPlatformImpl::GetPluginList( |
744 bool refresh, | 739 bool refresh, |
745 const blink::WebSecurityOrigin& mainFrameOrigin, | 740 const blink::WebSecurityOrigin& mainFrameOrigin, |
746 blink::WebPluginListBuilder* builder) { | 741 blink::WebPluginListBuilder* builder) { |
747 #if BUILDFLAG(ENABLE_PLUGINS) | 742 #if BUILDFLAG(ENABLE_PLUGINS) |
748 std::vector<WebPluginInfo> plugins; | 743 std::vector<WebPluginInfo> plugins; |
749 if (!plugin_refresh_allowed_) | 744 if (!plugin_refresh_allowed_) |
750 refresh = false; | 745 refresh = false; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 void RendererBlinkPlatformImpl::SampleGamepads(device::Gamepads& gamepads) { | 788 void RendererBlinkPlatformImpl::SampleGamepads(device::Gamepads& gamepads) { |
794 PlatformEventObserverBase* observer = | 789 PlatformEventObserverBase* observer = |
795 platform_event_observers_.Lookup(blink::kWebPlatformEventTypeGamepad); | 790 platform_event_observers_.Lookup(blink::kWebPlatformEventTypeGamepad); |
796 if (!observer) | 791 if (!observer) |
797 return; | 792 return; |
798 static_cast<RendererGamepadProvider*>(observer)->SampleGamepads(gamepads); | 793 static_cast<RendererGamepadProvider*>(observer)->SampleGamepads(gamepads); |
799 } | 794 } |
800 | 795 |
801 //------------------------------------------------------------------------------ | 796 //------------------------------------------------------------------------------ |
802 | 797 |
803 std::unique_ptr<WebMediaRecorderHandler> | 798 WebMediaRecorderHandler* |
804 RendererBlinkPlatformImpl::CreateMediaRecorderHandler() { | 799 RendererBlinkPlatformImpl::CreateMediaRecorderHandler() { |
805 #if BUILDFLAG(ENABLE_WEBRTC) | 800 #if BUILDFLAG(ENABLE_WEBRTC) |
806 return base::MakeUnique<content::MediaRecorderHandler>(); | 801 return new content::MediaRecorderHandler(); |
807 #else | 802 #else |
808 return nullptr; | 803 return nullptr; |
809 #endif | 804 #endif |
810 } | 805 } |
811 | 806 |
812 //------------------------------------------------------------------------------ | 807 //------------------------------------------------------------------------------ |
813 | 808 |
814 std::unique_ptr<WebRTCPeerConnectionHandler> | 809 WebRTCPeerConnectionHandler* |
815 RendererBlinkPlatformImpl::CreateRTCPeerConnectionHandler( | 810 RendererBlinkPlatformImpl::CreateRTCPeerConnectionHandler( |
816 WebRTCPeerConnectionHandlerClient* client) { | 811 WebRTCPeerConnectionHandlerClient* client) { |
817 RenderThreadImpl* render_thread = RenderThreadImpl::current(); | 812 RenderThreadImpl* render_thread = RenderThreadImpl::current(); |
818 DCHECK(render_thread); | 813 DCHECK(render_thread); |
819 if (!render_thread) | 814 if (!render_thread) |
820 return nullptr; | 815 return NULL; |
821 | 816 |
822 #if BUILDFLAG(ENABLE_WEBRTC) | 817 #if BUILDFLAG(ENABLE_WEBRTC) |
823 std::unique_ptr<WebRTCPeerConnectionHandler> peer_connection_handler = | 818 WebRTCPeerConnectionHandler* peer_connection_handler = |
824 GetContentClient()->renderer()->OverrideCreateWebRTCPeerConnectionHandler( | 819 GetContentClient()->renderer()->OverrideCreateWebRTCPeerConnectionHandler( |
825 client); | 820 client); |
826 if (peer_connection_handler) | 821 if (peer_connection_handler) |
827 return peer_connection_handler; | 822 return peer_connection_handler; |
828 | 823 |
829 PeerConnectionDependencyFactory* rtc_dependency_factory = | 824 PeerConnectionDependencyFactory* rtc_dependency_factory = |
830 render_thread->GetPeerConnectionDependencyFactory(); | 825 render_thread->GetPeerConnectionDependencyFactory(); |
831 return rtc_dependency_factory->CreateRTCPeerConnectionHandler(client); | 826 return rtc_dependency_factory->CreateRTCPeerConnectionHandler(client); |
832 #else | 827 #else |
833 return nullptr; | 828 return NULL; |
834 #endif // BUILDFLAG(ENABLE_WEBRTC) | 829 #endif // BUILDFLAG(ENABLE_WEBRTC) |
835 } | 830 } |
836 | 831 |
837 //------------------------------------------------------------------------------ | 832 //------------------------------------------------------------------------------ |
838 | 833 |
839 std::unique_ptr<blink::WebRTCCertificateGenerator> | 834 blink::WebRTCCertificateGenerator* |
840 RendererBlinkPlatformImpl::CreateRTCCertificateGenerator() { | 835 RendererBlinkPlatformImpl::CreateRTCCertificateGenerator() { |
841 #if BUILDFLAG(ENABLE_WEBRTC) | 836 #if BUILDFLAG(ENABLE_WEBRTC) |
842 return base::MakeUnique<RTCCertificateGenerator>(); | 837 return new RTCCertificateGenerator(); |
843 #else | 838 #else |
844 return nullptr; | 839 return nullptr; |
845 #endif // BUILDFLAG(ENABLE_WEBRTC) | 840 #endif // BUILDFLAG(ENABLE_WEBRTC) |
846 } | 841 } |
847 | 842 |
848 //------------------------------------------------------------------------------ | 843 //------------------------------------------------------------------------------ |
849 | 844 |
850 std::unique_ptr<WebMediaStreamCenter> | 845 WebMediaStreamCenter* RendererBlinkPlatformImpl::CreateMediaStreamCenter( |
851 RendererBlinkPlatformImpl::CreateMediaStreamCenter( | |
852 WebMediaStreamCenterClient* client) { | 846 WebMediaStreamCenterClient* client) { |
853 RenderThreadImpl* render_thread = RenderThreadImpl::current(); | 847 RenderThreadImpl* render_thread = RenderThreadImpl::current(); |
854 DCHECK(render_thread); | 848 DCHECK(render_thread); |
855 if (!render_thread) | 849 if (!render_thread) |
856 return nullptr; | 850 return NULL; |
857 return render_thread->CreateMediaStreamCenter(client); | 851 return render_thread->CreateMediaStreamCenter(client); |
858 } | 852 } |
859 | 853 |
860 // static | 854 // static |
861 bool RendererBlinkPlatformImpl::SetSandboxEnabledForTesting(bool enable) { | 855 bool RendererBlinkPlatformImpl::SetSandboxEnabledForTesting(bool enable) { |
862 bool was_enabled = g_sandbox_enabled; | 856 bool was_enabled = g_sandbox_enabled; |
863 g_sandbox_enabled = enable; | 857 g_sandbox_enabled = enable; |
864 return was_enabled; | 858 return was_enabled; |
865 } | 859 } |
866 | 860 |
867 //------------------------------------------------------------------------------ | 861 //------------------------------------------------------------------------------ |
868 | 862 |
869 std::unique_ptr<WebCanvasCaptureHandler> | 863 WebCanvasCaptureHandler* RendererBlinkPlatformImpl::CreateCanvasCaptureHandler( |
870 RendererBlinkPlatformImpl::CreateCanvasCaptureHandler( | |
871 const WebSize& size, | 864 const WebSize& size, |
872 double frame_rate, | 865 double frame_rate, |
873 WebMediaStreamTrack* track) { | 866 WebMediaStreamTrack* track) { |
874 #if BUILDFLAG(ENABLE_WEBRTC) | 867 #if BUILDFLAG(ENABLE_WEBRTC) |
875 return CanvasCaptureHandler::CreateCanvasCaptureHandler( | 868 return CanvasCaptureHandler::CreateCanvasCaptureHandler( |
876 size, frame_rate, RenderThread::Get()->GetIOTaskRunner(), track); | 869 size, frame_rate, RenderThread::Get()->GetIOTaskRunner(), track); |
877 #else | 870 #else |
878 return nullptr; | 871 return nullptr; |
879 #endif // BUILDFLAG(ENABLE_WEBRTC) | 872 #endif // BUILDFLAG(ENABLE_WEBRTC) |
880 } | 873 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 // Takes ownership of |media_stream_source|. | 911 // Takes ownership of |media_stream_source|. |
919 web_media_stream_source.SetExtraData(media_stream_source); | 912 web_media_stream_source.SetExtraData(media_stream_source); |
920 | 913 |
921 media_stream_source->ConnectToTrack(web_media_stream_track); | 914 media_stream_source->ConnectToTrack(web_media_stream_track); |
922 web_media_stream->AddTrack(web_media_stream_track); | 915 web_media_stream->AddTrack(web_media_stream_track); |
923 #endif | 916 #endif |
924 } | 917 } |
925 | 918 |
926 //------------------------------------------------------------------------------ | 919 //------------------------------------------------------------------------------ |
927 | 920 |
928 std::unique_ptr<WebImageCaptureFrameGrabber> | 921 WebImageCaptureFrameGrabber* |
929 RendererBlinkPlatformImpl::CreateImageCaptureFrameGrabber() { | 922 RendererBlinkPlatformImpl::CreateImageCaptureFrameGrabber() { |
930 #if BUILDFLAG(ENABLE_WEBRTC) | 923 #if BUILDFLAG(ENABLE_WEBRTC) |
931 return base::MakeUnique<ImageCaptureFrameGrabber>(); | 924 return new ImageCaptureFrameGrabber(); |
932 #else | 925 #else |
933 return nullptr; | 926 return nullptr; |
934 #endif // BUILDFLAG(ENABLE_WEBRTC) | 927 #endif // BUILDFLAG(ENABLE_WEBRTC) |
935 } | 928 } |
936 | 929 |
937 //------------------------------------------------------------------------------ | 930 //------------------------------------------------------------------------------ |
938 | 931 |
939 std::unique_ptr<blink::WebSpeechSynthesizer> | 932 blink::WebSpeechSynthesizer* RendererBlinkPlatformImpl::CreateSpeechSynthesizer( |
940 RendererBlinkPlatformImpl::CreateSpeechSynthesizer( | |
941 blink::WebSpeechSynthesizerClient* client) { | 933 blink::WebSpeechSynthesizerClient* client) { |
942 return GetContentClient()->renderer()->OverrideSpeechSynthesizer(client); | 934 return GetContentClient()->renderer()->OverrideSpeechSynthesizer(client); |
943 } | 935 } |
944 | 936 |
945 //------------------------------------------------------------------------------ | 937 //------------------------------------------------------------------------------ |
946 | 938 |
947 static void Collect3DContextInformation( | 939 static void Collect3DContextInformation( |
948 blink::Platform::GraphicsInfo* gl_info, | 940 blink::Platform::GraphicsInfo* gl_info, |
949 const gpu::GPUInfo& gpu_info) { | 941 const gpu::GPUInfo& gpu_info) { |
950 DCHECK(gl_info); | 942 DCHECK(gl_info); |
(...skipping 14 matching lines...) Expand all Loading... |
965 break; | 957 break; |
966 case gpu::kCollectInfoFatalFailure: | 958 case gpu::kCollectInfoFatalFailure: |
967 case gpu::kCollectInfoNone: | 959 case gpu::kCollectInfoNone: |
968 gl_info->error_message = WebString::FromUTF8( | 960 gl_info->error_message = WebString::FromUTF8( |
969 "Failed to collect gpu information, GLSurface or GLContext " | 961 "Failed to collect gpu information, GLSurface or GLContext " |
970 "creation failed"); | 962 "creation failed"); |
971 break; | 963 break; |
972 } | 964 } |
973 } | 965 } |
974 | 966 |
975 std::unique_ptr<blink::WebGraphicsContext3DProvider> | 967 blink::WebGraphicsContext3DProvider* |
976 RendererBlinkPlatformImpl::CreateOffscreenGraphicsContext3DProvider( | 968 RendererBlinkPlatformImpl::CreateOffscreenGraphicsContext3DProvider( |
977 const blink::Platform::ContextAttributes& web_attributes, | 969 const blink::Platform::ContextAttributes& web_attributes, |
978 const blink::WebURL& top_document_web_url, | 970 const blink::WebURL& top_document_web_url, |
979 blink::WebGraphicsContext3DProvider* share_provider, | 971 blink::WebGraphicsContext3DProvider* share_provider, |
980 blink::Platform::GraphicsInfo* gl_info) { | 972 blink::Platform::GraphicsInfo* gl_info) { |
981 DCHECK(gl_info); | 973 DCHECK(gl_info); |
982 if (!RenderThreadImpl::current()) { | 974 if (!RenderThreadImpl::current()) { |
983 std::string error_message("Failed to run in Current RenderThreadImpl"); | 975 std::string error_message("Failed to run in Current RenderThreadImpl"); |
984 gl_info->error_message = WebString::FromUTF8(error_message); | 976 gl_info->error_message = WebString::FromUTF8(error_message); |
985 return nullptr; | 977 return nullptr; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 constexpr bool automatic_flushes = true; | 1035 constexpr bool automatic_flushes = true; |
1044 constexpr bool support_locking = false; | 1036 constexpr bool support_locking = false; |
1045 | 1037 |
1046 scoped_refptr<ui::ContextProviderCommandBuffer> provider( | 1038 scoped_refptr<ui::ContextProviderCommandBuffer> provider( |
1047 new ui::ContextProviderCommandBuffer( | 1039 new ui::ContextProviderCommandBuffer( |
1048 std::move(gpu_channel_host), gpu::GPU_STREAM_DEFAULT, | 1040 std::move(gpu_channel_host), gpu::GPU_STREAM_DEFAULT, |
1049 gpu::GpuStreamPriority::NORMAL, gpu::kNullSurfaceHandle, | 1041 gpu::GpuStreamPriority::NORMAL, gpu::kNullSurfaceHandle, |
1050 GURL(top_document_web_url), automatic_flushes, support_locking, | 1042 GURL(top_document_web_url), automatic_flushes, support_locking, |
1051 gpu::SharedMemoryLimits(), attributes, share_context, | 1043 gpu::SharedMemoryLimits(), attributes, share_context, |
1052 ui::command_buffer_metrics::OFFSCREEN_CONTEXT_FOR_WEBGL)); | 1044 ui::command_buffer_metrics::OFFSCREEN_CONTEXT_FOR_WEBGL)); |
1053 return base::MakeUnique<WebGraphicsContext3DProviderImpl>( | 1045 return new WebGraphicsContext3DProviderImpl(std::move(provider), |
1054 std::move(provider), is_software_rendering); | 1046 is_software_rendering); |
1055 } | 1047 } |
1056 | 1048 |
1057 //------------------------------------------------------------------------------ | 1049 //------------------------------------------------------------------------------ |
1058 | 1050 |
1059 std::unique_ptr<blink::WebGraphicsContext3DProvider> | 1051 blink::WebGraphicsContext3DProvider* |
1060 RendererBlinkPlatformImpl::CreateSharedOffscreenGraphicsContext3DProvider() { | 1052 RendererBlinkPlatformImpl::CreateSharedOffscreenGraphicsContext3DProvider() { |
1061 auto* thread = RenderThreadImpl::current(); | 1053 auto* thread = RenderThreadImpl::current(); |
1062 | 1054 |
1063 scoped_refptr<ui::ContextProviderCommandBuffer> provider = | 1055 scoped_refptr<ui::ContextProviderCommandBuffer> provider = |
1064 thread->SharedMainThreadContextProvider(); | 1056 thread->SharedMainThreadContextProvider(); |
1065 if (!provider) | 1057 if (!provider) |
1066 return nullptr; | 1058 return nullptr; |
1067 | 1059 |
1068 scoped_refptr<gpu::GpuChannelHost> host = thread->EstablishGpuChannelSync(); | 1060 scoped_refptr<gpu::GpuChannelHost> host = thread->EstablishGpuChannelSync(); |
1069 // This shouldn't normally fail because we just got |provider|. But the | 1061 // This shouldn't normally fail because we just got |provider|. But the |
1070 // channel can become lost on the IO thread since then. It is important that | 1062 // channel can become lost on the IO thread since then. It is important that |
1071 // this happens after getting |provider|. In the case that this GpuChannelHost | 1063 // this happens after getting |provider|. In the case that this GpuChannelHost |
1072 // is not the same one backing |provider|, the context behind the |provider| | 1064 // is not the same one backing |provider|, the context behind the |provider| |
1073 // will be already lost/dead on arrival, so the value we get for | 1065 // will be already lost/dead on arrival, so the value we get for |
1074 // |is_software_rendering| will never be wrong. | 1066 // |is_software_rendering| will never be wrong. |
1075 if (!host) | 1067 if (!host) |
1076 return nullptr; | 1068 return nullptr; |
1077 | 1069 |
1078 bool is_software_rendering = host->gpu_info().software_rendering; | 1070 bool is_software_rendering = host->gpu_info().software_rendering; |
1079 | 1071 |
1080 return base::MakeUnique<WebGraphicsContext3DProviderImpl>( | 1072 return new WebGraphicsContext3DProviderImpl(std::move(provider), |
1081 std::move(provider), is_software_rendering); | 1073 is_software_rendering); |
1082 } | 1074 } |
1083 | 1075 |
1084 //------------------------------------------------------------------------------ | 1076 //------------------------------------------------------------------------------ |
1085 | 1077 |
1086 gpu::GpuMemoryBufferManager* | 1078 gpu::GpuMemoryBufferManager* |
1087 RendererBlinkPlatformImpl::GetGpuMemoryBufferManager() { | 1079 RendererBlinkPlatformImpl::GetGpuMemoryBufferManager() { |
1088 RenderThreadImpl* thread = RenderThreadImpl::current(); | 1080 RenderThreadImpl* thread = RenderThreadImpl::current(); |
1089 return thread ? thread->GetGpuMemoryBufferManager() : nullptr; | 1081 return thread ? thread->GetGpuMemoryBufferManager() : nullptr; |
1090 } | 1082 } |
1091 | 1083 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1299 //------------------------------------------------------------------------------ | 1291 //------------------------------------------------------------------------------ |
1300 void RendererBlinkPlatformImpl::RequestPurgeMemory() { | 1292 void RendererBlinkPlatformImpl::RequestPurgeMemory() { |
1301 // TODO(tasak|bashi): We should use ChildMemoryCoordinator here, but | 1293 // TODO(tasak|bashi): We should use ChildMemoryCoordinator here, but |
1302 // ChildMemoryCoordinator isn't always available as it's only initialized | 1294 // ChildMemoryCoordinator isn't always available as it's only initialized |
1303 // when kMemoryCoordinatorV0 is enabled. | 1295 // when kMemoryCoordinatorV0 is enabled. |
1304 // Use ChildMemoryCoordinator when memory coordinator is always enabled. | 1296 // Use ChildMemoryCoordinator when memory coordinator is always enabled. |
1305 base::MemoryCoordinatorClientRegistry::GetInstance()->PurgeMemory(); | 1297 base::MemoryCoordinatorClientRegistry::GetInstance()->PurgeMemory(); |
1306 } | 1298 } |
1307 | 1299 |
1308 } // namespace content | 1300 } // namespace content |
OLD | NEW |