Chromium Code Reviews| 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_webkitplatformsupport_impl.h" | 5 #include "content/renderer/renderer_webkitplatformsupport_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "base/platform_file.h" | 11 #include "base/platform_file.h" |
| 12 #include "base/shared_memory.h" | 12 #include "base/shared_memory.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "content/common/database_util.h" | 14 #include "content/common/database_util.h" |
| 15 #include "content/common/fileapi/webblobregistry_impl.h" | 15 #include "content/common/fileapi/webblobregistry_impl.h" |
| 16 #include "content/common/fileapi/webfilesystem_impl.h" | 16 #include "content/common/fileapi/webfilesystem_impl.h" |
| 17 #include "content/common/file_utilities_messages.h" | 17 #include "content/common/file_utilities_messages.h" |
| 18 #include "content/common/indexed_db/proxy_webidbfactory_impl.h" | 18 #include "content/common/indexed_db/proxy_webidbfactory_impl.h" |
| 19 #include "content/common/mime_registry_messages.h" | 19 #include "content/common/mime_registry_messages.h" |
| 20 #include "content/common/npobject_util.h" | 20 #include "content/common/npobject_util.h" |
| 21 #include "content/common/view_messages.h" | 21 #include "content/common/view_messages.h" |
| 22 #include "content/common/webmessageportchannel_impl.h" | 22 #include "content/common/webmessageportchannel_impl.h" |
| 23 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
| 24 #include "content/public/common/gpu_info.h" | 24 #include "content/public/common/gpu_info.h" |
| 25 #include "content/public/renderer/content_renderer_client.h" | 25 #include "content/public/renderer/content_renderer_client.h" |
| 26 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" | 26 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" |
| 27 #include "content/renderer/gamepad_shared_memory_reader.h" | 27 #include "content/renderer/gamepad_shared_memory_reader.h" |
| 28 #include "content/renderer/media/audio_hardware.h" | 28 #include "content/renderer/media/audio_hardware.h" |
| 29 #include "content/renderer/media/renderer_webaudiodevice_impl.h" | |
| 30 #include "content/renderer/render_thread_impl.h" | 29 #include "content/renderer/render_thread_impl.h" |
| 31 #include "content/renderer/render_view_impl.h" | 30 #include "content/renderer/render_view_impl.h" |
| 32 #include "content/renderer/renderer_clipboard_client.h" | 31 #include "content/renderer/renderer_clipboard_client.h" |
| 33 #include "content/renderer/websharedworkerrepository_impl.h" | 32 #include "content/renderer/websharedworkerrepository_impl.h" |
| 34 #include "googleurl/src/gurl.h" | 33 #include "googleurl/src/gurl.h" |
| 35 #include "ipc/ipc_sync_message_filter.h" | 34 #include "ipc/ipc_sync_message_filter.h" |
| 36 #include "media/audio/audio_output_device.h" | 35 #include "media/audio/audio_output_device.h" |
| 37 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebBlobRegis try.h" | 36 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebBlobRegis try.h" |
| 38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileInfo.h" | 37 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileInfo.h" |
| 39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 590 size_t RendererWebKitPlatformSupportImpl::audioHardwareBufferSize() { | 589 size_t RendererWebKitPlatformSupportImpl::audioHardwareBufferSize() { |
| 591 return audio_hardware::GetOutputBufferSize(); | 590 return audio_hardware::GetOutputBufferSize(); |
| 592 } | 591 } |
| 593 | 592 |
| 594 WebAudioDevice* | 593 WebAudioDevice* |
| 595 RendererWebKitPlatformSupportImpl::createAudioDevice( | 594 RendererWebKitPlatformSupportImpl::createAudioDevice( |
| 596 size_t bufferSize, | 595 size_t bufferSize, |
| 597 unsigned numberOfChannels, | 596 unsigned numberOfChannels, |
| 598 double sampleRate, | 597 double sampleRate, |
| 599 WebAudioDevice::RenderCallback* callback) { | 598 WebAudioDevice::RenderCallback* callback) { |
| 600 ChannelLayout layout = CHANNEL_LAYOUT_UNSUPPORTED; | 599 CHECK(false); |
|
tommi (sloooow) - chröme
2012/07/31 10:52:41
add a comment that explains why this CHECK is here
sail
2012/07/31 22:02:08
Done.
| |
| 601 | 600 return NULL; |
| 602 // The |numberOfChannels| does not exactly identify the channel layout of the | |
| 603 // device. The switch statement below assigns a best guess to the channel | |
| 604 // layout based on number of channels. | |
| 605 // TODO(crogers): WebKit should give the channel layout instead of the hard | |
| 606 // channel count. | |
| 607 switch (numberOfChannels) { | |
| 608 case 1: | |
| 609 layout = CHANNEL_LAYOUT_MONO; | |
| 610 break; | |
| 611 case 2: | |
| 612 layout = CHANNEL_LAYOUT_STEREO; | |
| 613 break; | |
| 614 case 3: | |
| 615 layout = CHANNEL_LAYOUT_2_1; | |
| 616 break; | |
| 617 case 4: | |
| 618 layout = CHANNEL_LAYOUT_4_0; | |
| 619 break; | |
| 620 case 5: | |
| 621 layout = CHANNEL_LAYOUT_5_0; | |
| 622 break; | |
| 623 case 6: | |
| 624 layout = CHANNEL_LAYOUT_5_1; | |
| 625 break; | |
| 626 case 7: | |
| 627 layout = CHANNEL_LAYOUT_7_0; | |
| 628 break; | |
| 629 case 8: | |
| 630 layout = CHANNEL_LAYOUT_7_1; | |
| 631 break; | |
| 632 default: | |
| 633 layout = CHANNEL_LAYOUT_STEREO; | |
| 634 } | |
| 635 | |
| 636 media::AudioParameters params( | |
| 637 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, layout, | |
| 638 static_cast<int>(sampleRate), 16, bufferSize); | |
| 639 | |
| 640 return new RendererWebAudioDeviceImpl(params, callback); | |
| 641 } | 601 } |
| 642 | 602 |
| 643 //------------------------------------------------------------------------------ | 603 //------------------------------------------------------------------------------ |
| 644 | 604 |
| 645 WebKit::WebString | 605 WebKit::WebString |
| 646 RendererWebKitPlatformSupportImpl::signedPublicKeyAndChallengeString( | 606 RendererWebKitPlatformSupportImpl::signedPublicKeyAndChallengeString( |
| 647 unsigned key_size_index, | 607 unsigned key_size_index, |
| 648 const WebKit::WebString& challenge, | 608 const WebKit::WebString& challenge, |
| 649 const WebKit::WebURL& url) { | 609 const WebKit::WebURL& url) { |
| 650 std::string signed_public_key; | 610 std::string signed_public_key; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 728 bool enable) { | 688 bool enable) { |
| 729 bool was_enabled = g_sandbox_enabled; | 689 bool was_enabled = g_sandbox_enabled; |
| 730 g_sandbox_enabled = enable; | 690 g_sandbox_enabled = enable; |
| 731 return was_enabled; | 691 return was_enabled; |
| 732 } | 692 } |
| 733 | 693 |
| 734 GpuChannelHostFactory* | 694 GpuChannelHostFactory* |
| 735 RendererWebKitPlatformSupportImpl::GetGpuChannelHostFactory() { | 695 RendererWebKitPlatformSupportImpl::GetGpuChannelHostFactory() { |
| 736 return RenderThreadImpl::current(); | 696 return RenderThreadImpl::current(); |
| 737 } | 697 } |
| OLD | NEW |