summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-06 18:34:24 +0000
committersanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-06 18:34:24 +0000
commit656475d275524893e4e9b1f02469fe470721a14e (patch)
tree76198770e24f0bea147c10a50ae2a3bf9c7f7274
parent7e19edf7255b366b5e4b9b0bb77caf9842a37f1b (diff)
downloadchromium_src-656475d275524893e4e9b1f02469fe470721a14e.zip
chromium_src-656475d275524893e4e9b1f02469fe470721a14e.tar.gz
chromium_src-656475d275524893e4e9b1f02469fe470721a14e.tar.bz2
Created a stock implementation of the MessageLoopProxy interface than can be used to create an implementation that targets the current thread's message loop.
BUG=None TEST=Unit tests provided. Review URL: http://codereview.chromium.org/1837003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46591 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/base.gyp1
-rw-r--r--base/base.gypi2
-rw-r--r--base/message_loop_proxy.h28
-rw-r--r--base/message_loop_proxy_impl.cc101
-rw-r--r--base/message_loop_proxy_impl.h61
-rw-r--r--base/message_loop_proxy_impl_unittest.cc131
-rw-r--r--base/thread.cc2
-rw-r--r--base/thread.h15
-rw-r--r--chrome/browser/chrome_plugin_unittest.cc2
-rw-r--r--chrome/browser/chrome_thread.cc7
-rw-r--r--chrome/browser/chrome_thread.h4
-rw-r--r--chrome/browser/chrome_thread_unittest.cc10
-rw-r--r--chrome/browser/net/chrome_url_request_context.cc2
-rw-r--r--chrome/browser/net/chrome_url_request_context.h2
-rw-r--r--chrome/browser/net/url_fetcher.cc2
-rw-r--r--chrome/browser/net/url_fetcher_unittest.cc4
-rw-r--r--chrome/browser/net/url_request_context_getter.cc2
-rw-r--r--chrome/browser/net/url_request_context_getter.h7
-rw-r--r--chrome/browser/sync/glue/http_bridge.cc2
-rw-r--r--chrome/browser/sync/glue/http_bridge.h2
-rw-r--r--chrome/browser/sync/glue/http_bridge_unittest.cc2
-rw-r--r--chrome/test/testing_profile.cc4
22 files changed, 369 insertions, 24 deletions
diff --git a/base/base.gyp b/base/base.gyp
index e3a236c..23201d2 100644
--- a/base/base.gyp
+++ b/base/base.gyp
@@ -98,6 +98,7 @@
'linked_list_unittest.cc',
'linked_ptr_unittest.cc',
'mac_util_unittest.mm',
+ 'message_loop_proxy_impl_unittest.cc',
'message_loop_unittest.cc',
'message_pump_glib_unittest.cc',
'object_watcher_unittest.cc',
diff --git a/base/base.gypi b/base/base.gypi
index 22a72f9..b2074c2 100644
--- a/base/base.gypi
+++ b/base/base.gypi
@@ -118,6 +118,8 @@
'message_loop.cc',
'message_loop.h',
'message_loop_proxy.h',
+ 'message_loop_proxy_impl.cc',
+ 'message_loop_proxy_impl.h',
'message_pump.h',
'message_pump_default.cc',
'message_pump_default.h',
diff --git a/base/message_loop_proxy.h b/base/message_loop_proxy.h
index 4b6abce..26fd368 100644
--- a/base/message_loop_proxy.h
+++ b/base/message_loop_proxy.h
@@ -9,9 +9,15 @@
#include "base/ref_counted.h"
#include "base/task.h"
+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.
-class MessageLoopProxy : public base::RefCountedThreadSafe<MessageLoopProxy> {
+class MessageLoopProxy
+ : public base::RefCountedThreadSafe<MessageLoopProxy,
+ MessageLoopProxyTraits> {
public:
// These are the same methods in message_loop.h, but are guaranteed to either
// get posted to the MessageLoop if it's still alive, or be deleted otherwise.
@@ -42,7 +48,27 @@ class MessageLoopProxy : public base::RefCountedThreadSafe<MessageLoopProxy> {
T* object) {
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();
+
+ protected:
+ friend struct MessageLoopProxyTraits;
+ // Called when the proxy is about to be deleted. Subclasses can override this
+ // to provide deletion on specific threads.
+ virtual void OnDestruct() {
+ delete this;
+ }
};
+struct MessageLoopProxyTraits {
+ static void Destruct(MessageLoopProxy* proxy) {
+ proxy->OnDestruct();
+ }
+};
+
+} // namespace base
+
#endif // BASE_MESSAGE_LOOP_PROXY_H_
diff --git a/base/message_loop_proxy_impl.cc b/base/message_loop_proxy_impl.cc
new file mode 100644
index 0000000..983a406
--- /dev/null
+++ b/base/message_loop_proxy_impl.cc
@@ -0,0 +1,101 @@
+// Copyright (c) 2010 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 "base/message_loop_proxy_impl.h"
+
+namespace base {
+
+MessageLoopProxyImpl::MessageLoopProxyImpl()
+ : target_message_loop_(MessageLoop::current()) {
+ target_message_loop_->AddDestructionObserver(this);
+}
+
+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
+bool MessageLoopProxyImpl::PostTask(const tracked_objects::Location& from_here,
+ Task* task) {
+ return PostTaskHelper(from_here, task, 0, true);
+}
+
+bool MessageLoopProxyImpl::PostDelayedTask(
+ const tracked_objects::Location& from_here, Task* task, int64 delay_ms) {
+ return PostTaskHelper(from_here, task, delay_ms, true);
+}
+
+bool MessageLoopProxyImpl::PostNonNestableTask(
+ const tracked_objects::Location& from_here, Task* task) {
+ return PostTaskHelper(from_here, task, 0, false);
+}
+
+bool MessageLoopProxyImpl::PostNonNestableDelayedTask(
+ const tracked_objects::Location& from_here,
+ Task* task,
+ int64 delay_ms) {
+ return PostTaskHelper(from_here, task, delay_ms, false);
+}
+
+bool MessageLoopProxyImpl::BelongsToCurrentThread() {
+ AutoLock lock(message_loop_lock_);
+ return (target_message_loop_ &&
+ (MessageLoop::current() == target_message_loop_));
+}
+
+bool MessageLoopProxyImpl::PostTaskHelper(
+ const tracked_objects::Location& from_here, Task* task, int64 delay_ms,
+ bool nestable) {
+ bool ret = false;
+ {
+ AutoLock lock(message_loop_lock_);
+ if (target_message_loop_) {
+ if (nestable) {
+ target_message_loop_->PostDelayedTask(from_here, task, delay_ms);
+ } else {
+ target_message_loop_->PostNonNestableDelayedTask(from_here, task,
+ delay_ms);
+ }
+ ret = true;
+ }
+ }
+ if (!ret)
+ delete task;
+ return ret;
+}
+
+void MessageLoopProxyImpl::OnDestruct() {
+ bool delete_later = false;
+ {
+ AutoLock lock(message_loop_lock_);
+ if (target_message_loop_ &&
+ (MessageLoop::current() != target_message_loop_)) {
+ target_message_loop_->DeleteSoon(FROM_HERE, this);
+ delete_later = true;
+ }
+ }
+ if (!delete_later)
+ delete this;
+}
+
+// MessageLoop::DestructionObserver implementation
+void MessageLoopProxyImpl::WillDestroyCurrentMessageLoop() {
+ AutoLock lock(message_loop_lock_);
+ target_message_loop_ = NULL;
+}
+
+scoped_refptr<MessageLoopProxy>
+MessageLoopProxy::CreateForCurrentThread() {
+ scoped_refptr<MessageLoopProxy> ret = new MessageLoopProxyImpl();
+ return ret;
+}
+
+} // namespace base
+
diff --git a/base/message_loop_proxy_impl.h b/base/message_loop_proxy_impl.h
new file mode 100644
index 0000000..f895532
--- /dev/null
+++ b/base/message_loop_proxy_impl.h
@@ -0,0 +1,61 @@
+// Copyright (c) 2010 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.
+
+#ifndef BASE_MESSAGE_LOOP_PROXY_IMPL_H_
+#define BASE_MESSAGE_LOOP_PROXY_IMPL_H_
+
+#include "base/lock.h"
+#include "base/message_loop.h"
+#include "base/message_loop_proxy.h"
+
+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.
+class MessageLoopProxyImpl : public MessageLoopProxy,
+ public MessageLoop::DestructionObserver {
+ public:
+ ~MessageLoopProxyImpl();
+
+ // MessageLoopProxy implementation
+ virtual bool PostTask(const tracked_objects::Location& from_here,
+ Task* task);
+ virtual bool PostDelayedTask(const tracked_objects::Location& from_here,
+ Task* task, int64 delay_ms);
+ virtual bool PostNonNestableTask(const tracked_objects::Location& from_here,
+ Task* task);
+ virtual bool PostNonNestableDelayedTask(
+ const tracked_objects::Location& from_here,
+ Task* task,
+ int64 delay_ms);
+ virtual bool BelongsToCurrentThread();
+
+// MessageLoop::DestructionObserver implementation
+ void WillDestroyCurrentMessageLoop();
+
+ protected:
+ // Override OnDestruct so that we can delete the object on the target message
+ // loop if it still exists.
+ virtual void OnDestruct();
+
+ private:
+ MessageLoopProxyImpl();
+ bool PostTaskHelper(const tracked_objects::Location& from_here,
+ Task* task, int64 delay_ms, bool nestable);
+
+ // For the factory method to work
+ friend class MessageLoopProxy;
+
+ // The lock that protects access to target_message_loop_.
+ Lock message_loop_lock_;
+ MessageLoop* target_message_loop_;
+
+ DISALLOW_COPY_AND_ASSIGN(MessageLoopProxyImpl);
+};
+
+} // namespace base
+
+#endif // BASE_MESSAGE_LOOP_PROXY_IMPL_H_
+
diff --git a/base/message_loop_proxy_impl_unittest.cc b/base/message_loop_proxy_impl_unittest.cc
new file mode 100644
index 0000000..5fe341c
--- /dev/null
+++ b/base/message_loop_proxy_impl_unittest.cc
@@ -0,0 +1,131 @@
+// Copyright (c) 2010 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 "base/message_loop.h"
+#include "base/message_loop_proxy_impl.h"
+#include "base/thread.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/platform_test.h"
+
+
+class MessageLoopProxyImplTest : public testing::Test {
+ public:
+ void Release() {
+ AssertOnIOThread();
+ Quit();
+ }
+
+ void Quit() {
+ loop_.PostTask(FROM_HERE, new MessageLoop::QuitTask);
+ }
+
+ void AssertOnIOThread() {
+ ASSERT_TRUE(io_thread_->message_loop_proxy()->BelongsToCurrentThread());
+ }
+
+ void AssertOnFileThread() {
+ ASSERT_TRUE(file_thread_->message_loop_proxy()->BelongsToCurrentThread());
+ }
+
+ protected:
+ virtual void SetUp() {
+ io_thread_.reset(new base::Thread("MessageLoopProxyImplTest_IO"));
+ file_thread_.reset(new base::Thread("MessageLoopProxyImplTest_File"));
+ io_thread_->Start();
+ file_thread_->Start();
+ }
+
+ virtual void TearDown() {
+ io_thread_->Stop();
+ file_thread_->Stop();
+ }
+
+ static void BasicFunction(MessageLoopProxyImplTest* test) {
+ test->AssertOnFileThread();
+ test->Quit();
+ }
+
+ class DummyTask : public Task {
+ public:
+ explicit DummyTask(bool* deleted) : deleted_(deleted) { }
+ ~DummyTask() {
+ *deleted_ = true;
+ }
+
+ void Run() {
+ FAIL();
+ }
+
+ private:
+ bool* deleted_;
+ };
+
+ class DeletedOnFile {
+ public:
+ explicit DeletedOnFile(MessageLoopProxyImplTest* test) : test_(test) {}
+
+ ~DeletedOnFile() {
+ test_->AssertOnFileThread();
+ test_->Quit();
+ }
+
+ private:
+ MessageLoopProxyImplTest* test_;
+ };
+
+ scoped_ptr<base::Thread> io_thread_;
+ scoped_ptr<base::Thread> file_thread_;
+
+ private:
+ MessageLoop loop_;
+};
+
+
+TEST_F(MessageLoopProxyImplTest, PostTask) {
+ EXPECT_TRUE(file_thread_->message_loop_proxy()->PostTask(
+ FROM_HERE, NewRunnableFunction(&BasicFunction, this)));
+ MessageLoop::current()->Run();
+}
+
+TEST_F(MessageLoopProxyImplTest, Release) {
+ EXPECT_TRUE(io_thread_->message_loop_proxy()->ReleaseSoon(FROM_HERE, this));
+ MessageLoop::current()->Run();
+}
+
+TEST_F(MessageLoopProxyImplTest, Delete) {
+ DeletedOnFile* deleted_on_file = new DeletedOnFile(this);
+ EXPECT_TRUE(file_thread_->message_loop_proxy()->DeleteSoon(
+ FROM_HERE, deleted_on_file));
+ MessageLoop::current()->Run();
+}
+
+TEST_F(MessageLoopProxyImplTest, PostTaskAfterThreadExits) {
+ scoped_ptr<base::Thread> test_thread(
+ new base::Thread("MessageLoopProxyImplTest_Dummy"));
+ test_thread->Start();
+ scoped_refptr<base::MessageLoopProxy> message_loop_proxy =
+ test_thread->message_loop_proxy();
+ test_thread->Stop();
+
+ bool deleted = false;
+ bool ret = message_loop_proxy->PostTask(
+ FROM_HERE, new DummyTask(&deleted));
+ EXPECT_FALSE(ret);
+ EXPECT_TRUE(deleted);
+}
+
+TEST_F(MessageLoopProxyImplTest, PostTaskAfterThreadIsDeleted) {
+ scoped_refptr<base::MessageLoopProxy> message_loop_proxy;
+ {
+ scoped_ptr<base::Thread> test_thread(
+ new base::Thread("MessageLoopProxyImplTest_Dummy"));
+ test_thread->Start();
+ message_loop_proxy = test_thread->message_loop_proxy();
+ }
+ bool deleted = false;
+ bool ret = message_loop_proxy->PostTask(FROM_HERE, new DummyTask(&deleted));
+ EXPECT_FALSE(ret);
+ EXPECT_TRUE(deleted);
+}
+
diff --git a/base/thread.cc b/base/thread.cc
index 05323a2b..a81fcb4 100644
--- a/base/thread.cc
+++ b/base/thread.cc
@@ -144,6 +144,7 @@ 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.
@@ -163,6 +164,7 @@ void Thread::ThreadMain() {
// We can't receive messages anymore.
message_loop_ = NULL;
+ message_loop_proxy_ = NULL;
}
CleanUpAfterMessageLoopDestruction();
thread_id_ = 0;
diff --git a/base/thread.h b/base/thread.h
index 88bff7b..b5a87eb 100644
--- a/base/thread.h
+++ b/base/thread.h
@@ -8,6 +8,7 @@
#include <string>
#include "base/message_loop.h"
+#include "base/message_loop_proxy.h"
#include "base/platform_thread.h"
namespace base {
@@ -104,6 +105,16 @@ class Thread : PlatformThread::Delegate {
//
MessageLoop* message_loop() const { return message_loop_; }
+ // Returns a MessageLoopProxy for this thread. Use the MessageLoopProxy's
+ // PostTask methods to execute code on the thread. This only returns
+ // non-null after a successful call to Start. After Stop has been called,
+ // this will return NULL. Callers can hold on to this even after the thread
+ // is gone.
+ // TODO(sanjeevr): Look into merging MessageLoop and MessageLoopProxy.
+ scoped_refptr<MessageLoopProxy> message_loop_proxy() {
+ return message_loop_proxy_;
+ }
+
// Set the name of this thread (for display in debugger too).
const std::string &thread_name() { return name_; }
@@ -162,6 +173,10 @@ class 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/chrome_plugin_unittest.cc b/chrome/browser/chrome_plugin_unittest.cc
index 84d739a..35474b0 100644
--- a/chrome/browser/chrome_plugin_unittest.cc
+++ b/chrome/browser/chrome_plugin_unittest.cc
@@ -32,7 +32,7 @@ class TestURLRequestContextGetter : public URLRequestContextGetter {
context_ = new TestURLRequestContext();
return context_;
}
- virtual scoped_refptr<MessageLoopProxy> GetIOMessageLoopProxy() {
+ virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() {
return ChromeThread::GetMessageLoopProxyForThread(ChromeThread::IO);
}
diff --git a/chrome/browser/chrome_thread.cc b/chrome/browser/chrome_thread.cc
index e6f03cc..a9c6092 100644
--- a/chrome/browser/chrome_thread.cc
+++ b/chrome/browser/chrome_thread.cc
@@ -22,7 +22,7 @@ static const char* chrome_thread_names[ChromeThread::ID_COUNT] = {
// An implementation of MessageLoopProxy to be used in conjunction
// with ChromeThread.
-class ChromeThreadMessageLoopProxy : public MessageLoopProxy {
+class ChromeThreadMessageLoopProxy : public base::MessageLoopProxy {
public:
explicit ChromeThreadMessageLoopProxy(ChromeThread::ID identifier)
: id_(identifier) {
@@ -164,9 +164,10 @@ bool ChromeThread::GetCurrentThreadIdentifier(ID* identifier) {
}
// static
-scoped_refptr<MessageLoopProxy> ChromeThread::GetMessageLoopProxyForThread(
+scoped_refptr<base::MessageLoopProxy>
+ChromeThread::GetMessageLoopProxyForThread(
ID identifier) {
- scoped_refptr<MessageLoopProxy> proxy =
+ scoped_refptr<base::MessageLoopProxy> proxy =
new ChromeThreadMessageLoopProxy(identifier);
return proxy;
}
diff --git a/chrome/browser/chrome_thread.h b/chrome/browser/chrome_thread.h
index 676f6b7..da7493f 100644
--- a/chrome/browser/chrome_thread.h
+++ b/chrome/browser/chrome_thread.h
@@ -9,7 +9,9 @@
#include "base/task.h"
#include "base/thread.h"
+namespace base {
class MessageLoopProxy;
+}
///////////////////////////////////////////////////////////////////////////////
// ChromeThread
@@ -130,7 +132,7 @@ class ChromeThread : public base::Thread {
// Callers can hold on to a refcounted MessageLoopProxy beyond the lifetime
// of the thread.
- static scoped_refptr<MessageLoopProxy> GetMessageLoopProxyForThread(
+ static scoped_refptr<base::MessageLoopProxy> GetMessageLoopProxyForThread(
ID identifier);
// Use these templates in conjuction with RefCountedThreadSafe when you want
diff --git a/chrome/browser/chrome_thread_unittest.cc b/chrome/browser/chrome_thread_unittest.cc
index a6ae766..2284d3b 100644
--- a/chrome/browser/chrome_thread_unittest.cc
+++ b/chrome/browser/chrome_thread_unittest.cc
@@ -112,7 +112,7 @@ TEST_F(ChromeThreadTest, NotReleasedIfTargetThreadNonExistent) {
}
TEST_F(ChromeThreadTest, PostTaskViaMessageLoopProxy) {
- scoped_refptr<MessageLoopProxy> message_loop_proxy =
+ scoped_refptr<base::MessageLoopProxy> message_loop_proxy =
ChromeThread::GetMessageLoopProxyForThread(ChromeThread::FILE);
message_loop_proxy->PostTask(FROM_HERE,
NewRunnableFunction(&BasicFunction,
@@ -121,7 +121,7 @@ TEST_F(ChromeThreadTest, PostTaskViaMessageLoopProxy) {
}
TEST_F(ChromeThreadTest, ReleaseViaMessageLoopProxy) {
- scoped_refptr<MessageLoopProxy> message_loop_proxy =
+ scoped_refptr<base::MessageLoopProxy> message_loop_proxy =
ChromeThread::GetMessageLoopProxyForThread(ChromeThread::UI);
message_loop_proxy->ReleaseSoon(FROM_HERE, this);
MessageLoop::current()->Run();
@@ -129,7 +129,7 @@ TEST_F(ChromeThreadTest, ReleaseViaMessageLoopProxy) {
TEST_F(ChromeThreadTest, TaskToNonExistentThreadIsDeletedViaMessageLoopProxy) {
bool deleted = false;
- scoped_refptr<MessageLoopProxy> message_loop_proxy =
+ scoped_refptr<base::MessageLoopProxy> message_loop_proxy =
ChromeThread::GetMessageLoopProxyForThread(ChromeThread::WEBKIT);
message_loop_proxy->PostTask(FROM_HERE, new DummyTask(&deleted));
EXPECT_TRUE(deleted);
@@ -141,7 +141,7 @@ TEST_F(ChromeThreadTest, PostTaskViaMessageLoopProxyAfterThreadExits) {
io_thread->Stop();
bool deleted = false;
- scoped_refptr<MessageLoopProxy> message_loop_proxy =
+ scoped_refptr<base::MessageLoopProxy> message_loop_proxy =
ChromeThread::GetMessageLoopProxyForThread(ChromeThread::IO);
bool ret = message_loop_proxy->PostTask(FROM_HERE, new DummyTask(&deleted));
EXPECT_FALSE(ret);
@@ -154,7 +154,7 @@ TEST_F(ChromeThreadTest, PostTaskViaMessageLoopProxyAfterThreadIsDeleted) {
io_thread->Start();
}
bool deleted = false;
- scoped_refptr<MessageLoopProxy> message_loop_proxy =
+ scoped_refptr<base::MessageLoopProxy> message_loop_proxy =
ChromeThread::GetMessageLoopProxyForThread(ChromeThread::IO);
bool ret = message_loop_proxy->PostTask(FROM_HERE, new DummyTask(&deleted));
EXPECT_FALSE(ret);
diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc
index 97c202c..5c77063 100644
--- a/chrome/browser/net/chrome_url_request_context.cc
+++ b/chrome/browser/net/chrome_url_request_context.cc
@@ -551,7 +551,7 @@ net::CookieStore* ChromeURLRequestContextGetter::GetCookieStore() {
return result;
}
-scoped_refptr<MessageLoopProxy>
+scoped_refptr<base::MessageLoopProxy>
ChromeURLRequestContextGetter::GetIOMessageLoopProxy() {
return ChromeThread::GetMessageLoopProxyForThread(ChromeThread::IO);
}
diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h
index b22ee68..a42464f 100644
--- a/chrome/browser/net/chrome_url_request_context.h
+++ b/chrome/browser/net/chrome_url_request_context.h
@@ -260,7 +260,7 @@ class ChromeURLRequestContextGetter : public URLRequestContextGetter,
// URLRequestContextGetter implementation.
virtual URLRequestContext* GetURLRequestContext();
virtual net::CookieStore* GetCookieStore();
- virtual scoped_refptr<MessageLoopProxy> GetIOMessageLoopProxy();
+ virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy();
// Convenience overload of GetURLRequestContext() that returns a
// ChromeURLRequestContext* rather than a URLRequestContext*.
diff --git a/chrome/browser/net/url_fetcher.cc b/chrome/browser/net/url_fetcher.cc
index 93a4834..9b4923d 100644
--- a/chrome/browser/net/url_fetcher.cc
+++ b/chrome/browser/net/url_fetcher.cc
@@ -69,7 +69,7 @@ class URLFetcher::Core
RequestType request_type_; // What type of request is this?
URLFetcher::Delegate* delegate_; // Object to notify on completion
MessageLoop* delegate_loop_; // Message loop of the creating thread
- scoped_refptr<MessageLoopProxy> io_message_loop_proxy_;
+ scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
// The message loop proxy for the thread
// on which the request IO happens.
URLRequest* request_; // The actual request this wraps
diff --git a/chrome/browser/net/url_fetcher_unittest.cc b/chrome/browser/net/url_fetcher_unittest.cc
index 3445028..4a8b617 100644
--- a/chrome/browser/net/url_fetcher_unittest.cc
+++ b/chrome/browser/net/url_fetcher_unittest.cc
@@ -31,7 +31,7 @@ class TestURLRequestContextGetter : public URLRequestContextGetter {
context_ = new TestURLRequestContext();
return context_;
}
- virtual scoped_refptr<MessageLoopProxy> GetIOMessageLoopProxy() {
+ virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() {
return ChromeThread::GetMessageLoopProxyForThread(ChromeThread::IO);
}
@@ -185,7 +185,7 @@ class CancelTestURLRequestContextGetter : public URLRequestContextGetter {
}
return context_;
}
- virtual scoped_refptr<MessageLoopProxy> GetIOMessageLoopProxy() {
+ virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() {
return ChromeThread::GetMessageLoopProxyForThread(ChromeThread::IO);
}
void WaitForContextCreation() {
diff --git a/chrome/browser/net/url_request_context_getter.cc b/chrome/browser/net/url_request_context_getter.cc
index 4970a1b..64198b5 100644
--- a/chrome/browser/net/url_request_context_getter.cc
+++ b/chrome/browser/net/url_request_context_getter.cc
@@ -11,7 +11,7 @@ net::CookieStore* URLRequestContextGetter::GetCookieStore() {
}
void URLRequestContextGetter::OnDestruct() {
- scoped_refptr<MessageLoopProxy> io_message_loop_proxy =
+ scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy =
GetIOMessageLoopProxy();
DCHECK(io_message_loop_proxy);
if (io_message_loop_proxy) {
diff --git a/chrome/browser/net/url_request_context_getter.h b/chrome/browser/net/url_request_context_getter.h
index 5568192..2cedeb5 100644
--- a/chrome/browser/net/url_request_context_getter.h
+++ b/chrome/browser/net/url_request_context_getter.h
@@ -8,11 +8,14 @@
#include "base/ref_counted.h"
#include "base/task.h"
+namespace base {
+class MessageLoopProxy;
+}
+
namespace net {
class CookieStore;
}
-class MessageLoopProxy;
class URLRequestContext;
struct URLRequestContextGetterTraits;
@@ -29,7 +32,7 @@ class URLRequestContextGetter
// Returns a MessageLoopProxy corresponding to the thread on which the
// request IO happens (the thread on which the returned URLRequestContext
// may be used).
- virtual scoped_refptr<MessageLoopProxy> GetIOMessageLoopProxy() = 0;
+ virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() = 0;
protected:
friend class DeleteTask<URLRequestContextGetter>;
diff --git a/chrome/browser/sync/glue/http_bridge.cc b/chrome/browser/sync/glue/http_bridge.cc
index d3becf65..7e0f9df 100644
--- a/chrome/browser/sync/glue/http_bridge.cc
+++ b/chrome/browser/sync/glue/http_bridge.cc
@@ -43,7 +43,7 @@ URLRequestContext* HttpBridge::RequestContextGetter::GetURLRequestContext() {
return context_;
}
-scoped_refptr<MessageLoopProxy>
+scoped_refptr<base::MessageLoopProxy>
HttpBridge::RequestContextGetter::GetIOMessageLoopProxy() {
return ChromeThread::GetMessageLoopProxyForThread(ChromeThread::IO);
}
diff --git a/chrome/browser/sync/glue/http_bridge.h b/chrome/browser/sync/glue/http_bridge.h
index fc585ac..e1e1bbd 100644
--- a/chrome/browser/sync/glue/http_bridge.h
+++ b/chrome/browser/sync/glue/http_bridge.h
@@ -84,7 +84,7 @@ class HttpBridge : public base::RefCountedThreadSafe<HttpBridge>,
// URLRequestContextGetter implementation.
virtual URLRequestContext* GetURLRequestContext();
- virtual scoped_refptr<MessageLoopProxy> GetIOMessageLoopProxy();
+ virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy();
private:
~RequestContextGetter() {}
diff --git a/chrome/browser/sync/glue/http_bridge_unittest.cc b/chrome/browser/sync/glue/http_bridge_unittest.cc
index 003e660..076d8cd 100644
--- a/chrome/browser/sync/glue/http_bridge_unittest.cc
+++ b/chrome/browser/sync/glue/http_bridge_unittest.cc
@@ -25,7 +25,7 @@ class TestURLRequestContextGetter : public URLRequestContextGetter {
context_ = new TestURLRequestContext;
return context_;
}
- virtual scoped_refptr<MessageLoopProxy> GetIOMessageLoopProxy() {
+ virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() {
return ChromeThread::GetMessageLoopProxyForThread(ChromeThread::IO);
}
diff --git a/chrome/test/testing_profile.cc b/chrome/test/testing_profile.cc
index 25207e9..db98fea 100644
--- a/chrome/test/testing_profile.cc
+++ b/chrome/test/testing_profile.cc
@@ -108,7 +108,7 @@ class TestURLRequestContextGetter : public URLRequestContextGetter {
context_ = new TestURLRequestContext();
return context_.get();
}
- virtual scoped_refptr<MessageLoopProxy> GetIOMessageLoopProxy() {
+ virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() {
return ChromeThread::GetMessageLoopProxyForThread(ChromeThread::IO);
}
@@ -133,7 +133,7 @@ class TestExtensionURLRequestContextGetter : public URLRequestContextGetter {
context_ = new TestExtensionURLRequestContext();
return context_.get();
}
- virtual scoped_refptr<MessageLoopProxy> GetIOMessageLoopProxy() {
+ virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() {
return ChromeThread::GetMessageLoopProxyForThread(ChromeThread::IO);
}