diff options
author | hayato <hayato@chromium.org> | 2015-03-30 19:02:04 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-31 02:03:02 +0000 |
commit | 5713bf145fcfcd041366b0be659bdc35ffcedc08 (patch) | |
tree | 27bee4f8f6127d1d03f218699ffca2876de1418e | |
parent | 384e5fae06aa2f420de9215e42dfd4043c8f00f2 (diff) | |
download | chromium_src-5713bf145fcfcd041366b0be659bdc35ffcedc08.zip chromium_src-5713bf145fcfcd041366b0be659bdc35ffcedc08.tar.gz chromium_src-5713bf145fcfcd041366b0be659bdc35ffcedc08.tar.bz2 |
Revert of Revert of Partially revert removal of synchronous AudioHardwareConfig requests. (patchset #1 id:1 of https://codereview.chromium.org/1047093002/)
Reason for revert:
Tree cycled to green before this revert patch was in.
http://build.chromium.org/p/chromium.webkit/builders/Mac%20Builder%20%28dbg%29/builds/78610
Let me revert the revert.
Original issue's description:
> Revert of Partially revert removal of synchronous AudioHardwareConfig requests. (patchset #1 id:1 of https://codereview.chromium.org/1042953002/)
>
> Reason for revert:
> Blink Gardening.
> Tree closer. This CL looks culprit.
>
> blink: Tree is closed (Automatic: "compile" on http://build.chromium.org/p/chromium.webkit/builders/Mac%20Builder%20%28dbg%29/builds/78608 "Mac Builder (dbg)"
>
> blink 192783 : 192783
> chromium 322927 : 322932
>
> http://build.chromium.org/p/chromium.webkit/builders/Mac%20Builder%20%28dbg%29/builds/78608/steps/compile/logs/stdio
>
> [3175/3219] CXX obj/content/shell/renderer/content_shell_lib.shell_render_view_observer.o
> [3176/3219] SOLINK libcontent.dylib, POSTBUILDS
> FAILED: if [ ! -e libcontent.dylib -o ! -e libcontent.dylib.TOC ] || otool -l libcontent.dylib | grep -q LC_REEXPORT_DYLIB ; then /Volumes/data/b/build/goma/gomacc ../../third_party/llvm-build/Release+Asserts/bin/clang++ -shared -framework Cocoa -framework Foundation -framework IOKit -framework Security -framework SystemConfiguration -Wl,-search_paths_first -mmacosx-version-min=10.6 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk -arch x86_64 -L. -install_name @rpath/libcontent.dylib -Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/../../.. -o libcontent.dylib @libcontent.dylib.rsp && { otool -l libcontent.dylib | grep LC_ID_DYLIB -A 5; nm -gP libcontent.dylib | cut -f1-2 -d' ' | grep -v U$; true; } > libcontent.dylib.TOC; else /Volumes/data/b/build/goma/gomacc ../../third_party/llvm-build/Release+Asserts/bin/clang++ -shared -framework Cocoa -framework Foundation -framework IOKit -framework Security -framework SystemConfiguration -Wl,-search_paths_first -mmacosx-version-min=10.6 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk -arch x86_64 -L. -install_name @rpath/libcontent.dylib -Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/../../.. -o libcontent.dylib @libcontent.dylib.rsp && { otool -l libcontent.dylib | grep LC_ID_DYLIB -A 5; nm -gP libcontent.dylib | cut -f1-2 -d' ' | grep -v U$; true; } > libcontent.dylib.tmp && if ! cmp -s libcontent.dylib.tmp libcontent.dylib.TOC; then mv libcontent.dylib.tmp libcontent.dylib.TOC ; fi; fi
> Undefined symbols for architecture x86_64:
> "ViewMsg_SetAudioHardwareConfig::Read(IPC::Message const*, Tuple<media::AudioParameters, media::AudioParameters>*)", referenced from:
> bool ViewMsg_SetAudioHardwareConfig::Dispatch<content::RenderThreadImpl, content::RenderThreadImpl, void, void (content::RenderThreadImpl::*)(media::AudioParameters const&, media::AudioParameters const&)>(IPC::Message const*, content::RenderThreadImpl*, content::RenderThreadImpl*, void*, void (content::RenderThreadImpl::*)(media::AudioParameters const&, media::AudioParameters const&)) in content.render_thread_impl.o
> "media::AudioHardwareConfig::AudioHardwareConfig()", referenced from:
> content::RenderThreadImpl::RenderThreadImpl(content::InProcessChildThreadParams const&) in content.render_thread_impl.o
> content::RenderThreadImpl::RenderThreadImpl(content::InProcessChildThreadParams const&) in content.render_thread_impl.o
> content::RenderThreadImpl::RenderThreadImpl(scoped_ptr<base::MessageLoop, base::DefaultDeleter<base::MessageLoop> >) in content.render_thread_impl.o
> content::RenderThreadImpl::RenderThreadImpl(scoped_ptr<base::MessageLoop, base::DefaultDeleter<base::MessageLoop> >) in content.render_thread_impl.o
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see invocation)
> ninja: build stopped: subcommand failed.
>
> Original issue's description:
> > Partially revert removal of synchronous AudioHardwareConfig requests.
> >
> > This regressed cold page load time on OSX by 5% :(, so revert all
> > changes related to the synchronous IPC removal, but keep cleanup
> > ones related to dead AudioMessageFilter device change handling.
> >
> > Revert "Use the worker task runner instead of the main audio thread."
> > commit http://crrev.com/06def69114b5ecae4f0ee0aa875181568fe7902c
> >
> > Revert "Remove synchronous AudioHardwareConfig request."
> > commit http://crrev.com/19faf60586e58f244371697b49eb61959d9c7be9
> >
> > BUG=469737
> > TEST=audio works.
> >
> > Committed: https://crrev.com/5a5e42e169522531244c67b7892c4e827179e6ac
> > Cr-Commit-Position: refs/heads/master@{#322928}
>
> TBR=nasko@chromium.org,creis@chromium.org,dalecurtis@chromium.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=469737
>
> Committed: https://crrev.com/dd41f62badda4ed64987669ac9b11c7ad3101734
> Cr-Commit-Position: refs/heads/master@{#322945}
TBR=nasko@chromium.org,creis@chromium.org,dalecurtis@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=469737
Review URL: https://codereview.chromium.org/1040263002
Cr-Commit-Position: refs/heads/master@{#322947}
-rw-r--r-- | content/browser/renderer_host/render_message_filter.cc | 17 | ||||
-rw-r--r-- | content/browser/renderer_host/render_process_host_impl.cc | 19 | ||||
-rw-r--r-- | content/browser/renderer_host/render_process_host_impl.h | 4 | ||||
-rw-r--r-- | content/common/view_messages.h | 10 | ||||
-rw-r--r-- | content/renderer/media/audio_message_filter.h | 5 | ||||
-rw-r--r-- | content/renderer/render_thread_impl.cc | 21 | ||||
-rw-r--r-- | content/renderer/render_thread_impl.h | 6 | ||||
-rw-r--r-- | media/base/audio_hardware_config.cc | 2 | ||||
-rw-r--r-- | media/base/audio_hardware_config.h | 1 |
9 files changed, 36 insertions, 49 deletions
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc index 501902b..2c072d9 100644 --- a/content/browser/renderer_host/render_message_filter.cc +++ b/content/browser/renderer_host/render_message_filter.cc @@ -426,6 +426,8 @@ bool RenderMessageFilter::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(ViewHostMsg_DidGenerateCacheableMetadata, OnCacheableMetadataAvailable) IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_Keygen, OnKeygen) + IPC_MESSAGE_HANDLER(ViewHostMsg_GetAudioHardwareConfig, + OnGetAudioHardwareConfig) #if defined(OS_WIN) IPC_MESSAGE_HANDLER(ViewHostMsg_GetMonitorColorProfile, OnGetMonitorColorProfile) @@ -455,6 +457,9 @@ base::TaskRunner* RenderMessageFilter::OverrideTaskRunnerForMessage( if (message.type() == ViewHostMsg_GetMonitorColorProfile::ID) return BrowserThread::GetBlockingPool(); #endif + // Always query audio device parameters on the audio thread. + if (message.type() == ViewHostMsg_GetAudioHardwareConfig::ID) + return audio_manager_->GetTaskRunner().get(); return NULL; } @@ -830,6 +835,18 @@ void RenderMessageFilter::OnGenerateRoutingID(int* route_id) { *route_id = render_widget_helper_->GetNextRoutingID(); } +void RenderMessageFilter::OnGetAudioHardwareConfig( + media::AudioParameters* input_params, + media::AudioParameters* output_params) { + DCHECK(input_params); + DCHECK(output_params); + *output_params = audio_manager_->GetDefaultOutputStreamParameters(); + + // TODO(henrika): add support for all available input devices. + *input_params = audio_manager_->GetInputStreamParameters( + media::AudioManagerBase::kDefaultDeviceId); +} + #if defined(OS_WIN) void RenderMessageFilter::OnGetMonitorColorProfile(std::vector<char>* profile) { DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO)); diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 3854918..c150977 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -211,14 +211,6 @@ void RemoveShaderInfo(int32 id) { ShaderCacheFactory::GetInstance()->RemoveCacheInfo(id); } -scoped_ptr<IPC::Message> SendAudioHardwareConfig() { - media::AudioManager* am = media::AudioManager::Get(); - DCHECK(am->GetWorkerTaskRunner()->BelongsToCurrentThread()); - return make_scoped_ptr(new ViewMsg_SetAudioHardwareConfig( - am->GetDefaultOutputStreamParameters(), - am->GetInputStreamParameters(media::AudioManagerBase::kDefaultDeviceId))); -} - net::URLRequestContext* GetRequestContext( scoped_refptr<net::URLRequestContextGetter> request_context, scoped_refptr<net::URLRequestContextGetter> media_request_context, @@ -1512,11 +1504,6 @@ bool RenderProcessHostImpl::Send(IPC::Message* msg) { return channel_->Send(msg); } -bool RenderProcessHostImpl::SendHelper(scoped_ptr<IPC::Message> msg) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - return Send(msg.release()); -} - bool RenderProcessHostImpl::OnMessageReceived(const IPC::Message& msg) { // If we're about to be deleted, or have initiated the fast shutdown sequence, // we ignore incoming messages. @@ -2338,12 +2325,6 @@ void RenderProcessHostImpl::OnProcessLaunched() { queued_messages_.pop(); } - base::PostTaskAndReplyWithResult( - media::AudioManager::Get()->GetWorkerTaskRunner().get(), FROM_HERE, - base::Bind(&SendAudioHardwareConfig), - base::Bind(base::IgnoreResult(&RenderProcessHostImpl::SendHelper), - weak_factory_.GetWeakPtr())); - #if defined(ENABLE_WEBRTC) // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/465841 // is fixed. diff --git a/content/browser/renderer_host/render_process_host_impl.h b/content/browser/renderer_host/render_process_host_impl.h index 93b7aa5..d56a012 100644 --- a/content/browser/renderer_host/render_process_host_impl.h +++ b/content/browser/renderer_host/render_process_host_impl.h @@ -155,10 +155,8 @@ class CONTENT_EXPORT RenderProcessHostImpl int cdm_id) const override; #endif - // IPC::Sender via RenderProcessHost. SendHelper() can be used to ensure - // allocated messages are not leaked after RPHI is destructed. + // IPC::Sender via RenderProcessHost. bool Send(IPC::Message* msg) override; - bool SendHelper(scoped_ptr<IPC::Message> msg); // IPC::Listener via RenderProcessHost. bool OnMessageReceived(const IPC::Message& msg) override; diff --git a/content/common/view_messages.h b/content/common/view_messages.h index aff3f3b..495bf66 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -1017,11 +1017,6 @@ IPC_MESSAGE_ROUTED1(ViewMsg_ForceRedraw, IPC_MESSAGE_ROUTED1(ViewMsg_BeginFrame, cc::BeginFrameArgs /* args */) -// Tells the renderer what audio hardware configuration is. -IPC_MESSAGE_CONTROL2(ViewMsg_SetAudioHardwareConfig, - media::AudioParameters /* input parameters */, - media::AudioParameters /* output parameters */) - // ----------------------------------------------------------------------------- // Messages sent from the renderer to the browser. @@ -1061,6 +1056,11 @@ IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_CreateFullscreenWidget, IPC_SYNC_MESSAGE_CONTROL0_1(ViewHostMsg_GenerateRoutingID, int /* routing_id */) +// Asks the browser for the default audio hardware configuration. +IPC_SYNC_MESSAGE_CONTROL0_2(ViewHostMsg_GetAudioHardwareConfig, + media::AudioParameters /* input parameters */, + media::AudioParameters /* output parameters */) + // Asks the browser for the renderer process memory size stats. IPC_SYNC_MESSAGE_CONTROL0_2(ViewHostMsg_GetProcessMemorySizes, size_t /* private_bytes */, diff --git a/content/renderer/media/audio_message_filter.h b/content/renderer/media/audio_message_filter.h index c4428aa..f082a78 100644 --- a/content/renderer/media/audio_message_filter.h +++ b/content/renderer/media/audio_message_filter.h @@ -44,11 +44,6 @@ class CONTENT_EXPORT AudioMessageFilter : public IPC::MessageFilter { scoped_ptr<media::AudioOutputIPC> CreateAudioOutputIPC(int render_view_id, int render_frame_id); - // When set, AudioMessageFilter will update the AudioHardwareConfig with new - // configuration values as received by OnOutputDeviceChanged(). The provided - // |config| must outlive AudioMessageFilter. - void SetAudioHardwareConfig(media::AudioHardwareConfig* config); - // IO message loop associated with this message filter. scoped_refptr<base::MessageLoopProxy> io_message_loop() const { return io_message_loop_; diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index 6e3672a..6259439 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc @@ -1335,7 +1335,17 @@ AudioRendererMixerManager* RenderThreadImpl::GetAudioRendererMixerManager() { } media::AudioHardwareConfig* RenderThreadImpl::GetAudioHardwareConfig() { - return &audio_hardware_config_; + if (!audio_hardware_config_) { + media::AudioParameters input_params; + media::AudioParameters output_params; + Send(new ViewHostMsg_GetAudioHardwareConfig( + &input_params, &output_params)); + + audio_hardware_config_.reset(new media::AudioHardwareConfig( + input_params, output_params)); + } + + return audio_hardware_config_.get(); } base::WaitableEvent* RenderThreadImpl::GetShutdownEvent() { @@ -1518,8 +1528,6 @@ bool RenderThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { // is there a new non-windows message I should add here? IPC_MESSAGE_HANDLER(ViewMsg_New, OnCreateNewView) IPC_MESSAGE_HANDLER(ViewMsg_NetworkTypeChanged, OnNetworkTypeChanged) - IPC_MESSAGE_HANDLER(ViewMsg_SetAudioHardwareConfig, - OnSetAudioHardwareConfig) IPC_MESSAGE_HANDLER(ViewMsg_TempCrashWithData, OnTempCrashWithData) IPC_MESSAGE_HANDLER(WorkerProcessMsg_CreateWorker, OnCreateNewSharedWorker) IPC_MESSAGE_HANDLER(ViewMsg_TimezoneChange, OnUpdateTimezone) @@ -1682,13 +1690,6 @@ void RenderThreadImpl::OnNetworkTypeChanged( NetConnectionTypeToWebConnectionType(type)); } -void RenderThreadImpl::OnSetAudioHardwareConfig( - const media::AudioParameters& input, - const media::AudioParameters& output) { - audio_hardware_config_.UpdateInputConfig(input); - audio_hardware_config_.UpdateOutputConfig(output); -} - void RenderThreadImpl::OnTempCrashWithData(const GURL& data) { GetContentClient()->SetActiveURL(data); CHECK(false); diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h index c4a05a2..0a77b36 100644 --- a/content/renderer/render_thread_impl.h +++ b/content/renderer/render_thread_impl.h @@ -25,7 +25,6 @@ #include "content/common/gpu/gpu_result_codes.h" #include "content/public/renderer/render_thread.h" #include "content/renderer/gpu/compositor_dependencies.h" -#include "media/base/audio_hardware_config.h" #include "net/base/network_change_notifier.h" #include "third_party/WebKit/public/platform/WebConnectionType.h" #include "ui/gfx/native_widget_types.h" @@ -67,6 +66,7 @@ class MessageFilter; } namespace media { +class AudioHardwareConfig; class GpuVideoAcceleratorFactories; } @@ -453,8 +453,6 @@ class CONTENT_EXPORT RenderThreadImpl #endif void OnNetworkTypeChanged(net::NetworkChangeNotifier::ConnectionType type); void OnGetAccessibilityTree(); - void OnSetAudioHardwareConfig(const media::AudioParameters& input, - const media::AudioParameters& output); void OnTempCrashWithData(const GURL& data); void OnUpdateTimezone(); void OnMemoryPressure( @@ -584,7 +582,7 @@ class CONTENT_EXPORT RenderThreadImpl scoped_refptr<ContextProviderCommandBuffer> gpu_va_context_provider_; scoped_ptr<AudioRendererMixerManager> audio_renderer_mixer_manager_; - media::AudioHardwareConfig audio_hardware_config_; + scoped_ptr<media::AudioHardwareConfig> audio_hardware_config_; HistogramCustomizer histogram_customizer_; diff --git a/media/base/audio_hardware_config.cc b/media/base/audio_hardware_config.cc index 269b313..d00e03f 100644 --- a/media/base/audio_hardware_config.cc +++ b/media/base/audio_hardware_config.cc @@ -30,8 +30,6 @@ static uint32_t RoundUpToPowerOfTwo(uint32_t v) { } #endif -AudioHardwareConfig::AudioHardwareConfig() {} - AudioHardwareConfig::AudioHardwareConfig( const AudioParameters& input_params, const AudioParameters& output_params) diff --git a/media/base/audio_hardware_config.h b/media/base/audio_hardware_config.h index db3c50b..a4baaac 100644 --- a/media/base/audio_hardware_config.h +++ b/media/base/audio_hardware_config.h @@ -16,7 +16,6 @@ namespace media { // Provides thread safe access to the audio hardware configuration. class MEDIA_EXPORT AudioHardwareConfig { public: - AudioHardwareConfig(); AudioHardwareConfig(const media::AudioParameters& input_params, const media::AudioParameters& output_params); virtual ~AudioHardwareConfig(); |