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

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

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

Powered by Google App Engine
This is Rietveld 408576698