| 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 <utility> | 7 #include <utility> | 
| 8 | 8 | 
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" | 
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" | 
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 80 #include "media/filters/stream_parser_factory.h" | 80 #include "media/filters/stream_parser_factory.h" | 
| 81 #include "mojo/common/common_type_converters.h" | 81 #include "mojo/common/common_type_converters.h" | 
| 82 #include "mojo/public/cpp/bindings/associated_group.h" | 82 #include "mojo/public/cpp/bindings/associated_group.h" | 
| 83 #include "ppapi/features/features.h" | 83 #include "ppapi/features/features.h" | 
| 84 #include "services/service_manager/public/cpp/interface_provider.h" | 84 #include "services/service_manager/public/cpp/interface_provider.h" | 
| 85 #include "storage/common/database/database_identifier.h" | 85 #include "storage/common/database/database_identifier.h" | 
| 86 #include "storage/common/quota/quota_types.h" | 86 #include "storage/common/quota/quota_types.h" | 
| 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/WebBlobRegistry.h" | 91 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" | 
| 91 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" | 92 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" | 
| 92 #include "third_party/WebKit/public/platform/WebFileInfo.h" | 93 #include "third_party/WebKit/public/platform/WebFileInfo.h" | 
| 93 #include "third_party/WebKit/public/platform/WebGamepads.h" | 94 #include "third_party/WebKit/public/platform/WebGamepads.h" | 
| 94 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" | 95 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" | 
| 95 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" | 96 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" | 
| 96 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" | 97 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" | 
| 97 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 98 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 
| 98 #include "third_party/WebKit/public/platform/WebURL.h" | 99 #include "third_party/WebKit/public/platform/WebURL.h" | 
| 99 #include "third_party/WebKit/public/platform/WebVector.h" | 100 #include "third_party/WebKit/public/platform/WebVector.h" | 
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 135 #define WebScrollbarBehaviorImpl blink::WebScrollbarBehavior | 136 #define WebScrollbarBehaviorImpl blink::WebScrollbarBehavior | 
| 136 #endif | 137 #endif | 
| 137 | 138 | 
| 138 #if BUILDFLAG(ENABLE_WEBRTC) | 139 #if BUILDFLAG(ENABLE_WEBRTC) | 
| 139 #include "content/renderer/media/rtc_certificate_generator.h" | 140 #include "content/renderer/media/rtc_certificate_generator.h" | 
| 140 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" | 141 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" | 
| 141 #endif | 142 #endif | 
| 142 | 143 | 
| 143 using blink::Platform; | 144 using blink::Platform; | 
| 144 using blink::WebAudioDevice; | 145 using blink::WebAudioDevice; | 
|  | 146 using blink::WebAudioLatencyHint; | 
| 145 using blink::WebBlobRegistry; | 147 using blink::WebBlobRegistry; | 
| 146 using blink::WebCanvasCaptureHandler; | 148 using blink::WebCanvasCaptureHandler; | 
| 147 using blink::WebDatabaseObserver; | 149 using blink::WebDatabaseObserver; | 
| 148 using blink::WebFileInfo; | 150 using blink::WebFileInfo; | 
| 149 using blink::WebFileSystem; | 151 using blink::WebFileSystem; | 
| 150 using blink::WebGamepad; | 152 using blink::WebGamepad; | 
| 151 using blink::WebGamepads; | 153 using blink::WebGamepads; | 
| 152 using blink::WebIDBFactory; | 154 using blink::WebIDBFactory; | 
| 153 using blink::WebImageCaptureFrameGrabber; | 155 using blink::WebImageCaptureFrameGrabber; | 
| 154 using blink::WebMIDIAccessor; | 156 using blink::WebMIDIAccessor; | 
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 650 | 652 | 
| 651 unsigned RendererBlinkPlatformImpl::audioHardwareOutputChannels() { | 653 unsigned RendererBlinkPlatformImpl::audioHardwareOutputChannels() { | 
| 652   return GetAudioHardwareParams().channels(); | 654   return GetAudioHardwareParams().channels(); | 
| 653 } | 655 } | 
| 654 | 656 | 
| 655 WebDatabaseObserver* RendererBlinkPlatformImpl::databaseObserver() { | 657 WebDatabaseObserver* RendererBlinkPlatformImpl::databaseObserver() { | 
| 656   return web_database_observer_impl_.get(); | 658   return web_database_observer_impl_.get(); | 
| 657 } | 659 } | 
| 658 | 660 | 
| 659 WebAudioDevice* RendererBlinkPlatformImpl::createAudioDevice( | 661 WebAudioDevice* RendererBlinkPlatformImpl::createAudioDevice( | 
| 660     size_t buffer_size, |  | 
| 661     unsigned input_channels, | 662     unsigned input_channels, | 
| 662     unsigned channels, | 663     unsigned channels, | 
| 663     double sample_rate, | 664     const blink::WebAudioLatencyHint& latency_hint, | 
| 664     WebAudioDevice::RenderCallback* callback, | 665     WebAudioDevice::RenderCallback* callback, | 
| 665     const blink::WebString& input_device_id, | 666     const blink::WebString& input_device_id, | 
| 666     const blink::WebSecurityOrigin& security_origin) { | 667     const blink::WebSecurityOrigin& security_origin) { | 
| 667   // Use a mock for testing. | 668   // Use a mock for testing. | 
| 668   blink::WebAudioDevice* mock_device = | 669   blink::WebAudioDevice* mock_device = | 
| 669       GetContentClient()->renderer()->OverrideCreateAudioDevice(sample_rate); | 670       GetContentClient()->renderer()->OverrideCreateAudioDevice( | 
|  | 671           GetAudioHardwareParams().sample_rate(), | 
|  | 672           GetAudioHardwareParams().frames_per_buffer()); | 
| 670   if (mock_device) | 673   if (mock_device) | 
| 671     return mock_device; | 674     return mock_device; | 
| 672 | 675 | 
| 673   // The |channels| does not exactly identify the channel layout of the | 676   // The |channels| does not exactly identify the channel layout of the | 
| 674   // device. The switch statement below assigns a best guess to the channel | 677   // device. The switch statement below assigns a best guess to the channel | 
| 675   // layout based on number of channels. | 678   // layout based on number of channels. | 
| 676   media::ChannelLayout layout = media::CHANNEL_LAYOUT_UNSUPPORTED; | 679   media::ChannelLayout layout = media::CHANNEL_LAYOUT_UNSUPPORTED; | 
| 677   switch (channels) { | 680   switch (channels) { | 
| 678     case 1: | 681     case 1: | 
| 679       layout = media::CHANNEL_LAYOUT_MONO; | 682       layout = media::CHANNEL_LAYOUT_MONO; | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 693     case 6: | 696     case 6: | 
| 694       layout = media::CHANNEL_LAYOUT_5_1; | 697       layout = media::CHANNEL_LAYOUT_5_1; | 
| 695       break; | 698       break; | 
| 696     case 7: | 699     case 7: | 
| 697       layout = media::CHANNEL_LAYOUT_7_0; | 700       layout = media::CHANNEL_LAYOUT_7_0; | 
| 698       break; | 701       break; | 
| 699     case 8: | 702     case 8: | 
| 700       layout = media::CHANNEL_LAYOUT_7_1; | 703       layout = media::CHANNEL_LAYOUT_7_1; | 
| 701       break; | 704       break; | 
| 702     default: | 705     default: | 
| 703       // If the layout is not supported (more than 9 channels), falls back to | 706       // TODO need to also pass 'channels' into RendererWebAudioDeviceImpl for | 
| 704       // discrete mode. | 707       // CHANNEL_LAYOUT_DISCRETE | 
| 705       layout = media::CHANNEL_LAYOUT_DISCRETE; | 708       NOTREACHED(); | 
| 706   } | 709   } | 
| 707 | 710 | 
| 708   int session_id = 0; | 711   int session_id = 0; | 
| 709   if (input_device_id.isNull() || | 712   if (input_device_id.isNull() || | 
| 710       !base::StringToInt(base::UTF16ToUTF8( | 713       !base::StringToInt(base::UTF16ToUTF8( | 
| 711           base::StringPiece16(input_device_id)), &session_id)) { | 714           base::StringPiece16(input_device_id)), &session_id)) { | 
| 712     if (input_channels > 0) | 715     if (input_channels > 0) | 
| 713       DLOG(WARNING) << "createAudioDevice(): request for audio input ignored"; | 716       DLOG(WARNING) << "createAudioDevice(): request for audio input ignored"; | 
| 714 | 717 | 
| 715     input_channels = 0; | 718     input_channels = 0; | 
| 716   } | 719   } | 
| 717 | 720 | 
| 718   // For CHANNEL_LAYOUT_DISCRETE, pass the explicit channel count along with |  | 
| 719   // the channel layout when creating an |AudioParameters| object. |  | 
| 720   media::AudioParameters params(media::AudioParameters::AUDIO_PCM_LOW_LATENCY, |  | 
| 721                                 layout, static_cast<int>(sample_rate), 16, |  | 
| 722                                 buffer_size); |  | 
| 723   params.set_channels_for_discrete(channels); |  | 
| 724 |  | 
| 725   return new RendererWebAudioDeviceImpl( | 721   return new RendererWebAudioDeviceImpl( | 
| 726       params, callback, session_id, static_cast<url::Origin>(security_origin)); | 722       layout, latency_hint, callback, session_id, | 
|  | 723       static_cast<url::Origin>(security_origin)); | 
| 727 } | 724 } | 
| 728 | 725 | 
| 729 bool RendererBlinkPlatformImpl::loadAudioResource( | 726 bool RendererBlinkPlatformImpl::loadAudioResource( | 
| 730     blink::WebAudioBus* destination_bus, | 727     blink::WebAudioBus* destination_bus, | 
| 731     const char* audio_file_data, | 728     const char* audio_file_data, | 
| 732     size_t data_size) { | 729     size_t data_size) { | 
| 733   return DecodeAudioFileData( | 730   return DecodeAudioFileData( | 
| 734       destination_bus, audio_file_data, data_size); | 731       destination_bus, audio_file_data, data_size); | 
| 735 } | 732 } | 
| 736 | 733 | 
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1296   return &trial_token_validator_; | 1293   return &trial_token_validator_; | 
| 1297 } | 1294 } | 
| 1298 | 1295 | 
| 1299 void RendererBlinkPlatformImpl::workerContextCreated( | 1296 void RendererBlinkPlatformImpl::workerContextCreated( | 
| 1300     const v8::Local<v8::Context>& worker) { | 1297     const v8::Local<v8::Context>& worker) { | 
| 1301   GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( | 1298   GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( | 
| 1302       worker); | 1299       worker); | 
| 1303 } | 1300 } | 
| 1304 | 1301 | 
| 1305 }  // namespace content | 1302 }  // namespace content | 
| OLD | NEW | 
|---|