diff options
author | nduca@chromium.org <nduca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-15 20:33:46 +0000 |
---|---|---|
committer | nduca@chromium.org <nduca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-15 20:33:46 +0000 |
commit | edd685f15dfd2841aaeddab567aea0623db1ae69 (patch) | |
tree | 9caa53e84eb2787471dd16009daf02fb85f8890e | |
parent | 5b79e5250785613d6dc7a42a27a45bb44b9cf7a0 (diff) | |
download | chromium_src-edd685f15dfd2841aaeddab567aea0623db1ae69.zip chromium_src-edd685f15dfd2841aaeddab567aea0623db1ae69.tar.gz chromium_src-edd685f15dfd2841aaeddab567aea0623db1ae69.tar.bz2 |
Add MessageLoopProxy::current
Review URL: http://codereview.chromium.org/7583053
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96819 0039d316-1c4b-4281-b951-d872f2087c98
102 files changed, 203 insertions, 189 deletions
diff --git a/base/file_util_proxy.cc b/base/file_util_proxy.cc index be6465d..a192cbf 100644 --- a/base/file_util_proxy.cc +++ b/base/file_util_proxy.cc @@ -73,7 +73,7 @@ class MessageLoopRelay public: MessageLoopRelay() : origin_message_loop_proxy_( - base::MessageLoopProxy::CreateForCurrentThread()), + base::MessageLoopProxy::current()), error_code_(base::PLATFORM_FILE_OK) { } diff --git a/base/files/file_path_watcher_browsertest.cc b/base/files/file_path_watcher_browsertest.cc index 49b652f..a422f84 100644 --- a/base/files/file_path_watcher_browsertest.cc +++ b/base/files/file_path_watcher_browsertest.cc @@ -41,7 +41,7 @@ class NotificationCollector : public base::RefCountedThreadSafe<NotificationCollector> { public: NotificationCollector() - : loop_(base::MessageLoopProxy::CreateForCurrentThread()) {} + : loop_(base::MessageLoopProxy::current()) {} // Called from the file thread by the delegates. void OnChange(TestDelegate* delegate) { diff --git a/base/files/file_path_watcher_linux.cc b/base/files/file_path_watcher_linux.cc index 0fb10e4..aa116e3 100644 --- a/base/files/file_path_watcher_linux.cc +++ b/base/files/file_path_watcher_linux.cc @@ -370,7 +370,7 @@ bool FilePathWatcherImpl::Watch(const FilePath& path, DCHECK(target_.empty()); DCHECK(MessageLoopForIO::current()); - set_message_loop(base::MessageLoopProxy::CreateForCurrentThread()); + set_message_loop(base::MessageLoopProxy::current()); delegate_ = delegate; target_ = path; MessageLoop::current()->AddDestructionObserver(this); diff --git a/base/files/file_path_watcher_mac.cc b/base/files/file_path_watcher_mac.cc index 7b61f76..c3b9351 100644 --- a/base/files/file_path_watcher_mac.cc +++ b/base/files/file_path_watcher_mac.cc @@ -427,7 +427,7 @@ bool FilePathWatcherImpl::Watch(const FilePath& path, target_ = path; MessageLoop::current()->AddDestructionObserver(this); - io_message_loop_ = base::MessageLoopProxy::CreateForCurrentThread(); + io_message_loop_ = base::MessageLoopProxy::current(); kqueue_ = kqueue(); if (kqueue_ == -1) { diff --git a/base/files/file_path_watcher_win.cc b/base/files/file_path_watcher_win.cc index eedcf22..b87654e 100644 --- a/base/files/file_path_watcher_win.cc +++ b/base/files/file_path_watcher_win.cc @@ -81,7 +81,7 @@ bool FilePathWatcherImpl::Watch(const FilePath& path, FilePathWatcher::Delegate* delegate) { DCHECK(target_.value().empty()); // Can only watch one path. - set_message_loop(base::MessageLoopProxy::CreateForCurrentThread()); + set_message_loop(base::MessageLoopProxy::current()); delegate_ = delegate; target_ = path; MessageLoop::current()->AddDestructionObserver(this); diff --git a/base/message_loop.cc b/base/message_loop.cc index 10f4a26..02534f5 100644 --- a/base/message_loop.cc +++ b/base/message_loop.cc @@ -12,6 +12,7 @@ #include "base/lazy_instance.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" +#include "base/message_loop_proxy_impl.h" #include "base/message_pump_default.h" #include "base/metrics/histogram.h" #include "base/third_party/dynamic_annotations/dynamic_annotations.h" @@ -135,6 +136,8 @@ MessageLoop::MessageLoop(Type type) DCHECK(!current()) << "should only have one message loop per thread"; lazy_tls_ptr.Pointer()->Set(this); + message_loop_proxy_ = new base::MessageLoopProxyImpl(); + // TODO(rvargas): Get rid of the OS guards. #if defined(OS_WIN) #define MESSAGE_PUMP_UI new base::MessagePumpForUI() @@ -202,6 +205,11 @@ MessageLoop::~MessageLoop() { FOR_EACH_OBSERVER(DestructionObserver, destruction_observers_, WillDestroyCurrentMessageLoop()); + // Tell the message_loop_proxy that we are dying. + static_cast<base::MessageLoopProxyImpl*>(message_loop_proxy_.get())-> + WillDestroyCurrentMessageLoop(); + message_loop_proxy_ = NULL; + // OK, now make it so that no one can find us. lazy_tls_ptr.Pointer()->Set(NULL); diff --git a/base/message_loop.h b/base/message_loop.h index 9355ec9..976c5ce 100644 --- a/base/message_loop.h +++ b/base/message_loop.h @@ -13,6 +13,7 @@ #include "base/basictypes.h" #include "base/callback.h" #include "base/memory/ref_counted.h" +#include "base/message_loop_proxy.h" #include "base/message_pump.h" #include "base/observer_list.h" #include "base/synchronization/lock.h" @@ -271,6 +272,11 @@ class BASE_EXPORT MessageLoop : public base::MessagePump::Delegate { } const std::string& thread_name() const { return thread_name_; } + // Gets the message loop proxy associated with this message loop proxy + scoped_refptr<base::MessageLoopProxy> message_loop_proxy() { + return message_loop_proxy_.get(); + } + // Enables or disables the recursive task processing. This happens in the case // of recursive message loops. Some unwanted message loop may occurs when // using common controls or printer functions. By default, recursive task @@ -573,6 +579,9 @@ class BASE_EXPORT MessageLoop : public base::MessagePump::Delegate { ObserverList<TaskObserver> task_observers_; + // The message loop proxy associated with this message loop, if one exists. + scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; + private: DISALLOW_COPY_AND_ASSIGN(MessageLoop); }; diff --git a/base/message_loop_proxy.h b/base/message_loop_proxy.h index 646b2ef..9a856bf 100644 --- a/base/message_loop_proxy.h +++ b/base/message_loop_proxy.h @@ -17,9 +17,12 @@ namespace base { struct MessageLoopProxyTraits; // This class provides a thread-safe refcounted interface to the Post* methods -// of a message loop. This class can outlive the target message loop. You can -// obtain a MessageLoopProxy via Thread::message_loop_proxy() or -// MessageLoopProxy::CreateForCurrentThread(). +// of a message loop. This class can outlive the target message loop. +// MessageLoopProxy objects are constructed automatically for all MessageLoops. +// So, to access them, you can use any of the following: +// Thread::message_loop_proxy() +// MessageLoop::current()->message_loop_proxy() +// MessageLoopProxy::current() class BASE_EXPORT MessageLoopProxy : public base::RefCountedThreadSafe<MessageLoopProxy, MessageLoopProxyTraits> { @@ -78,9 +81,9 @@ class BASE_EXPORT MessageLoopProxy return PostNonNestableTask(from_here, new ReleaseTask<T>(object)); } - // Factory method for creating an implementation of MessageLoopProxy - // for the current thread. - static scoped_refptr<MessageLoopProxy> CreateForCurrentThread(); + // Gets the MessageLoopProxy for the current message loop, creating one if + // needed. + static scoped_refptr<MessageLoopProxy> current(); protected: friend class RefCountedThreadSafe<MessageLoopProxy, MessageLoopProxyTraits>; diff --git a/base/message_loop_proxy_impl.cc b/base/message_loop_proxy_impl.cc index af0d214..6b52351 100644 --- a/base/message_loop_proxy_impl.cc +++ b/base/message_loop_proxy_impl.cc @@ -8,13 +8,6 @@ namespace base { MessageLoopProxyImpl::~MessageLoopProxyImpl() { - AutoLock lock(message_loop_lock_); - // If the target message loop still exists, the d'tor WILL execute on the - // target loop. - if (target_message_loop_) { - DCHECK(MessageLoop::current() == target_message_loop_); - MessageLoop::current()->RemoveDestructionObserver(this); - } } // MessageLoopProxy implementation @@ -102,7 +95,6 @@ void MessageLoopProxyImpl::OnDestruct() const { MessageLoopProxyImpl::MessageLoopProxyImpl() : target_message_loop_(MessageLoop::current()) { - target_message_loop_->AddDestructionObserver(this); } bool MessageLoopProxyImpl::PostTaskHelper( @@ -143,9 +135,11 @@ bool MessageLoopProxyImpl::PostTaskHelper( } scoped_refptr<MessageLoopProxy> -MessageLoopProxy::CreateForCurrentThread() { - scoped_refptr<MessageLoopProxy> ret(new MessageLoopProxyImpl()); - return ret; +MessageLoopProxy::current() { + MessageLoop* cur_loop = MessageLoop::current(); + if (!cur_loop) + return NULL; + return cur_loop->message_loop_proxy(); } } // namespace base diff --git a/base/message_loop_proxy_impl.h b/base/message_loop_proxy_impl.h index 57896ff..2966394 100644 --- a/base/message_loop_proxy_impl.h +++ b/base/message_loop_proxy_impl.h @@ -13,12 +13,11 @@ namespace base { -// A stock implementation of MessageLoopProxy that takes in a MessageLoop -// and keeps track of its lifetime using the MessageLoop DestructionObserver. -// For now a MessageLoopProxyImpl can only be created for the current thread. +// A stock implementation of MessageLoopProxy that is created and managed by a +// MessageLoop. For now a MessageLoopProxyImpl can only be created as part of a +// MessageLoop. class BASE_EXPORT MessageLoopProxyImpl - : public MessageLoopProxy, - public MessageLoop::DestructionObserver { + : public MessageLoopProxy { public: virtual ~MessageLoopProxyImpl(); @@ -47,9 +46,6 @@ class BASE_EXPORT MessageLoopProxyImpl int64 delay_ms); virtual bool BelongsToCurrentThread(); - // MessageLoop::DestructionObserver implementation - virtual void WillDestroyCurrentMessageLoop(); - protected: // Override OnDestruct so that we can delete the object on the target message // loop if it still exists. @@ -57,6 +53,11 @@ class BASE_EXPORT MessageLoopProxyImpl private: MessageLoopProxyImpl(); + + // Called directly by MessageLoop::~MessageLoop. + virtual void WillDestroyCurrentMessageLoop(); + + // TODO(ajwong): Remove this after we've fully migrated to base::Closure. bool PostTaskHelper(const tracked_objects::Location& from_here, Task* task, @@ -67,8 +68,8 @@ class BASE_EXPORT MessageLoopProxyImpl int64 delay_ms, bool nestable); - // For the factory method to work - friend class MessageLoopProxy; + // Allow the messageLoop to create a MessageLoopProxyImpl. + friend class ::MessageLoop; // The lock that protects access to target_message_loop_. mutable base::Lock message_loop_lock_; diff --git a/base/message_loop_proxy_impl_unittest.cc b/base/message_loop_proxy_impl_unittest.cc index d635acb..1707b22 100644 --- a/base/message_loop_proxy_impl_unittest.cc +++ b/base/message_loop_proxy_impl_unittest.cc @@ -7,6 +7,7 @@ #include "base/bind.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" +#include "base/message_loop_proxy.h" #include "base/threading/thread.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" @@ -25,10 +26,14 @@ class MessageLoopProxyImplTest : public testing::Test { void AssertOnIOThread() const { ASSERT_TRUE(io_thread_->message_loop_proxy()->BelongsToCurrentThread()); + ASSERT_EQ(io_thread_->message_loop_proxy(), + base::MessageLoopProxy::current()); } void AssertOnFileThread() const { ASSERT_TRUE(file_thread_->message_loop_proxy()->BelongsToCurrentThread()); + ASSERT_EQ(file_thread_->message_loop_proxy(), + base::MessageLoopProxy::current()); } protected: diff --git a/base/observer_list_threadsafe.h b/base/observer_list_threadsafe.h index 3b47c83..22cc951 100644 --- a/base/observer_list_threadsafe.h +++ b/base/observer_list_threadsafe.h @@ -185,7 +185,7 @@ class ObserverListThreadSafe struct ObserverListContext { explicit ObserverListContext(NotificationType type) - : loop(base::MessageLoopProxy::CreateForCurrentThread()), + : loop(base::MessageLoopProxy::current()), list(type) { } diff --git a/base/threading/thread.cc b/base/threading/thread.cc index 7a100ca..616aac8 100644 --- a/base/threading/thread.cc +++ b/base/threading/thread.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -151,7 +151,6 @@ void Thread::ThreadMain() { ANNOTATE_THREAD_NAME(name_.c_str()); // Tell the name to race detector. message_loop.set_thread_name(name_); message_loop_ = &message_loop; - message_loop_proxy_ = MessageLoopProxy::CreateForCurrentThread(); // Let the thread do extra initialization. // Let's do this before signaling we are started. @@ -171,7 +170,6 @@ void Thread::ThreadMain() { // We can't receive messages anymore. message_loop_ = NULL; - message_loop_proxy_ = NULL; } thread_id_ = kInvalidThreadId; } diff --git a/base/threading/thread.h b/base/threading/thread.h index 58a4cc2..d7451ec 100644 --- a/base/threading/thread.h +++ b/base/threading/thread.h @@ -113,7 +113,7 @@ class BASE_EXPORT Thread : PlatformThread::Delegate { // is gone. // TODO(sanjeevr): Look into merging MessageLoop and MessageLoopProxy. scoped_refptr<MessageLoopProxy> message_loop_proxy() const { - return message_loop_proxy_; + return message_loop_->message_loop_proxy(); } // Set the name of this thread (for display in debugger too). @@ -175,10 +175,6 @@ class BASE_EXPORT Thread : PlatformThread::Delegate { // by the created thread. MessageLoop* message_loop_; - // A MessageLoopProxy implementation that targets this thread. This can - // outlive the thread. - scoped_refptr<MessageLoopProxy> message_loop_proxy_; - // Our thread's ID. PlatformThreadId thread_id_; diff --git a/chrome/browser/chromeos/login/ownership_status_checker.cc b/chrome/browser/chromeos/login/ownership_status_checker.cc index 76e694a..f7d67ab 100644 --- a/chrome/browser/chromeos/login/ownership_status_checker.cc +++ b/chrome/browser/chromeos/login/ownership_status_checker.cc @@ -19,7 +19,7 @@ OwnershipStatusChecker::~OwnershipStatusChecker() { OwnershipStatusChecker::Core::Core(Callback* callback) : callback_(callback), - origin_loop_(base::MessageLoopProxy::CreateForCurrentThread()) { + origin_loop_(base::MessageLoopProxy::current()) { } OwnershipStatusChecker::Core::~Core() {} diff --git a/chrome/browser/icon_loader.cc b/chrome/browser/icon_loader.cc index c1d8e8f..de8d08b 100644 --- a/chrome/browser/icon_loader.cc +++ b/chrome/browser/icon_loader.cc @@ -25,7 +25,7 @@ IconLoader::~IconLoader() { } void IconLoader::Start() { - target_message_loop_ = base::MessageLoopProxy::CreateForCurrentThread(); + target_message_loop_ = base::MessageLoopProxy::current(); #if defined(TOOLKIT_GTK) // This call must happen on the UI thread before we can start loading icons. diff --git a/chrome/browser/sync/notifier/non_blocking_invalidation_notifier.cc b/chrome/browser/sync/notifier/non_blocking_invalidation_notifier.cc index 5ada8b8..575700f 100644 --- a/chrome/browser/sync/notifier/non_blocking_invalidation_notifier.cc +++ b/chrome/browser/sync/notifier/non_blocking_invalidation_notifier.cc @@ -141,7 +141,7 @@ NonBlockingInvalidationNotifier::NonBlockingInvalidationNotifier( const std::string& client_info) : core_(new Core), parent_message_loop_proxy_( - base::MessageLoopProxy::CreateForCurrentThread()), + base::MessageLoopProxy::current()), io_message_loop_proxy_(notifier_options.request_context_getter-> GetIOMessageLoopProxy()) { if (!io_message_loop_proxy_->PostTask( diff --git a/chrome/browser/sync/notifier/p2p_notifier.cc b/chrome/browser/sync/notifier/p2p_notifier.cc index ba23eb3..197de34 100644 --- a/chrome/browser/sync/notifier/p2p_notifier.cc +++ b/chrome/browser/sync/notifier/p2p_notifier.cc @@ -27,7 +27,7 @@ P2PNotifier::P2PNotifier( logged_in_(false), notifications_enabled_(false), parent_message_loop_proxy_( - base::MessageLoopProxy::CreateForCurrentThread()) { + base::MessageLoopProxy::current()) { talk_mediator_->SetDelegate(this); } diff --git a/chrome/browser/sync/weak_handle.cc b/chrome/browser/sync/weak_handle.cc index 1c78307..b08030a 100644 --- a/chrome/browser/sync/weak_handle.cc +++ b/chrome/browser/sync/weak_handle.cc @@ -15,7 +15,7 @@ namespace internal { WeakHandleCoreBase::WeakHandleCoreBase() : owner_loop_(MessageLoop::current()), - owner_loop_proxy_(base::MessageLoopProxy::CreateForCurrentThread()), + owner_loop_proxy_(base::MessageLoopProxy::current()), destroyed_on_owner_thread_(false) { owner_loop_->AddDestructionObserver(this); } diff --git a/chrome/common/important_file_writer_unittest.cc b/chrome/common/important_file_writer_unittest.cc index 78a7894..37012d7 100644 --- a/chrome/common/important_file_writer_unittest.cc +++ b/chrome/common/important_file_writer_unittest.cc @@ -58,7 +58,7 @@ class ImportantFileWriterTest : public testing::Test { TEST_F(ImportantFileWriterTest, Basic) { ImportantFileWriter writer(file_, - base::MessageLoopProxy::CreateForCurrentThread()); + base::MessageLoopProxy::current()); EXPECT_FALSE(file_util::PathExists(writer.path())); writer.WriteNow("foo"); loop_.RunAllPending(); @@ -69,7 +69,7 @@ TEST_F(ImportantFileWriterTest, Basic) { TEST_F(ImportantFileWriterTest, ScheduleWrite) { ImportantFileWriter writer(file_, - base::MessageLoopProxy::CreateForCurrentThread()); + base::MessageLoopProxy::current()); writer.set_commit_interval(base::TimeDelta::FromMilliseconds(25)); EXPECT_FALSE(writer.HasPendingWrite()); DataSerializer serializer("foo"); @@ -85,7 +85,7 @@ TEST_F(ImportantFileWriterTest, ScheduleWrite) { TEST_F(ImportantFileWriterTest, DoScheduledWrite) { ImportantFileWriter writer(file_, - base::MessageLoopProxy::CreateForCurrentThread()); + base::MessageLoopProxy::current()); EXPECT_FALSE(writer.HasPendingWrite()); DataSerializer serializer("foo"); writer.ScheduleWrite(&serializer); @@ -101,7 +101,7 @@ TEST_F(ImportantFileWriterTest, DoScheduledWrite) { TEST_F(ImportantFileWriterTest, BatchingWrites) { ImportantFileWriter writer(file_, - base::MessageLoopProxy::CreateForCurrentThread()); + base::MessageLoopProxy::current()); writer.set_commit_interval(base::TimeDelta::FromMilliseconds(25)); DataSerializer foo("foo"), bar("bar"), baz("baz"); writer.ScheduleWrite(&foo); diff --git a/chrome/common/json_pref_store.cc b/chrome/common/json_pref_store.cc index ede2eed..f3bd776 100644 --- a/chrome/common/json_pref_store.cc +++ b/chrome/common/json_pref_store.cc @@ -30,7 +30,7 @@ class FileThreadDeserializer error_(PersistentPrefStore::PREF_READ_ERROR_NONE), delegate_(delegate), file_loop_proxy_(file_loop_proxy), - origin_loop_proxy_(base::MessageLoopProxy::CreateForCurrentThread()) { + origin_loop_proxy_(base::MessageLoopProxy::current()) { } void Start(const FilePath& path) { diff --git a/chrome/common/json_pref_store_unittest.cc b/chrome/common/json_pref_store_unittest.cc index 3330007..247aaf0 100644 --- a/chrome/common/json_pref_store_unittest.cc +++ b/chrome/common/json_pref_store_unittest.cc @@ -38,7 +38,7 @@ class MockReadErrorDelegate : public PersistentPrefStore::ReadErrorDelegate { class JsonPrefStoreTest : public testing::Test { protected: virtual void SetUp() { - message_loop_proxy_ = base::MessageLoopProxy::CreateForCurrentThread(); + message_loop_proxy_ = base::MessageLoopProxy::current(); ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); diff --git a/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc b/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc index 36b5e28..476ba26 100644 --- a/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc +++ b/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc @@ -96,7 +96,7 @@ class CloudPrintURLFetcherTest : public testing::Test, virtual void SetUp() { testing::Test::SetUp(); - io_message_loop_proxy_ = base::MessageLoopProxy::CreateForCurrentThread(); + io_message_loop_proxy_ = base::MessageLoopProxy::current(); } virtual void TearDown() { diff --git a/chrome/service/cloud_print/print_system_win.cc b/chrome/service/cloud_print/print_system_win.cc index d1cb33c..18b1bbb 100644 --- a/chrome/service/cloud_print/print_system_win.cc +++ b/chrome/service/cloud_print/print_system_win.cc @@ -531,7 +531,7 @@ class PrintSystemWin : public PrintSystem { render_area, printer_dpi, page_ranges, - base::MessageLoopProxy::CreateForCurrentThread())); + base::MessageLoopProxy::current())); } // Called on the service process IO thread. void RenderPDFPagesInSandbox( @@ -649,7 +649,7 @@ class PrintSystemWin : public PrintSystem { NewRunnableMethod( this, &PrinterCapsHandler::GetPrinterCapsAndDefaultsImpl, - base::MessageLoopProxy::CreateForCurrentThread())); + base::MessageLoopProxy::current())); } virtual void OnChildDied() { diff --git a/chrome/service/cloud_print/printer_job_handler.cc b/chrome/service/cloud_print/printer_job_handler.cc index 24170bf..bcd0c78 100644 --- a/chrome/service/cloud_print/printer_job_handler.cc +++ b/chrome/service/cloud_print/printer_job_handler.cc @@ -47,7 +47,7 @@ PrinterJobHandler::PrinterJobHandler( server_error_count_(0), print_thread_("Chrome_CloudPrintJobPrintThread"), job_handler_message_loop_proxy_( - base::MessageLoopProxy::CreateForCurrentThread()), + base::MessageLoopProxy::current()), shutting_down_(false), job_check_pending_(false), printer_update_pending_(true), diff --git a/content/browser/geolocation/geolocation_provider.cc b/content/browser/geolocation/geolocation_provider.cc index 31c737b..582b28a 100644 --- a/content/browser/geolocation/geolocation_provider.cc +++ b/content/browser/geolocation/geolocation_provider.cc @@ -18,7 +18,7 @@ GeolocationProvider* GeolocationProvider::GetInstance() { GeolocationProvider::GeolocationProvider() : base::Thread("Geolocation"), - client_loop_(base::MessageLoopProxy::CreateForCurrentThread()), + client_loop_(base::MessageLoopProxy::current()), arbitrator_(NULL) { } diff --git a/content/browser/geolocation/mock_location_provider.cc b/content/browser/geolocation/mock_location_provider.cc index e6dda31..4a89613 100644 --- a/content/browser/geolocation/mock_location_provider.cc +++ b/content/browser/geolocation/mock_location_provider.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -22,7 +22,7 @@ MockLocationProvider* MockLocationProvider::instance_ = NULL; MockLocationProvider::MockLocationProvider(MockLocationProvider** self_ref) : state_(STOPPED), self_ref_(self_ref), - provider_loop_(base::MessageLoopProxy::CreateForCurrentThread()) { + provider_loop_(base::MessageLoopProxy::current()) { CHECK(self_ref_); CHECK(*self_ref_ == NULL); *self_ref_ = this; diff --git a/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc b/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc index 6020263..a4cc8f6 100644 --- a/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc +++ b/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc @@ -154,7 +154,7 @@ class IndexedDBQuotaClientTest : public TestingBrowserProcessTest { TEST_F(IndexedDBQuotaClientTest, GetOriginUsage) { IndexedDBQuotaClient client( - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), idb_context()); AddFakeIndexedDB(kOriginA, 6); @@ -173,7 +173,7 @@ TEST_F(IndexedDBQuotaClientTest, GetOriginUsage) { TEST_F(IndexedDBQuotaClientTest, GetOriginsForHost) { IndexedDBQuotaClient client( - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), idb_context()); EXPECT_EQ(kOriginA.host(), kOriginB.host()); @@ -199,7 +199,7 @@ TEST_F(IndexedDBQuotaClientTest, GetOriginsForHost) { TEST_F(IndexedDBQuotaClientTest, GetOriginsForType) { IndexedDBQuotaClient client( - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), idb_context()); EXPECT_TRUE(GetOriginsForType(&client, kTemp).empty()); @@ -215,7 +215,7 @@ TEST_F(IndexedDBQuotaClientTest, GetOriginsForType) { TEST_F(IndexedDBQuotaClientTest, DeleteOrigin) { IndexedDBQuotaClient client( - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), idb_context()); AddFakeIndexedDB(kOriginA, 1000); diff --git a/content/common/url_fetcher.cc b/content/common/url_fetcher.cc index c54c0d7..7f1f0c3 100644 --- a/content/common/url_fetcher.cc +++ b/content/common/url_fetcher.cc @@ -533,7 +533,7 @@ URLFetcher::Core::Core(URLFetcher* fetcher, request_type_(request_type), delegate_(d), delegate_loop_proxy_( - base::MessageLoopProxy::CreateForCurrentThread()), + base::MessageLoopProxy::current()), request_(NULL), load_flags_(net::LOAD_NORMAL), response_code_(URLFetcher::kInvalidHttpResponseCode), diff --git a/content/common/url_fetcher_unittest.cc b/content/common/url_fetcher_unittest.cc index 3e37f75..398a0cb 100644 --- a/content/common/url_fetcher_unittest.cc +++ b/content/common/url_fetcher_unittest.cc @@ -95,7 +95,7 @@ class URLFetcherTest : public testing::Test, public URLFetcher::Delegate { virtual void SetUp() { testing::Test::SetUp(); - io_message_loop_proxy_ = base::MessageLoopProxy::CreateForCurrentThread(); + io_message_loop_proxy_ = base::MessageLoopProxy::current(); #if defined(USE_NSS) crypto::EnsureNSSInit(); diff --git a/content/renderer/media/capture_video_decoder_unittest.cc b/content/renderer/media/capture_video_decoder_unittest.cc index 6852bee..8e7be2a 100644 --- a/content/renderer/media/capture_video_decoder_unittest.cc +++ b/content/renderer/media/capture_video_decoder_unittest.cc @@ -87,7 +87,7 @@ class CaptureVideoDecoderTest : public ::testing::Test { CaptureVideoDecoderTest() { message_loop_.reset(new MessageLoop(MessageLoop::TYPE_IO)); message_loop_proxy_ = - base::MessageLoopProxy::CreateForCurrentThread().get(); + base::MessageLoopProxy::current().get(); vc_manager_ = new MockVideoCaptureImplManager(); media::VideoCapture::VideoCaptureCapability capability; capability.width = 176; diff --git a/content/renderer/media/render_media_log.cc b/content/renderer/media/render_media_log.cc index 988a006..53b3522 100644 --- a/content/renderer/media/render_media_log.cc +++ b/content/renderer/media/render_media_log.cc @@ -9,7 +9,7 @@ #include "content/renderer/render_thread.h" RenderMediaLog::RenderMediaLog() - : render_loop_(base::MessageLoopProxy::CreateForCurrentThread()) { + : render_loop_(base::MessageLoopProxy::current()) { DCHECK(RenderThread::current()) << "RenderMediaLog must be constructed on the render thread"; } diff --git a/content/renderer/media/video_capture_impl_unittest.cc b/content/renderer/media/video_capture_impl_unittest.cc index 685f2d9..fc66030 100644 --- a/content/renderer/media/video_capture_impl_unittest.cc +++ b/content/renderer/media/video_capture_impl_unittest.cc @@ -67,7 +67,7 @@ class VideoCaptureImplTest : public ::testing::Test { VideoCaptureImplTest() { message_loop_.reset(new MessageLoop(MessageLoop::TYPE_IO)); message_loop_proxy_ = - base::MessageLoopProxy::CreateForCurrentThread().get(); + base::MessageLoopProxy::current().get(); message_filter_ = new MockVideoCaptureMessageFilter; session_id_ = 1; diff --git a/content/renderer/media/video_capture_message_filter.cc b/content/renderer/media/video_capture_message_filter.cc index aa30ca2..4a88e2d 100644 --- a/content/renderer/media/video_capture_message_filter.cc +++ b/content/renderer/media/video_capture_message_filter.cc @@ -40,7 +40,7 @@ bool VideoCaptureMessageFilter::OnMessageReceived(const IPC::Message& message) { void VideoCaptureMessageFilter::OnFilterAdded(IPC::Channel* channel) { VLOG(1) << "VideoCaptureMessageFilter::OnFilterAdded()"; // Captures the message loop proxy for IPC. - message_loop_proxy_ = base::MessageLoopProxy::CreateForCurrentThread(); + message_loop_proxy_ = base::MessageLoopProxy::current(); channel_ = channel; for (Delegates::iterator it = pending_delegates_.begin(); diff --git a/content/renderer/p2p/host_address_request.cc b/content/renderer/p2p/host_address_request.cc index 1db935a..2f795c7 100644 --- a/content/renderer/p2p/host_address_request.cc +++ b/content/renderer/p2p/host_address_request.cc @@ -12,7 +12,7 @@ P2PHostAddressRequest::P2PHostAddressRequest(P2PSocketDispatcher* dispatcher) : dispatcher_(dispatcher), ipc_message_loop_(dispatcher->message_loop()), - delegate_message_loop_(base::MessageLoopProxy::CreateForCurrentThread()), + delegate_message_loop_(base::MessageLoopProxy::current()), state_(STATE_CREATED), request_id_(0), registered_(false) { diff --git a/content/renderer/p2p/socket_client.cc b/content/renderer/p2p/socket_client.cc index 7937d27..612506a 100644 --- a/content/renderer/p2p/socket_client.cc +++ b/content/renderer/p2p/socket_client.cc @@ -11,7 +11,7 @@ P2PSocketClient::P2PSocketClient(P2PSocketDispatcher* dispatcher) : dispatcher_(dispatcher), ipc_message_loop_(dispatcher->message_loop()), - delegate_message_loop_(base::MessageLoopProxy::CreateForCurrentThread()), + delegate_message_loop_(base::MessageLoopProxy::current()), socket_id_(0), delegate_(NULL), state_(STATE_UNINITIALIZED) { } diff --git a/content/renderer/p2p/socket_dispatcher.cc b/content/renderer/p2p/socket_dispatcher.cc index ba00e99..42e7570 100644 --- a/content/renderer/p2p/socket_dispatcher.cc +++ b/content/renderer/p2p/socket_dispatcher.cc @@ -11,7 +11,7 @@ P2PSocketDispatcher::P2PSocketDispatcher(RenderView* render_view) : RenderViewObserver(render_view), - message_loop_(base::MessageLoopProxy::CreateForCurrentThread()), + message_loop_(base::MessageLoopProxy::current()), network_notifications_started_(false), network_list_observers_( new ObserverListThreadSafe<NetworkListObserver>()) { diff --git a/content/renderer/pepper_plugin_delegate_impl.cc b/content/renderer/pepper_plugin_delegate_impl.cc index c061b80..4491765 100644 --- a/content/renderer/pepper_plugin_delegate_impl.cc +++ b/content/renderer/pepper_plugin_delegate_impl.cc @@ -381,7 +381,7 @@ class PlatformVideoCaptureImpl public: PlatformVideoCaptureImpl(media::VideoCapture::EventHandler* handler) : handler_proxy_(new media::VideoCaptureHandlerProxy( - handler, base::MessageLoopProxy::CreateForCurrentThread())) { + handler, base::MessageLoopProxy::current())) { VideoCaptureImplManager* manager = RenderThread::current()->video_capture_impl_manager(); // 1 means the "default" video capture device. diff --git a/ipc/ipc_channel_proxy.cc b/ipc/ipc_channel_proxy.cc index cbc18bc..da3da24 100644 --- a/ipc/ipc_channel_proxy.cc +++ b/ipc/ipc_channel_proxy.cc @@ -60,7 +60,7 @@ void ChannelProxy::MessageFilter::OnDestruct() const { ChannelProxy::Context::Context(Channel::Listener* listener, base::MessageLoopProxy* ipc_message_loop) - : listener_message_loop_(base::MessageLoopProxy::CreateForCurrentThread()), + : listener_message_loop_(base::MessageLoopProxy::current()), listener_(listener), ipc_message_loop_(ipc_message_loop), peer_pid_(0), diff --git a/ipc/ipc_sync_channel.cc b/ipc/ipc_sync_channel.cc index f3a6a47..c135ef3 100644 --- a/ipc/ipc_sync_channel.cc +++ b/ipc/ipc_sync_channel.cc @@ -169,7 +169,7 @@ class SyncChannel::ReceivedSyncMsgQueue : // as manual reset. ReceivedSyncMsgQueue() : dispatch_event_(true, false), - listener_message_loop_(base::MessageLoopProxy::CreateForCurrentThread()), + listener_message_loop_(base::MessageLoopProxy::current()), task_pending_(false), listener_count_(0), top_send_done_watcher_(NULL) { diff --git a/jingle/notifier/base/proxy_resolving_client_socket_unittest.cc b/jingle/notifier/base/proxy_resolving_client_socket_unittest.cc index c7dc618..e0a46e5 100644 --- a/jingle/notifier/base/proxy_resolving_client_socket_unittest.cc +++ b/jingle/notifier/base/proxy_resolving_client_socket_unittest.cc @@ -17,7 +17,7 @@ namespace { class TestURLRequestContextGetter : public net::URLRequestContextGetter { public: TestURLRequestContextGetter() - : message_loop_proxy_(base::MessageLoopProxy::CreateForCurrentThread()) { + : message_loop_proxy_(base::MessageLoopProxy::current()) { } virtual ~TestURLRequestContextGetter() { } diff --git a/jingle/notifier/base/xmpp_connection_unittest.cc b/jingle/notifier/base/xmpp_connection_unittest.cc index 3b85363..4e1baa3 100644 --- a/jingle/notifier/base/xmpp_connection_unittest.cc +++ b/jingle/notifier/base/xmpp_connection_unittest.cc @@ -38,7 +38,7 @@ namespace { class TestURLRequestContextGetter : public net::URLRequestContextGetter { public: TestURLRequestContextGetter() - : message_loop_proxy_(base::MessageLoopProxy::CreateForCurrentThread()) { + : message_loop_proxy_(base::MessageLoopProxy::current()) { } virtual ~TestURLRequestContextGetter() { } diff --git a/jingle/notifier/listener/mediator_thread_impl.cc b/jingle/notifier/listener/mediator_thread_impl.cc index a9d7052..b5468de 100644 --- a/jingle/notifier/listener/mediator_thread_impl.cc +++ b/jingle/notifier/listener/mediator_thread_impl.cc @@ -213,7 +213,7 @@ void MediatorThreadImpl::Core::OnDisconnect() { MediatorThreadImpl::MediatorThreadImpl(const NotifierOptions& notifier_options) : core_(new Core(notifier_options)), parent_message_loop_proxy_( - base::MessageLoopProxy::CreateForCurrentThread()), + base::MessageLoopProxy::current()), io_message_loop_proxy_( notifier_options.request_context_getter->GetIOMessageLoopProxy()) { } diff --git a/jingle/notifier/listener/mediator_thread_unittest.cc b/jingle/notifier/listener/mediator_thread_unittest.cc index b97929d..6b01aa5 100644 --- a/jingle/notifier/listener/mediator_thread_unittest.cc +++ b/jingle/notifier/listener/mediator_thread_unittest.cc @@ -27,7 +27,7 @@ using ::testing::StrictMock; class TestURLRequestContextGetter : public net::URLRequestContextGetter { public: TestURLRequestContextGetter() - : message_loop_proxy_(base::MessageLoopProxy::CreateForCurrentThread()) { + : message_loop_proxy_(base::MessageLoopProxy::current()) { } virtual ~TestURLRequestContextGetter() { } diff --git a/net/base/directory_lister.cc b/net/base/directory_lister.cc index ee1f138..a5f2a2a 100644 --- a/net/base/directory_lister.cc +++ b/net/base/directory_lister.cc @@ -171,7 +171,7 @@ DirectoryLister::Core::Core(const FilePath& dir, DirectoryLister::Core::~Core() {} bool DirectoryLister::Core::Start() { - origin_loop_ = base::MessageLoopProxy::CreateForCurrentThread(); + origin_loop_ = base::MessageLoopProxy::current(); return base::WorkerPool::PostTask( FROM_HERE, NewRunnableMethod(this, &Core::StartInternal), true); diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc index 6697507..840d263 100644 --- a/net/base/host_resolver_impl.cc +++ b/net/base/host_resolver_impl.cc @@ -364,7 +364,7 @@ class HostResolverImpl::Job : id_(id), key_(key), resolver_(resolver), - origin_loop_(base::MessageLoopProxy::CreateForCurrentThread()), + origin_loop_(base::MessageLoopProxy::current()), resolver_proc_(resolver->effective_resolver_proc()), unresponsive_delay_(resolver->unresponsive_delay()), attempt_number_(0), @@ -825,7 +825,7 @@ class HostResolverImpl::IPv6ProbeJob public: explicit IPv6ProbeJob(HostResolverImpl* resolver) : resolver_(resolver), - origin_loop_(base::MessageLoopProxy::CreateForCurrentThread()) { + origin_loop_(base::MessageLoopProxy::current()) { DCHECK(resolver); } diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc index 3bf1aac..dd7bf89 100644 --- a/net/disk_cache/backend_unittest.cc +++ b/net/disk_cache/backend_unittest.cc @@ -266,7 +266,7 @@ TEST_F(DiskCacheTest, ShutdownWithPendingIO) { disk_cache::Backend* cache; int rv = disk_cache::BackendImpl::CreateBackend( path, false, 0, net::DISK_CACHE, disk_cache::kNoRandom, - base::MessageLoopProxy::CreateForCurrentThread(), NULL, + base::MessageLoopProxy::current(), NULL, &cache, &cb); ASSERT_EQ(net::OK, cb.GetResult(rv)); @@ -1818,7 +1818,7 @@ TEST_F(DiskCacheTest, Backend_UsageStats) { ASSERT_TRUE(DeleteCache(path)); scoped_ptr<disk_cache::BackendImpl> cache; cache.reset(new disk_cache::BackendImpl( - path, base::MessageLoopProxy::CreateForCurrentThread(), + path, base::MessageLoopProxy::current(), NULL)); ASSERT_TRUE(NULL != cache.get()); cache->SetUnitTestMode(); diff --git a/net/disk_cache/disk_cache_test_base.cc b/net/disk_cache/disk_cache_test_base.cc index bbcb65d..b9e1d10 100644 --- a/net/disk_cache/disk_cache_test_base.cc +++ b/net/disk_cache/disk_cache_test_base.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -250,7 +250,7 @@ void DiskCacheTestWithCache::InitDiskCache() { return InitDiskCacheImpl(path); scoped_refptr<base::MessageLoopProxy> thread = - use_current_thread_ ? base::MessageLoopProxy::CreateForCurrentThread() : + use_current_thread_ ? base::MessageLoopProxy::current() : cache_thread_.message_loop_proxy(); TestCompletionCallback cb; @@ -262,7 +262,7 @@ void DiskCacheTestWithCache::InitDiskCache() { void DiskCacheTestWithCache::InitDiskCacheImpl(const FilePath& path) { scoped_refptr<base::MessageLoopProxy> thread = - use_current_thread_ ? base::MessageLoopProxy::CreateForCurrentThread() : + use_current_thread_ ? base::MessageLoopProxy::current() : cache_thread_.message_loop_proxy(); if (mask_) cache_impl_ = new disk_cache::BackendImpl(path, mask_, thread, NULL); diff --git a/net/disk_cache/disk_cache_test_util.cc b/net/disk_cache/disk_cache_test_util.cc index 296636a..054a41e 100644 --- a/net/disk_cache/disk_cache_test_util.cc +++ b/net/disk_cache/disk_cache_test_util.cc @@ -94,7 +94,7 @@ bool CopyTestCache(const std::string& name) { bool CheckCacheIntegrity(const FilePath& path, bool new_eviction) { scoped_ptr<disk_cache::BackendImpl> cache(new disk_cache::BackendImpl( - path, base::MessageLoopProxy::CreateForCurrentThread(), NULL)); + path, base::MessageLoopProxy::current(), NULL)); if (!cache.get()) return false; if (new_eviction) diff --git a/net/disk_cache/in_flight_io.cc b/net/disk_cache/in_flight_io.cc index f10b4a6..6f4b37c 100644 --- a/net/disk_cache/in_flight_io.cc +++ b/net/disk_cache/in_flight_io.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -33,7 +33,7 @@ void BackgroundIO::NotifyController() { // --------------------------------------------------------------------------- InFlightIO::InFlightIO() - : callback_thread_(base::MessageLoopProxy::CreateForCurrentThread()), + : callback_thread_(base::MessageLoopProxy::current()), running_(false), single_thread_(false) { } diff --git a/net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc b/net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc index 017f246..6b7283d 100644 --- a/net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc +++ b/net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc @@ -112,7 +112,7 @@ GURL DhcpProxyScriptAdapterFetcher::GetPacURL() const { DhcpProxyScriptAdapterFetcher::WorkerThread::WorkerThread( const base::WeakPtr<DhcpProxyScriptAdapterFetcher>& owner) : owner_(owner), - origin_loop_(base::MessageLoopProxy::CreateForCurrentThread()) { + origin_loop_(base::MessageLoopProxy::current()) { } DhcpProxyScriptAdapterFetcher::WorkerThread::~WorkerThread() { diff --git a/net/proxy/dhcp_proxy_script_fetcher_win.cc b/net/proxy/dhcp_proxy_script_fetcher_win.cc index 2c7fd23..5453284 100644 --- a/net/proxy/dhcp_proxy_script_fetcher_win.cc +++ b/net/proxy/dhcp_proxy_script_fetcher_win.cc @@ -371,7 +371,7 @@ DhcpProxyScriptFetcherWin::WorkerThread::WorkerThread() { void DhcpProxyScriptFetcherWin::WorkerThread::Init( const base::WeakPtr<DhcpProxyScriptFetcherWin>& owner) { owner_ = owner; - origin_loop_ = base::MessageLoopProxy::CreateForCurrentThread(); + origin_loop_ = base::MessageLoopProxy::current(); } bool DhcpProxyScriptFetcherWin::WorkerThread::ImplGetCandidateAdapterNames( diff --git a/net/proxy/multi_threaded_proxy_resolver.cc b/net/proxy/multi_threaded_proxy_resolver.cc index 9db392b..99647e3 100644 --- a/net/proxy/multi_threaded_proxy_resolver.cc +++ b/net/proxy/multi_threaded_proxy_resolver.cc @@ -321,7 +321,7 @@ void MultiThreadedProxyResolver::Executor::StartJob(Job* job) { thread_->message_loop()->PostTask( FROM_HERE, NewRunnableMethod(job, &Job::Run, - base::MessageLoopProxy::CreateForCurrentThread())); + base::MessageLoopProxy::current())); } void MultiThreadedProxyResolver::Executor::OnJobCompleted(Job* job) { diff --git a/net/proxy/network_delegate_error_observer_unittest.cc b/net/proxy/network_delegate_error_observer_unittest.cc index 4eec44d..551c006 100644 --- a/net/proxy/network_delegate_error_observer_unittest.cc +++ b/net/proxy/network_delegate_error_observer_unittest.cc @@ -65,7 +65,7 @@ TEST(NetworkDelegateErrorObserverTest, CallOnThread) { TestNetworkDelegate network_delegate; NetworkDelegateErrorObserver observer(&network_delegate, - base::MessageLoopProxy::CreateForCurrentThread()); + base::MessageLoopProxy::current()); thread.message_loop()->PostTask( FROM_HERE, NewRunnableMethod(&observer, @@ -81,7 +81,7 @@ TEST(NetworkDelegateErrorObserverTest, NoDelegate) { base::Thread thread("test_thread"); thread.Start(); NetworkDelegateErrorObserver - observer(NULL, base::MessageLoopProxy::CreateForCurrentThread()); + observer(NULL, base::MessageLoopProxy::current()); thread.message_loop()->PostTask( FROM_HERE, NewRunnableMethod(&observer, diff --git a/net/proxy/polling_proxy_config_service.cc b/net/proxy/polling_proxy_config_service.cc index b347bc5..339fda6 100644 --- a/net/proxy/polling_proxy_config_service.cc +++ b/net/proxy/polling_proxy_config_service.cc @@ -136,7 +136,7 @@ class PollingProxyConfigService::Core // UI thread so we can't cache the IO thread for the purpose // of DCHECKs until the first call is made. if (!have_initialized_origin_loop_) { - origin_loop_proxy_ = base::MessageLoopProxy::CreateForCurrentThread(); + origin_loop_proxy_ = base::MessageLoopProxy::current(); have_initialized_origin_loop_ = true; } } diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc index d9173fb..66bf929 100644 --- a/net/proxy/proxy_service.cc +++ b/net/proxy/proxy_service.cc @@ -428,7 +428,7 @@ ProxyService* ProxyService::CreateUsingV8ProxyResolver( new ProxyResolverFactoryForV8( host_resolver, MessageLoop::current(), - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), net_log, network_delegate); diff --git a/ppapi/proxy/ppb_core_proxy.cc b/ppapi/proxy/ppb_core_proxy.cc index 41b3301..33820bc 100644 --- a/ppapi/proxy/ppb_core_proxy.cc +++ b/ppapi/proxy/ppb_core_proxy.cc @@ -30,7 +30,7 @@ namespace { base::MessageLoopProxy* GetMainThreadMessageLoop() { static scoped_refptr<base::MessageLoopProxy> proxy( - base::MessageLoopProxy::CreateForCurrentThread()); + base::MessageLoopProxy::current()); return proxy.get(); } diff --git a/ppapi/proxy/ppb_flash_file_proxy.cc b/ppapi/proxy/ppb_flash_file_proxy.cc index 825f02e..73e8a2d8 100644 --- a/ppapi/proxy/ppb_flash_file_proxy.cc +++ b/ppapi/proxy/ppb_flash_file_proxy.cc @@ -190,7 +190,7 @@ bool ModuleLocalThreadAdapter::Filter::OnMessageReceived( } ModuleLocalThreadAdapter::ModuleLocalThreadAdapter() - : main_thread_(base::MessageLoopProxy::CreateForCurrentThread()) { + : main_thread_(base::MessageLoopProxy::current()) { } void ModuleLocalThreadAdapter::AddInstanceRouting(PP_Instance instance, diff --git a/remoting/host/chromoting_host_unittest.cc b/remoting/host/chromoting_host_unittest.cc index d37f79f..129d922 100644 --- a/remoting/host/chromoting_host_unittest.cc +++ b/remoting/host/chromoting_host_unittest.cc @@ -69,7 +69,7 @@ class ChromotingHostTest : public testing::Test { } virtual void SetUp() OVERRIDE { - message_loop_proxy_ = base::MessageLoopProxy::CreateForCurrentThread(); + message_loop_proxy_ = base::MessageLoopProxy::current(); config_ = new InMemoryHostConfig(); ON_CALL(context_, main_message_loop()) .WillByDefault(Return(&message_loop_)); diff --git a/remoting/host/heartbeat_sender_unittest.cc b/remoting/host/heartbeat_sender_unittest.cc index bf42d25..8818c156 100644 --- a/remoting/host/heartbeat_sender_unittest.cc +++ b/remoting/host/heartbeat_sender_unittest.cc @@ -59,7 +59,7 @@ TEST_F(HeartbeatSenderTest, DoSendStanza) { EXPECT_CALL(*iq_request, set_callback(_)).Times(1); scoped_ptr<HeartbeatSender> heartbeat_sender( - new HeartbeatSender(base::MessageLoopProxy::CreateForCurrentThread(), + new HeartbeatSender(base::MessageLoopProxy::current(), config_)); ASSERT_TRUE(heartbeat_sender->Init()); @@ -79,7 +79,7 @@ TEST_F(HeartbeatSenderTest, DoSendStanza) { // Validate format of the heartbeat stanza. TEST_F(HeartbeatSenderTest, CreateHeartbeatMessage) { scoped_ptr<HeartbeatSender> heartbeat_sender( - new HeartbeatSender(base::MessageLoopProxy::CreateForCurrentThread(), + new HeartbeatSender(base::MessageLoopProxy::current(), config_)); ASSERT_TRUE(heartbeat_sender->Init()); @@ -131,7 +131,7 @@ TEST_F(HeartbeatSenderTest, ProcessResponse) { set_interval->AddText(base::IntToString(kTestInterval)); scoped_ptr<HeartbeatSender> heartbeat_sender( - new HeartbeatSender(base::MessageLoopProxy::CreateForCurrentThread(), + new HeartbeatSender(base::MessageLoopProxy::current(), config_)); heartbeat_sender->ProcessResponse(response.get()); diff --git a/remoting/host/host_key_pair_unittest.cc b/remoting/host/host_key_pair_unittest.cc index f479f54..ec4fc38 100644 --- a/remoting/host/host_key_pair_unittest.cc +++ b/remoting/host/host_key_pair_unittest.cc @@ -36,7 +36,7 @@ class HostKeyPairTest : public testing::Test { ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); FilePath config_path = test_dir_.path().AppendASCII("test_config.json"); config_ = new JsonHostConfig( - config_path, base::MessageLoopProxy::CreateForCurrentThread()); + config_path, base::MessageLoopProxy::current()); } MessageLoop message_loop_; diff --git a/remoting/host/json_host_config_unittest.cc b/remoting/host/json_host_config_unittest.cc index 5a59311..3184f75 100644 --- a/remoting/host/json_host_config_unittest.cc +++ b/remoting/host/json_host_config_unittest.cc @@ -27,7 +27,7 @@ const char* kTestConfig = class JsonHostConfigTest : public testing::Test { protected: virtual void SetUp() { - message_loop_proxy_ = base::MessageLoopProxy::CreateForCurrentThread(); + message_loop_proxy_ = base::MessageLoopProxy::current(); } static void WriteTestFile(const FilePath& filename) { diff --git a/remoting/host/screen_recorder_unittest.cc b/remoting/host/screen_recorder_unittest.cc index 0af77f1..f501a62 100644 --- a/remoting/host/screen_recorder_unittest.cc +++ b/remoting/host/screen_recorder_unittest.cc @@ -83,7 +83,7 @@ class ScreenRecorderTest : public testing::Test { record_ = new ScreenRecorder( &message_loop_, &message_loop_, - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), &capturer_, encoder_); } diff --git a/remoting/jingle_glue/jingle_thread.cc b/remoting/jingle_glue/jingle_thread.cc index 2dc37ad..1999506 100644 --- a/remoting/jingle_glue/jingle_thread.cc +++ b/remoting/jingle_glue/jingle_thread.cc @@ -154,7 +154,7 @@ void JingleThread::Start() { void JingleThread::Run() { JingleThreadMessageLoop message_loop(this); message_loop_ = &message_loop; - message_loop_proxy_ = base::MessageLoopProxy::CreateForCurrentThread(); + message_loop_proxy_ = base::MessageLoopProxy::current(); TaskPump task_pump; task_pump_ = &task_pump; diff --git a/remoting/protocol/connection_to_client_unittest.cc b/remoting/protocol/connection_to_client_unittest.cc index f6c9321..4199a02 100644 --- a/remoting/protocol/connection_to_client_unittest.cc +++ b/remoting/protocol/connection_to_client_unittest.cc @@ -30,7 +30,7 @@ class ConnectionToClientTest : public testing::Test { // Allocate a ClientConnection object with the mock objects. viewer_ = new ConnectionToClient( - base::MessageLoopProxy::CreateForCurrentThread(), &handler_); + base::MessageLoopProxy::current(), &handler_); viewer_->set_host_stub(&host_stub_); viewer_->set_input_stub(&input_stub_); viewer_->Init(session_); diff --git a/remoting/protocol/jingle_session_unittest.cc b/remoting/protocol/jingle_session_unittest.cc index 074e7c60..28b3081 100644 --- a/remoting/protocol/jingle_session_unittest.cc +++ b/remoting/protocol/jingle_session_unittest.cc @@ -178,7 +178,7 @@ class JingleSessionTest : public testing::Test { EXPECT_CALL(host_server_listener_, OnSessionManagerInitialized()) .Times(1); host_server_.reset(JingleSessionManager::CreateNotSandboxed( - base::MessageLoopProxy::CreateForCurrentThread())); + base::MessageLoopProxy::current())); host_server_->set_allow_local_ips(true); host_server_->Init( kHostJid, host_signal_strategy_.get(), &host_server_listener_, @@ -187,7 +187,7 @@ class JingleSessionTest : public testing::Test { EXPECT_CALL(client_server_listener_, OnSessionManagerInitialized()) .Times(1); client_server_.reset(JingleSessionManager::CreateNotSandboxed( - base::MessageLoopProxy::CreateForCurrentThread())); + base::MessageLoopProxy::current())); client_server_->set_allow_local_ips(true); client_server_->Init( kClientJid, client_signal_strategy_.get(), &client_server_listener_, diff --git a/remoting/protocol/protocol_mock_objects.cc b/remoting/protocol/protocol_mock_objects.cc index 34766c3..3ce8d31 100644 --- a/remoting/protocol/protocol_mock_objects.cc +++ b/remoting/protocol/protocol_mock_objects.cc @@ -13,7 +13,7 @@ MockConnectionToClient::MockConnectionToClient( EventHandler* handler, HostStub* host_stub, InputStub* input_stub) - : ConnectionToClient(base::MessageLoopProxy::CreateForCurrentThread(), + : ConnectionToClient(base::MessageLoopProxy::current(), handler) { set_host_stub(host_stub); set_input_stub(input_stub); diff --git a/remoting/protocol/rtp_video_reader_unittest.cc b/remoting/protocol/rtp_video_reader_unittest.cc index da5b5ca..8c70b3e9 100644 --- a/remoting/protocol/rtp_video_reader_unittest.cc +++ b/remoting/protocol/rtp_video_reader_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -67,7 +67,7 @@ class RtpVideoReaderTest : public testing::Test, void Reset() { session_.reset(new FakeSession()); reader_.reset(new RtpVideoReader( - base::MessageLoopProxy::CreateForCurrentThread())); + base::MessageLoopProxy::current())); reader_->Init(session_.get(), this, base::Bind(&RtpVideoReaderTest::OnReaderInitialized, base::Unretained(this))); diff --git a/remoting/protocol/rtp_video_writer_unittest.cc b/remoting/protocol/rtp_video_writer_unittest.cc index 0fe86e4c..e80d4fb 100644 --- a/remoting/protocol/rtp_video_writer_unittest.cc +++ b/remoting/protocol/rtp_video_writer_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -59,7 +59,7 @@ class RtpVideoWriterTest : public testing::Test { }; RtpVideoWriterTest() - : writer_(base::MessageLoopProxy::CreateForCurrentThread()) { + : writer_(base::MessageLoopProxy::current()) { } virtual void SetUp() { diff --git a/tools/heapcheck/suppressions.txt b/tools/heapcheck/suppressions.txt index ee75441..6c77072 100644 --- a/tools/heapcheck/suppressions.txt +++ b/tools/heapcheck/suppressions.txt @@ -1450,7 +1450,7 @@ { bug_81796_a Heapcheck:Leak - fun:base::MessageLoopProxy::CreateForCurrentThread + fun:base::MessageLoopProxy::current fun:*Context fun:*ChannelProxy fun:IPCChannelTest_ChannelProxyTest_Test::TestBody @@ -1458,7 +1458,7 @@ { bug_81796_b Heapcheck:Leak - fun:base::MessageLoopProxy::CreateForCurrentThread + fun:base::MessageLoopProxy::current ... fun:*SyncContext fun:*SyncChannel diff --git a/tools/valgrind/drmemory/suppressions.txt b/tools/valgrind/drmemory/suppressions.txt index 372bea9..3279810 100644 --- a/tools/valgrind/drmemory/suppressions.txt +++ b/tools/valgrind/drmemory/suppressions.txt @@ -775,7 +775,7 @@ LEAK # http://crbug.com/81522 LEAK *!operator new -*!base::MessageLoopProxy::CreateForCurrentThread +*!base::MessageLoopProxy::current *!IPC::ChannelProxy::Context::Context *!IPC::ChannelProxy::ChannelProxy *!IPCChannelTest_ChannelProxyTest_Test::TestBody @@ -801,7 +801,7 @@ UNINITIALIZED READ LEAK *!generic_cpp_alloc *!operator new -*!base::MessageLoopProxy::CreateForCurrentThread +*!base::MessageLoopProxy::current *!IPC::SyncChannel::ReceivedSyncMsgQueue::ReceivedSyncMsgQueue *!IPC::SyncChannel::ReceivedSyncMsgQueue::AddContext *!IPC::SyncChannel::SyncContext::SyncContext diff --git a/tools/valgrind/memcheck/suppressions.txt b/tools/valgrind/memcheck/suppressions.txt index 86b0e6d..f5ea3aa 100644 --- a/tools/valgrind/memcheck/suppressions.txt +++ b/tools/valgrind/memcheck/suppressions.txt @@ -3146,7 +3146,7 @@ bug_64804 Memcheck:Leak fun:_Znw* - fun:_ZN4base16MessageLoopProxy22CreateForCurrentThreadEv + fun:_ZN4base16MessageLoopProxy22currentEv ... fun:_ZN10URLFetcher4CoreC1EPS_RK4GURLNS_11RequestTypeEPNS_8DelegateE fun:_ZN10URLFetcherC*ERK4GURLNS_11RequestTypeEPNS_8DelegateE @@ -4305,7 +4305,7 @@ bug_81438 Memcheck:Leak ... - fun:*base16MessageLoopProxy22CreateForCurrentThread* + fun:*base16MessageLoopProxy22current* ... fun:*BrowserInit* } @@ -4383,14 +4383,14 @@ bug_82716a Memcheck:Leak fun:_Znw* - fun:_ZN4base16MessageLoopProxy22CreateForCurrentThreadEv + fun:_ZN4base16MessageLoopProxy22currentEv fun:_ZN3IPC12ChannelProxy7ContextC2EPNS_7Channel8ListenerEPN4base16MessageLoopProxyE } { bug_82716b Memcheck:Leak fun:_Znw* - fun:_ZN4base16MessageLoopProxy22CreateForCurrentThreadEv + fun:_ZN4base16MessageLoopProxy22currentEv ... fun:_ZN3IPC11SyncChannel20ReceivedSyncMsgQueueC1Ev fun:_ZN3IPC11SyncChannel20ReceivedSyncMsgQueue10AddContextEv @@ -4781,7 +4781,7 @@ bug_81796 Memcheck:Leak fun:_Znw* - fun:_ZN4base16MessageLoopProxy22CreateForCurrentThreadEv + fun:_ZN4base16MessageLoopProxy22currentEv fun:_ZN3IPC12ChannelProxy7ContextC1EPNS_7Channel8ListenerEPN4base16MessageLoopProxyE fun:_ZN3IPC12ChannelProxyC1ERKNS_13ChannelHandleENS_7Channel4ModeEPNS4_8ListenerEPN4base16MessageLoopProxyE } diff --git a/tools/valgrind/memcheck/suppressions_mac.txt b/tools/valgrind/memcheck/suppressions_mac.txt index f49e78c..6138b23 100644 --- a/tools/valgrind/memcheck/suppressions_mac.txt +++ b/tools/valgrind/memcheck/suppressions_mac.txt @@ -1252,7 +1252,7 @@ bug_64463 Memcheck:Leak fun:_Znw* - fun:_ZN4base16MessageLoopProxy22CreateForCurrentThreadEv + fun:_ZN4base16MessageLoopProxy22currentEv fun:_ZN3net12CertVerifier7RequestC2EPS0_PNS_15X509CertificateERKSsiPNS_16CertVerifyResultEP14CallbackRunnerI6Tuple1IiEE } { diff --git a/webkit/blob/blob_url_request_job_unittest.cc b/webkit/blob/blob_url_request_job_unittest.cc index 6a0bb6f..e263ca9 100644 --- a/webkit/blob/blob_url_request_job_unittest.cc +++ b/webkit/blob/blob_url_request_job_unittest.cc @@ -254,7 +254,7 @@ class BlobURLRequestJobTest : public testing::Test { blob_url_request_job_ = new BlobURLRequestJob( request_.get(), blob_data, - base::MessageLoopProxy::CreateForCurrentThread()); + base::MessageLoopProxy::current()); // Start the request. if (!extra_headers.IsEmpty()) diff --git a/webkit/blob/deletable_file_reference_unittest.cc b/webkit/blob/deletable_file_reference_unittest.cc index 8d764d9..d7c1d83 100644 --- a/webkit/blob/deletable_file_reference_unittest.cc +++ b/webkit/blob/deletable_file_reference_unittest.cc @@ -14,7 +14,7 @@ namespace webkit_blob { TEST(DeletableFileReferenceTest, TestReferences) { scoped_refptr<base::MessageLoopProxy> loop_proxy = - base::MessageLoopProxy::CreateForCurrentThread(); + base::MessageLoopProxy::current(); ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); diff --git a/webkit/database/database_connections.cc b/webkit/database/database_connections.cc index d90498f..a5d762d 100644 --- a/webkit/database/database_connections.cc +++ b/webkit/database/database_connections.cc @@ -120,7 +120,7 @@ bool DatabaseConnections::RemoveConnectionsHelper( DatabaseConnectionsWrapper::DatabaseConnectionsWrapper() : waiting_for_dbs_to_close_(false), - main_thread_(base::MessageLoopProxy::CreateForCurrentThread()) { + main_thread_(base::MessageLoopProxy::current()) { } DatabaseConnectionsWrapper::~DatabaseConnectionsWrapper() { diff --git a/webkit/database/database_quota_client_unittest.cc b/webkit/database/database_quota_client_unittest.cc index cc2762a..2f29f60 100644 --- a/webkit/database/database_quota_client_unittest.cc +++ b/webkit/database/database_quota_client_unittest.cc @@ -71,7 +71,7 @@ class MockDatabaseTracker : public DatabaseTracker { net::CompletionCallback* callback) { ++delete_called_count_; if (async_delete()) { - base::MessageLoopProxy::CreateForCurrentThread()->PostTask(FROM_HERE, + base::MessageLoopProxy::current()->PostTask(FROM_HERE, NewRunnableMethod(this, &MockDatabaseTracker::AsyncDeleteDataForOrigin, callback)); return net::ERR_IO_PENDING; @@ -205,7 +205,7 @@ class DatabaseQuotaClientTest : public testing::Test { TEST_F(DatabaseQuotaClientTest, GetOriginUsage) { DatabaseQuotaClient client( - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), mock_tracker()); EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kTemp)); @@ -221,7 +221,7 @@ TEST_F(DatabaseQuotaClientTest, GetOriginUsage) { TEST_F(DatabaseQuotaClientTest, GetOriginsForHost) { DatabaseQuotaClient client( - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), mock_tracker()); EXPECT_EQ(kOriginA.host(), kOriginB.host()); @@ -247,7 +247,7 @@ TEST_F(DatabaseQuotaClientTest, GetOriginsForHost) { TEST_F(DatabaseQuotaClientTest, GetOriginsForType) { DatabaseQuotaClient client( - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), mock_tracker()); EXPECT_TRUE(GetOriginsForType(&client, kTemp).empty()); @@ -263,7 +263,7 @@ TEST_F(DatabaseQuotaClientTest, GetOriginsForType) { TEST_F(DatabaseQuotaClientTest, DeleteOriginData) { DatabaseQuotaClient client( - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), mock_tracker()); // Perm deletions are short circuited in the Client and diff --git a/webkit/database/database_tracker_unittest.cc b/webkit/database/database_tracker_unittest.cc index c6404b1..cf499b9 100644 --- a/webkit/database/database_tracker_unittest.cc +++ b/webkit/database/database_tracker_unittest.cc @@ -540,7 +540,7 @@ class DatabaseTracker_TestHelper_Test { temp_dir.path(), false, true, new TestSpecialStoragePolicy, NULL, - base::MessageLoopProxy::CreateForCurrentThread())); + base::MessageLoopProxy::current())); // Open three new databases. tracker->DatabaseOpened(kOrigin1, kDB1, kDescription, 0, diff --git a/webkit/fileapi/file_system_context_unittest.cc b/webkit/fileapi/file_system_context_unittest.cc index 6913315..2992dfb 100644 --- a/webkit/fileapi/file_system_context_unittest.cc +++ b/webkit/fileapi/file_system_context_unittest.cc @@ -43,8 +43,8 @@ scoped_refptr<FileSystemContext> NewFileSystemContext( bool allow_file_access, bool unlimited_quota, scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy) { - return new FileSystemContext(base::MessageLoopProxy::CreateForCurrentThread(), - base::MessageLoopProxy::CreateForCurrentThread(), + return new FileSystemContext(base::MessageLoopProxy::current(), + base::MessageLoopProxy::current(), special_storage_policy, NULL /* quota manager */, FilePath(), false /* is_incognito */, diff --git a/webkit/fileapi/file_system_dir_url_request_job_unittest.cc b/webkit/fileapi/file_system_dir_url_request_job_unittest.cc index 738c64d..6865957 100644 --- a/webkit/fileapi/file_system_dir_url_request_job_unittest.cc +++ b/webkit/fileapi/file_system_dir_url_request_job_unittest.cc @@ -68,13 +68,13 @@ class FileSystemDirURLRequestJobTest : public testing::Test { virtual void SetUp() { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - file_thread_proxy_ = base::MessageLoopProxy::CreateForCurrentThread(); + file_thread_proxy_ = base::MessageLoopProxy::current(); special_storage_policy_ = new TestSpecialStoragePolicy(); file_system_context_ = new FileSystemContext( - base::MessageLoopProxy::CreateForCurrentThread(), - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), + base::MessageLoopProxy::current(), special_storage_policy_, NULL, FilePath(), false /* is_incognito */, false, true, diff --git a/webkit/fileapi/file_system_file_util_proxy.cc b/webkit/fileapi/file_system_file_util_proxy.cc index dd86595..162a927 100644 --- a/webkit/fileapi/file_system_file_util_proxy.cc +++ b/webkit/fileapi/file_system_file_util_proxy.cc @@ -18,7 +18,7 @@ class MessageLoopRelay // File thread. explicit MessageLoopRelay(const fileapi::FileSystemOperationContext& context) : origin_message_loop_proxy_( - base::MessageLoopProxy::CreateForCurrentThread()), + base::MessageLoopProxy::current()), error_code_(base::PLATFORM_FILE_OK), context_(context), file_system_file_util_(NULL) { diff --git a/webkit/fileapi/file_system_operation_unittest.cc b/webkit/fileapi/file_system_operation_unittest.cc index 6c609c5..f56dfe5 100644 --- a/webkit/fileapi/file_system_operation_unittest.cc +++ b/webkit/fileapi/file_system_operation_unittest.cc @@ -40,8 +40,8 @@ class MockQuotaManager : public QuotaManager { const GURL& origin, StorageType type) : QuotaManager(false /* is_incognito */, base_dir, - base::MessageLoopProxy::CreateForCurrentThread(), - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), + base::MessageLoopProxy::current(), NULL), origin_(origin), type_(type), @@ -89,7 +89,7 @@ class MockQuotaManagerProxy : public QuotaManagerProxy { public: explicit MockQuotaManagerProxy(QuotaManager* quota_manager) : QuotaManagerProxy(quota_manager, - base::MessageLoopProxy::CreateForCurrentThread()), + base::MessageLoopProxy::current()), registered_client_(NULL) { } diff --git a/webkit/fileapi/file_system_operation_write_unittest.cc b/webkit/fileapi/file_system_operation_write_unittest.cc index 22c26c8..df1ebba 100644 --- a/webkit/fileapi/file_system_operation_write_unittest.cc +++ b/webkit/fileapi/file_system_operation_write_unittest.cc @@ -42,8 +42,8 @@ class MockQuotaManager : public QuotaManager { public: MockQuotaManager(const FilePath& base_dir, int64 quota) : QuotaManager(false /* is_incognito */, base_dir, - base::MessageLoopProxy::CreateForCurrentThread(), - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), + base::MessageLoopProxy::current(), NULL /* special_storage_policy */), usage_(0), quota_(quota) {} @@ -144,7 +144,7 @@ static net::URLRequestJob* BlobURLRequestJobFactory(net::URLRequest* request, return new webkit_blob::BlobURLRequestJob( request, blob_storage_controller->GetBlobDataFromUrl(request->url()), - base::MessageLoopProxy::CreateForCurrentThread()); + base::MessageLoopProxy::current()); } class MockDispatcher : public FileSystemCallbackDispatcher { diff --git a/webkit/fileapi/file_system_path_manager_unittest.cc b/webkit/fileapi/file_system_path_manager_unittest.cc index 122487e..008c077 100644 --- a/webkit/fileapi/file_system_path_manager_unittest.cc +++ b/webkit/fileapi/file_system_path_manager_unittest.cc @@ -240,7 +240,7 @@ class FileSystemPathManagerTest : public testing::Test { bool incognito, bool allow_file_access) { FileSystemPathManager* manager = new FileSystemPathManager( - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), data_dir_.path(), scoped_refptr<quota::SpecialStoragePolicy>( new TestSpecialStoragePolicy()), diff --git a/webkit/fileapi/file_system_quota_client_unittest.cc b/webkit/fileapi/file_system_quota_client_unittest.cc index 2254f51..b78d187 100644 --- a/webkit/fileapi/file_system_quota_client_unittest.cc +++ b/webkit/fileapi/file_system_quota_client_unittest.cc @@ -35,7 +35,7 @@ const quota::StorageType kPersistent = quota::kStorageTypePersistent; class MockFileSystemPathManager : public FileSystemPathManager { public: explicit MockFileSystemPathManager(const FilePath& filesystem_path) - : FileSystemPathManager(base::MessageLoopProxy::CreateForCurrentThread(), + : FileSystemPathManager(base::MessageLoopProxy::current(), filesystem_path, NULL, false, true) {} }; @@ -53,8 +53,8 @@ class FileSystemQuotaClientTest : public testing::Test { ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); file_system_context_ = new FileSystemContext( - base::MessageLoopProxy::CreateForCurrentThread(), - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), + base::MessageLoopProxy::current(), NULL, NULL, FilePath(), false /* is_incognito */, false, true, @@ -72,7 +72,7 @@ class FileSystemQuotaClientTest : public testing::Test { protected: FileSystemQuotaClient* NewQuotaClient(bool is_incognito) { return new FileSystemQuotaClient( - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), file_system_context_, is_incognito); } diff --git a/webkit/fileapi/file_system_quota_unittest.cc b/webkit/fileapi/file_system_quota_unittest.cc index e0bd554..40d6423 100644 --- a/webkit/fileapi/file_system_quota_unittest.cc +++ b/webkit/fileapi/file_system_quota_unittest.cc @@ -213,8 +213,8 @@ void FileSystemQuotaTest::SetUp() { quota_manager_ = new quota::QuotaManager( false /* is_incognito */, filesystem_dir_path, - base::MessageLoopProxy::CreateForCurrentThread(), - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), + base::MessageLoopProxy::current(), NULL); test_helper_.SetUp(filesystem_dir_path, @@ -384,13 +384,13 @@ void FileSystemObfuscatedQuotaTest::SetUp() { quota_manager_ = new quota::QuotaManager( false /* is_incognito */, filesystem_dir_path, - base::MessageLoopProxy::CreateForCurrentThread(), - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), + base::MessageLoopProxy::current(), NULL); file_system_context_ = new FileSystemContext( - base::MessageLoopProxy::CreateForCurrentThread(), - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), + base::MessageLoopProxy::current(), new quota::MockSpecialStoragePolicy(), quota_manager_->proxy(), filesystem_dir_path, diff --git a/webkit/fileapi/file_system_test_helper.cc b/webkit/fileapi/file_system_test_helper.cc index dd5bfa4..535ad76 100644 --- a/webkit/fileapi/file_system_test_helper.cc +++ b/webkit/fileapi/file_system_test_helper.cc @@ -94,8 +94,8 @@ void FileSystemTestOriginHelper::SetUp( file_util_ = file_util; DCHECK(file_util_); file_system_context_ = new FileSystemContext( - base::MessageLoopProxy::CreateForCurrentThread(), - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), + base::MessageLoopProxy::current(), new TestSpecialStoragePolicy(unlimited_quota), quota_manager_proxy, base_dir, @@ -183,7 +183,7 @@ FileSystemOperation* FileSystemTestOriginHelper::NewOperation( DCHECK(file_util_); FileSystemOperation* operation = new FileSystemOperation(callback_dispatcher, - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), file_system_context_.get(), file_util_); InitializeOperationContext(operation->file_system_operation_context()); diff --git a/webkit/fileapi/file_system_url_request_job_unittest.cc b/webkit/fileapi/file_system_url_request_job_unittest.cc index 987adb1..61eee22 100644 --- a/webkit/fileapi/file_system_url_request_job_unittest.cc +++ b/webkit/fileapi/file_system_url_request_job_unittest.cc @@ -92,13 +92,13 @@ class FileSystemURLRequestJobTest : public testing::Test { // TODO(adamk): Run this on the FILE thread we've created as well. file_system_context_ = new FileSystemContext( - base::MessageLoopProxy::CreateForCurrentThread(), - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), + base::MessageLoopProxy::current(), special_storage_policy_, NULL, FilePath(), false /* is_incognito */, false, true, new FileSystemPathManager( - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), temp_dir_.path(), NULL, false, false)); file_system_context_->path_manager()->ValidateFileSystemRootAndGetURL( @@ -134,7 +134,7 @@ class FileSystemURLRequestJobTest : public testing::Test { job_ = new FileSystemURLRequestJob( request_.get(), file_system_context_.get(), - base::MessageLoopProxy::CreateForCurrentThread()); + base::MessageLoopProxy::current()); request_->Start(); ASSERT_TRUE(request_->is_pending()); // verify that we're starting async diff --git a/webkit/fileapi/file_writer_delegate.cc b/webkit/fileapi/file_writer_delegate.cc index 4bb1f9ba..1051277 100644 --- a/webkit/fileapi/file_writer_delegate.cc +++ b/webkit/fileapi/file_writer_delegate.cc @@ -32,7 +32,7 @@ class InitializeTask : public base::RefCountedThreadSafe<InitializeTask> { FileSystemOperationContext* context, InitializeTaskCallback* callback) : origin_message_loop_proxy_( - base::MessageLoopProxy::CreateForCurrentThread()), + base::MessageLoopProxy::current()), error_code_(base::PLATFORM_FILE_OK), file_(file), context_(*context), diff --git a/webkit/fileapi/file_writer_delegate_unittest.cc b/webkit/fileapi/file_writer_delegate_unittest.cc index 5af69c1..fd3ed04 100644 --- a/webkit/fileapi/file_writer_delegate_unittest.cc +++ b/webkit/fileapi/file_writer_delegate_unittest.cc @@ -108,7 +108,7 @@ class FileWriterDelegateTest : public PlatformTest { result_.reset(new Result()); file_writer_delegate_.reset(new FileWriterDelegate( CreateNewOperation(result_.get(), allowed_growth), - offset, base::MessageLoopProxy::CreateForCurrentThread())); + offset, base::MessageLoopProxy::current())); request_.reset(new net::URLRequest(blob_url, file_writer_delegate_.get())); } @@ -359,7 +359,7 @@ TEST_F(FileWriterDelegateTest, WriteSuccessWithoutQuotaLimitConcurrent) { result2.reset(new Result()); file_writer_delegate2.reset(new FileWriterDelegate( CreateNewOperation(result2.get(), QuotaFileUtil::kNoLimit), - 0, base::MessageLoopProxy::CreateForCurrentThread())); + 0, base::MessageLoopProxy::current())); request2.reset(new net::URLRequest(kBlobURL2, file_writer_delegate2.get())); ASSERT_EQ(FileSystemUsageCache::kUsageFileSize, diff --git a/webkit/fileapi/sandbox_mount_point_provider.cc b/webkit/fileapi/sandbox_mount_point_provider.cc index 6570170..920a820 100644 --- a/webkit/fileapi/sandbox_mount_point_provider.cc +++ b/webkit/fileapi/sandbox_mount_point_provider.cc @@ -313,7 +313,7 @@ class SandboxMountPointProvider::GetFileSystemRootPathTask FileSystemPathManager::GetRootPathCallback* callback) : file_message_loop_(file_message_loop), origin_message_loop_proxy_( - base::MessageLoopProxy::CreateForCurrentThread()), + base::MessageLoopProxy::current()), origin_url_(origin_url), type_(type), file_util_(file_util), diff --git a/webkit/fileapi/sandbox_mount_point_provider_unittest.cc b/webkit/fileapi/sandbox_mount_point_provider_unittest.cc index 511a013..d41d46b 100644 --- a/webkit/fileapi/sandbox_mount_point_provider_unittest.cc +++ b/webkit/fileapi/sandbox_mount_point_provider_unittest.cc @@ -28,7 +28,7 @@ namespace fileapi { class MockFileSystemPathManager : public FileSystemPathManager { public: explicit MockFileSystemPathManager(const FilePath& profile_path) - : FileSystemPathManager(base::MessageLoopProxy::CreateForCurrentThread(), + : FileSystemPathManager(base::MessageLoopProxy::current(), profile_path, NULL, false, true) {} }; @@ -161,8 +161,8 @@ class SandboxMountPointProviderMigrationTest : public testing::Test { path_manager_ = new MockFileSystemPathManager(data_dir_.path()); file_system_context_ = new FileSystemContext( - base::MessageLoopProxy::CreateForCurrentThread(), - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), + base::MessageLoopProxy::current(), new TestSpecialStoragePolicy(true /* unlimited quota */), NULL, data_dir_.path(), diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc index 1600c59..f891e9b 100644 --- a/webkit/plugins/ppapi/plugin_module.cc +++ b/webkit/plugins/ppapi/plugin_module.cc @@ -131,7 +131,7 @@ PluginModuleSet* GetLivePluginSet() { base::MessageLoopProxy* GetMainThreadMessageLoop() { static scoped_refptr<base::MessageLoopProxy> proxy( - base::MessageLoopProxy::CreateForCurrentThread()); + base::MessageLoopProxy::current()); return proxy.get(); } diff --git a/webkit/plugins/ppapi/quota_file_io.cc b/webkit/plugins/ppapi/quota_file_io.cc index 852d842..d5af70b 100644 --- a/webkit/plugins/ppapi/quota_file_io.cc +++ b/webkit/plugins/ppapi/quota_file_io.cc @@ -104,7 +104,7 @@ class QuotaFileIO::WriteOperation : public PendingOperationBase { bool finished() const { return finished_; } virtual void WillRunCallback() { - base::MessageLoopProxy::CreateForCurrentThread()->PostTask( + base::MessageLoopProxy::current()->PostTask( FROM_HERE, runnable_factory_.NewRunnableMethod( &WriteOperation::RunCallback)); } diff --git a/webkit/plugins/ppapi/quota_file_io_unittest.cc b/webkit/plugins/ppapi/quota_file_io_unittest.cc index 89b1a80..1e0b360 100644 --- a/webkit/plugins/ppapi/quota_file_io_unittest.cc +++ b/webkit/plugins/ppapi/quota_file_io_unittest.cc @@ -29,7 +29,7 @@ class QuotaMockPluginDelegate : public MockPluginDelegate { QuotaMockPluginDelegate() : available_space_(0), will_update_count_(0), - file_thread_(MessageLoopProxy::CreateForCurrentThread()), + file_thread_(MessageLoopProxy::current()), runnable_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { } virtual ~QuotaMockPluginDelegate() {} @@ -43,7 +43,7 @@ class QuotaMockPluginDelegate : public MockPluginDelegate { quota::StorageType type, Callback* callback) OVERRIDE { DCHECK(callback); - MessageLoopProxy::CreateForCurrentThread()->PostTask( + MessageLoopProxy::current()->PostTask( FROM_HERE, runnable_factory_.NewRunnableMethod( &QuotaMockPluginDelegate::RunAvailableSpaceCallback, callback)); } diff --git a/webkit/quota/mock_quota_manager_unittest.cc b/webkit/quota/mock_quota_manager_unittest.cc index 7188906..503f8aa 100644 --- a/webkit/quota/mock_quota_manager_unittest.cc +++ b/webkit/quota/mock_quota_manager_unittest.cc @@ -39,8 +39,8 @@ class MockQuotaManagerTest : public testing::Test { manager_ = new MockQuotaManager( false /* is_incognito */, data_dir_.path(), - base::MessageLoopProxy::CreateForCurrentThread(), - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), + base::MessageLoopProxy::current(), policy_); } diff --git a/webkit/quota/mock_storage_client.cc b/webkit/quota/mock_storage_client.cc index 203c6cb5..d42ed8d 100644 --- a/webkit/quota/mock_storage_client.cc +++ b/webkit/quota/mock_storage_client.cc @@ -115,7 +115,7 @@ void MockStorageClient::GetOriginUsage(const GURL& origin_url, StorageType type, GetUsageCallback* callback) { usage_callbacks_.insert(callback); - base::MessageLoopProxy::CreateForCurrentThread()->PostTask( + base::MessageLoopProxy::current()->PostTask( FROM_HERE, runnable_factory_.NewRunnableMethod( &MockStorageClient::RunGetOriginUsage, origin_url, type, callback)); @@ -124,7 +124,7 @@ void MockStorageClient::GetOriginUsage(const GURL& origin_url, void MockStorageClient::GetOriginsForType( StorageType type, GetOriginsCallback* callback) { origins_callbacks_.insert(callback); - base::MessageLoopProxy::CreateForCurrentThread()->PostTask( + base::MessageLoopProxy::current()->PostTask( FROM_HERE, runnable_factory_.NewRunnableMethod( &MockStorageClient::RunGetOriginsForType, type, callback)); @@ -134,7 +134,7 @@ void MockStorageClient::GetOriginsForHost( StorageType type, const std::string& host, GetOriginsCallback* callback) { origins_callbacks_.insert(callback); - base::MessageLoopProxy::CreateForCurrentThread()->PostTask( + base::MessageLoopProxy::current()->PostTask( FROM_HERE, runnable_factory_.NewRunnableMethod( &MockStorageClient::RunGetOriginsForHost, type, host, callback)); @@ -144,7 +144,7 @@ void MockStorageClient::DeleteOriginData( const GURL& origin, StorageType type, DeletionCallback* callback) { deletion_callbacks_.insert(callback); - base::MessageLoopProxy::CreateForCurrentThread()->PostTask( + base::MessageLoopProxy::current()->PostTask( FROM_HERE, runnable_factory_.NewRunnableMethod( &MockStorageClient::RunDeleteOriginData, origin, type, callback)); diff --git a/webkit/quota/quota_manager_unittest.cc b/webkit/quota/quota_manager_unittest.cc index f43bd64..3e6b32a 100644 --- a/webkit/quota/quota_manager_unittest.cc +++ b/webkit/quota/quota_manager_unittest.cc @@ -52,8 +52,8 @@ class QuotaManagerTest : public testing::Test { quota_manager_ = new QuotaManager( false /* is_incognito */, data_dir_.path(), - MessageLoopProxy::CreateForCurrentThread(), - MessageLoopProxy::CreateForCurrentThread(), + MessageLoopProxy::current(), + MessageLoopProxy::current(), mock_special_storage_policy_); // Don't (automatically) start the eviction for testing. quota_manager_->eviction_disabled_ = true; diff --git a/webkit/quota/quota_task.cc b/webkit/quota/quota_task.cc index 1f25ddf..f42ae4f 100644 --- a/webkit/quota/quota_task.cc +++ b/webkit/quota/quota_task.cc @@ -27,7 +27,7 @@ void QuotaTask::Start() { QuotaTask::QuotaTask(QuotaTaskObserver* observer) : observer_(observer), - original_message_loop_(MessageLoopProxy::CreateForCurrentThread()) { + original_message_loop_(MessageLoopProxy::current()) { } void QuotaTask::CallCompleted() { diff --git a/webkit/tools/test_shell/simple_file_system.cc b/webkit/tools/test_shell/simple_file_system.cc index 5a0ad62..6b30563 100644 --- a/webkit/tools/test_shell/simple_file_system.cc +++ b/webkit/tools/test_shell/simple_file_system.cc @@ -132,8 +132,8 @@ class SimpleFileSystemCallbackDispatcher SimpleFileSystem::SimpleFileSystem() { if (file_system_dir_.CreateUniqueTempDir()) { file_system_context_ = new FileSystemContext( - base::MessageLoopProxy::CreateForCurrentThread(), - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), + base::MessageLoopProxy::current(), NULL /* special storage policy */, NULL /* quota manager */, file_system_dir_.path(), @@ -298,7 +298,7 @@ FileSystemOperation* SimpleFileSystem::GetNewOperation( SimpleFileSystemCallbackDispatcher* dispatcher = new SimpleFileSystemCallbackDispatcher(AsWeakPtr(), callbacks); FileSystemOperation* operation = new FileSystemOperation( - dispatcher, base::MessageLoopProxy::CreateForCurrentThread(), + dispatcher, base::MessageLoopProxy::current(), file_system_context_.get(), NULL); return operation; } diff --git a/webkit/tools/test_shell/simple_file_writer.cc b/webkit/tools/test_shell/simple_file_writer.cc index 83bc59f..fee2c55 100644 --- a/webkit/tools/test_shell/simple_file_writer.cc +++ b/webkit/tools/test_shell/simple_file_writer.cc @@ -39,7 +39,7 @@ class SimpleFileWriter::IOThreadProxy // The IO thread needs to be running for this class to work. SimpleResourceLoaderBridge::EnsureIOThread(); io_thread_ = SimpleResourceLoaderBridge::GetIoThread(); - main_thread_ = base::MessageLoopProxy::CreateForCurrentThread(); + main_thread_ = base::MessageLoopProxy::current(); } virtual ~IOThreadProxy() { diff --git a/webkit/tools/test_shell/simple_resource_loader_bridge.cc b/webkit/tools/test_shell/simple_resource_loader_bridge.cc index ff5691c..97de4ce 100644 --- a/webkit/tools/test_shell/simple_resource_loader_bridge.cc +++ b/webkit/tools/test_shell/simple_resource_loader_bridge.cc @@ -312,7 +312,7 @@ class RequestProxy : public net::URLRequest::Delegate, FilePath path; if (file_util::CreateTemporaryFile(&path)) { downloaded_file_ = DeletableFileReference::GetOrCreate( - path, base::MessageLoopProxy::CreateForCurrentThread()); + path, base::MessageLoopProxy::current()); file_stream_.Open( path, base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE); } |