Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: media/audio/audio_manager_base.cc

Issue 141683005: Removes MessageLoop::Type checks in favor of IsCurrent on MessageLoops. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: base:: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.cc ('k') | net/base/dns_reloader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "media/audio/audio_manager_base.h" 5 #include "media/audio/audio_manager_base.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 #if defined(OS_WIN) 90 #if defined(OS_WIN)
91 audio_thread_.init_com_with_mta(true); 91 audio_thread_.init_com_with_mta(true);
92 #elif defined(OS_MACOSX) 92 #elif defined(OS_MACOSX)
93 // CoreAudio calls must occur on the main thread of the process, which in our 93 // CoreAudio calls must occur on the main thread of the process, which in our
94 // case is sadly the browser UI thread. Failure to execute calls on the right 94 // case is sadly the browser UI thread. Failure to execute calls on the right
95 // thread leads to crashes and odd behavior. See http://crbug.com/158170. 95 // thread leads to crashes and odd behavior. See http://crbug.com/158170.
96 // TODO(dalecurtis): We should require the message loop to be passed in. 96 // TODO(dalecurtis): We should require the message loop to be passed in.
97 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); 97 const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
98 if (!cmd_line->HasSwitch(switches::kDisableMainThreadAudio) && 98 if (!cmd_line->HasSwitch(switches::kDisableMainThreadAudio) &&
99 base::MessageLoopProxy::current().get() && 99 base::MessageLoopProxy::current().get() &&
100 base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_UI)) { 100 base::MessageLoopForUI::IsCurrent()) {
101 task_runner_ = base::MessageLoopProxy::current(); 101 task_runner_ = base::MessageLoopProxy::current();
102 return; 102 return;
103 } 103 }
104 #endif 104 #endif
105 105
106 CHECK(audio_thread_.Start()); 106 CHECK(audio_thread_.Start());
107 task_runner_ = audio_thread_.message_loop_proxy(); 107 task_runner_ = audio_thread_.message_loop_proxy();
108 } 108 }
109 109
110 AudioManagerBase::~AudioManagerBase() { 110 AudioManagerBase::~AudioManagerBase() {
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 (*it)->dispatcher->CloseStreamsForWedgeFix(); 446 (*it)->dispatcher->CloseStreamsForWedgeFix();
447 } 447 }
448 for (AudioOutputDispatchers::iterator it = output_dispatchers_.begin(); 448 for (AudioOutputDispatchers::iterator it = output_dispatchers_.begin();
449 it != output_dispatchers_.end(); ++it) { 449 it != output_dispatchers_.end(); ++it) {
450 (*it)->dispatcher->RestartStreamsForWedgeFix(); 450 (*it)->dispatcher->RestartStreamsForWedgeFix();
451 } 451 }
452 #endif 452 #endif
453 } 453 }
454 454
455 } // namespace media 455 } // namespace media
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.cc ('k') | net/base/dns_reloader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698