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" |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 size_t RendererWebKitPlatformSupportImpl::audioHardwareBufferSize() { | 590 size_t RendererWebKitPlatformSupportImpl::audioHardwareBufferSize() { |
591 return audio_hardware::GetOutputBufferSize(); | 591 return audio_hardware::GetOutputBufferSize(); |
592 } | 592 } |
593 | 593 |
594 WebAudioDevice* | 594 WebAudioDevice* |
595 RendererWebKitPlatformSupportImpl::createAudioDevice( | 595 RendererWebKitPlatformSupportImpl::createAudioDevice( |
596 size_t bufferSize, | 596 size_t bufferSize, |
597 unsigned numberOfChannels, | 597 unsigned numberOfChannels, |
598 double sampleRate, | 598 double sampleRate, |
599 WebAudioDevice::RenderCallback* callback) { | 599 WebAudioDevice::RenderCallback* callback) { |
| 600 WebFrame* web_frame = WebFrame::frameForCurrentContext(); |
| 601 if (!web_frame) |
| 602 return NULL; |
| 603 RenderViewImpl* render_view = RenderViewImpl::FromWebView(web_frame->view()); |
| 604 if (!render_view) |
| 605 return NULL; |
| 606 |
600 ChannelLayout layout = CHANNEL_LAYOUT_UNSUPPORTED; | 607 ChannelLayout layout = CHANNEL_LAYOUT_UNSUPPORTED; |
601 | 608 |
602 // The |numberOfChannels| does not exactly identify the channel layout of the | 609 // The |numberOfChannels| does not exactly identify the channel layout of the |
603 // device. The switch statement below assigns a best guess to the channel | 610 // device. The switch statement below assigns a best guess to the channel |
604 // layout based on number of channels. | 611 // layout based on number of channels. |
605 // TODO(crogers): WebKit should give the channel layout instead of the hard | 612 // TODO(crogers): WebKit should give the channel layout instead of the hard |
606 // channel count. | 613 // channel count. |
607 switch (numberOfChannels) { | 614 switch (numberOfChannels) { |
608 case 1: | 615 case 1: |
609 layout = CHANNEL_LAYOUT_MONO; | 616 layout = CHANNEL_LAYOUT_MONO; |
(...skipping 20 matching lines...) Expand all Loading... |
630 layout = CHANNEL_LAYOUT_7_1; | 637 layout = CHANNEL_LAYOUT_7_1; |
631 break; | 638 break; |
632 default: | 639 default: |
633 layout = CHANNEL_LAYOUT_STEREO; | 640 layout = CHANNEL_LAYOUT_STEREO; |
634 } | 641 } |
635 | 642 |
636 media::AudioParameters params( | 643 media::AudioParameters params( |
637 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, layout, | 644 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, layout, |
638 static_cast<int>(sampleRate), 16, bufferSize); | 645 static_cast<int>(sampleRate), 16, bufferSize); |
639 | 646 |
640 return new RendererWebAudioDeviceImpl(params, callback); | 647 return new RendererWebAudioDeviceImpl(render_view, params, callback); |
641 } | 648 } |
642 | 649 |
643 //------------------------------------------------------------------------------ | 650 //------------------------------------------------------------------------------ |
644 | 651 |
645 WebKit::WebString | 652 WebKit::WebString |
646 RendererWebKitPlatformSupportImpl::signedPublicKeyAndChallengeString( | 653 RendererWebKitPlatformSupportImpl::signedPublicKeyAndChallengeString( |
647 unsigned key_size_index, | 654 unsigned key_size_index, |
648 const WebKit::WebString& challenge, | 655 const WebKit::WebString& challenge, |
649 const WebKit::WebURL& url) { | 656 const WebKit::WebURL& url) { |
650 std::string signed_public_key; | 657 std::string signed_public_key; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 bool enable) { | 747 bool enable) { |
741 bool was_enabled = g_sandbox_enabled; | 748 bool was_enabled = g_sandbox_enabled; |
742 g_sandbox_enabled = enable; | 749 g_sandbox_enabled = enable; |
743 return was_enabled; | 750 return was_enabled; |
744 } | 751 } |
745 | 752 |
746 GpuChannelHostFactory* | 753 GpuChannelHostFactory* |
747 RendererWebKitPlatformSupportImpl::GetGpuChannelHostFactory() { | 754 RendererWebKitPlatformSupportImpl::GetGpuChannelHostFactory() { |
748 return RenderThreadImpl::current(); | 755 return RenderThreadImpl::current(); |
749 } | 756 } |
OLD | NEW |