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

Unified Diff: media/base/message_loop_factory.cc

Issue 11468033: Vanquish the remnants of media::MessageLoopFactory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
Index: media/base/message_loop_factory.cc
diff --git a/media/base/message_loop_factory.cc b/media/base/message_loop_factory.cc
deleted file mode 100644
index 597ff139bbb353172f43613c003fac946c0a70d0..0000000000000000000000000000000000000000
--- a/media/base/message_loop_factory.cc
+++ /dev/null
@@ -1,48 +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/base/message_loop_factory.h"
-
-#include "base/threading/thread.h"
-
-namespace media {
-
-MessageLoopFactory::MessageLoopFactory() {}
-
-MessageLoopFactory::~MessageLoopFactory() {
- for (ThreadList::reverse_iterator it = threads_.rbegin();
- it != threads_.rend(); ++it) {
- base::Thread* thread = it->second;
- thread->Stop();
- delete thread;
- }
- threads_.clear();
-}
-
-scoped_refptr<base::MessageLoopProxy> MessageLoopFactory::GetMessageLoop(
- Type type) {
- return GetThread(type)->message_loop_proxy();
-}
-
-base::Thread* MessageLoopFactory::GetThread(Type type) {
- base::AutoLock auto_lock(lock_);
- for (ThreadList::iterator it = threads_.begin(); it != threads_.end(); ++it) {
- if (it->first == type)
- return it->second;
- }
-
- const char* name = NULL;
- switch (type) {
- case kPipeline:
- name = "MediaPipeline";
- break;
- }
-
- base::Thread* thread = new base::Thread(name);
- CHECK(thread->Start()) << "Failed to start thread: " << name;
- threads_.push_back(std::make_pair(type, thread));
- return thread;
-}
-
-} // namespace media

Powered by Google App Engine
This is Rietveld 408576698