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

Unified Diff: media/audio/scoped_loop_observer.cc

Issue 66183002: Replace MessageLoopProxy with SingleThreadTaskRunner for the rest of media/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win and audio tests 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/audio/scoped_loop_observer.h ('k') | media/audio/scoped_task_runner_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/scoped_loop_observer.cc
diff --git a/media/audio/scoped_loop_observer.cc b/media/audio/scoped_loop_observer.cc
deleted file mode 100644
index 01187ec8f991be37bad58a9cf648c7be72ed5786..0000000000000000000000000000000000000000
--- a/media/audio/scoped_loop_observer.cc
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "media/audio/scoped_loop_observer.h"
-
-#include "base/bind.h"
-#include "base/synchronization/waitable_event.h"
-
-namespace media {
-
-ScopedLoopObserver::ScopedLoopObserver(
- const scoped_refptr<base::MessageLoopProxy>& loop)
- : loop_(loop) {
- ObserveLoopDestruction(true, NULL);
-}
-
-ScopedLoopObserver::~ScopedLoopObserver() {
- ObserveLoopDestruction(false, NULL);
-}
-
-void ScopedLoopObserver::ObserveLoopDestruction(bool enable,
- base::WaitableEvent* done) {
- // Note: |done| may be NULL.
- if (loop_->BelongsToCurrentThread()) {
- base::MessageLoop* loop = base::MessageLoop::current();
- if (enable) {
- loop->AddDestructionObserver(this);
- } else {
- loop->RemoveDestructionObserver(this);
- }
- } else {
- base::WaitableEvent event(false, false);
- if (loop_->PostTask(FROM_HERE,
- base::Bind(&ScopedLoopObserver::ObserveLoopDestruction,
- base::Unretained(this), enable, &event))) {
- event.Wait();
- } else {
- // The message loop's thread has already terminated, so no need to wait.
- }
- }
-
- if (done)
- done->Signal();
-}
-
-} // namespace media.
« no previous file with comments | « media/audio/scoped_loop_observer.h ('k') | media/audio/scoped_task_runner_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698