| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 bool g_sandbox_enabled = true; | 156 bool g_sandbox_enabled = true; |
| 157 double g_test_device_light_data = -1; | 157 double g_test_device_light_data = -1; |
| 158 base::LazyInstance<blink::WebDeviceMotionData>::Leaky | 158 base::LazyInstance<blink::WebDeviceMotionData>::Leaky |
| 159 g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER; | 159 g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER; |
| 160 base::LazyInstance<blink::WebDeviceOrientationData>::Leaky | 160 base::LazyInstance<blink::WebDeviceOrientationData>::Leaky |
| 161 g_test_device_orientation_data = LAZY_INSTANCE_INITIALIZER; | 161 g_test_device_orientation_data = LAZY_INSTANCE_INITIALIZER; |
| 162 // Set in startListening() when running layout tests, unset in stopListening(), | 162 // Set in startListening() when running layout tests, unset in stopListening(), |
| 163 // not owned by us. | 163 // not owned by us. |
| 164 blink::WebBatteryStatusListener* g_test_battery_status_listener = nullptr; | 164 blink::WebBatteryStatusListener* g_test_battery_status_listener = nullptr; |
| 165 | 165 |
| 166 } // namespace | 166 } // namespace |
| 167 | 167 |
| 168 //------------------------------------------------------------------------------ | 168 //------------------------------------------------------------------------------ |
| 169 | 169 |
| 170 class RendererBlinkPlatformImpl::MimeRegistry | 170 class RendererBlinkPlatformImpl::MimeRegistry |
| 171 : public SimpleWebMimeRegistryImpl { | 171 : public SimpleWebMimeRegistryImpl { |
| 172 public: | 172 public: |
| 173 virtual blink::WebMimeRegistry::SupportsType supportsMediaMIMEType( | 173 virtual blink::WebMimeRegistry::SupportsType supportsMediaMIMEType( |
| 174 const blink::WebString& mime_type, | 174 const blink::WebString& mime_type, |
| 175 const blink::WebString& codecs, | 175 const blink::WebString& codecs, |
| 176 const blink::WebString& key_system); | 176 const blink::WebString& key_system); |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 !base::StringToInt(base::UTF16ToUTF8( | 730 !base::StringToInt(base::UTF16ToUTF8( |
| 731 base::StringPiece16(input_device_id)), &session_id)) { | 731 base::StringPiece16(input_device_id)), &session_id)) { |
| 732 if (input_channels > 0) | 732 if (input_channels > 0) |
| 733 DLOG(WARNING) << "createAudioDevice(): request for audio input ignored"; | 733 DLOG(WARNING) << "createAudioDevice(): request for audio input ignored"; |
| 734 | 734 |
| 735 input_channels = 0; | 735 input_channels = 0; |
| 736 } | 736 } |
| 737 | 737 |
| 738 // For CHANNEL_LAYOUT_DISCRETE, pass the explicit channel count along with | 738 // For CHANNEL_LAYOUT_DISCRETE, pass the explicit channel count along with |
| 739 // the channel layout when creating an |AudioParameters| object. | 739 // the channel layout when creating an |AudioParameters| object. |
| 740 media::AudioParameters params( | 740 media::AudioParameters params(media::AudioParameters::AUDIO_PCM_LOW_LATENCY, |
| 741 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, | 741 layout, static_cast<int>(sample_rate), 16, |
| 742 layout, channels, static_cast<int>(sample_rate), 16, buffer_size, | 742 buffer_size); |
| 743 media::AudioParameters::NO_EFFECTS); | 743 params.set_channels_for_discrete(channels); |
| 744 | 744 |
| 745 return new RendererWebAudioDeviceImpl(params, callback, session_id); | 745 return new RendererWebAudioDeviceImpl(params, callback, session_id); |
| 746 } | 746 } |
| 747 | 747 |
| 748 #if defined(OS_ANDROID) | 748 #if defined(OS_ANDROID) |
| 749 bool RendererBlinkPlatformImpl::loadAudioResource( | 749 bool RendererBlinkPlatformImpl::loadAudioResource( |
| 750 blink::WebAudioBus* destination_bus, | 750 blink::WebAudioBus* destination_bus, |
| 751 const char* audio_file_data, | 751 const char* audio_file_data, |
| 752 size_t data_size) { | 752 size_t data_size) { |
| 753 return DecodeAudioFileData(destination_bus, | 753 return DecodeAudioFileData(destination_bus, |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 gl_info->deviceId = gpu_info.gpu.device_id; | 988 gl_info->deviceId = gpu_info.gpu.device_id; |
| 989 break; | 989 break; |
| 990 case gpu::kCollectInfoFatalFailure: | 990 case gpu::kCollectInfoFatalFailure: |
| 991 case gpu::kCollectInfoNone: | 991 case gpu::kCollectInfoNone: |
| 992 gl_info->contextInfoCollectionFailure.assign(blink::WebString::fromUTF8( | 992 gl_info->contextInfoCollectionFailure.assign(blink::WebString::fromUTF8( |
| 993 "GPUInfoCollectionFailure: GPU initialization Failed. GPU " | 993 "GPUInfoCollectionFailure: GPU initialization Failed. GPU " |
| 994 "Info not Collected.")); | 994 "Info not Collected.")); |
| 995 break; | 995 break; |
| 996 default: | 996 default: |
| 997 NOTREACHED(); | 997 NOTREACHED(); |
| 998 }; | 998 } |
| 999 } | 999 } |
| 1000 | 1000 |
| 1001 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; | 1001 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; |
| 1002 bool lose_context_when_out_of_memory = false; | 1002 bool lose_context_when_out_of_memory = false; |
| 1003 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( | 1003 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( |
| 1004 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 1004 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
| 1005 gpu_channel_host.get(), | 1005 gpu_channel_host.get(), |
| 1006 attributes, | 1006 attributes, |
| 1007 lose_context_when_out_of_memory, | 1007 lose_context_when_out_of_memory, |
| 1008 GURL(attributes.topDocumentURL), | 1008 GURL(attributes.topDocumentURL), |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1246 //------------------------------------------------------------------------------ | 1246 //------------------------------------------------------------------------------ |
| 1247 | 1247 |
| 1248 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( | 1248 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( |
| 1249 const blink::WebBatteryStatus& status) { | 1249 const blink::WebBatteryStatus& status) { |
| 1250 if (!g_test_battery_status_listener) | 1250 if (!g_test_battery_status_listener) |
| 1251 return; | 1251 return; |
| 1252 g_test_battery_status_listener->updateBatteryStatus(status); | 1252 g_test_battery_status_listener->updateBatteryStatus(status); |
| 1253 } | 1253 } |
| 1254 | 1254 |
| 1255 } // namespace content | 1255 } // namespace content |
| OLD | NEW |