summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-06 19:23:08 +0000
committerxhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-06 19:23:08 +0000
commitd2881d8adc34ceaa5346c36f848328f10caf9cbc (patch)
treeeaa87b15d65dfe8800cdbba84fc705a09d5a14a6
parent77bb50035e0b9dca092b1eba8000ee5c389057dc (diff)
downloadchromium_src-d2881d8adc34ceaa5346c36f848328f10caf9cbc.zip
chromium_src-d2881d8adc34ceaa5346c36f848328f10caf9cbc.tar.gz
chromium_src-d2881d8adc34ceaa5346c36f848328f10caf9cbc.tar.bz2
ppapi: Use base::MessageLoop.
BUG=236029 Review URL: https://chromiumcodereview.appspot.com/14273043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198504 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ppapi/host/resource_message_filter.cc5
-rw-r--r--ppapi/host/resource_message_filter_unittest.cc12
-rw-r--r--ppapi/proxy/plugin_main_nacl.cc4
-rw-r--r--ppapi/proxy/ppapi_proxy_test.cc2
-rw-r--r--ppapi/proxy/ppapi_proxy_test.h6
-rw-r--r--ppapi/proxy/ppb_image_data_proxy.cc6
-rw-r--r--ppapi/proxy/ppb_instance_proxy.cc2
-rw-r--r--ppapi/proxy/ppb_message_loop_proxy.cc8
-rw-r--r--ppapi/proxy/ppb_message_loop_proxy.h2
-rw-r--r--ppapi/proxy/ppb_network_monitor_private_proxy.cc8
-rw-r--r--ppapi/proxy/ppb_testing_proxy.cc9
-rw-r--r--ppapi/proxy/ppb_var_deprecated_proxy.cc7
-rw-r--r--ppapi/proxy/proxy_completion_callback_factory.h10
-rw-r--r--ppapi/shared_impl/resource_tracker.cc2
-rw-r--r--ppapi/shared_impl/tracked_callback.cc2
-rw-r--r--ppapi/shared_impl/tracked_callback_unittest.cc19
16 files changed, 53 insertions, 51 deletions
diff --git a/ppapi/host/resource_message_filter.cc b/ppapi/host/resource_message_filter.cc
index 887c184..ac9d324 100644
--- a/ppapi/host/resource_message_filter.cc
+++ b/ppapi/host/resource_message_filter.cc
@@ -17,9 +17,8 @@ namespace host {
ResourceMessageFilter::ResourceMessageFilter()
: reply_thread_message_loop_proxy_(
- MessageLoop::current()->message_loop_proxy()),
- resource_host_(NULL) {
-}
+ base::MessageLoop::current()->message_loop_proxy()),
+ resource_host_(NULL) {}
ResourceMessageFilter::ResourceMessageFilter(
scoped_refptr<base::MessageLoopProxy> reply_thread_message_loop_proxy)
diff --git a/ppapi/host/resource_message_filter_unittest.cc b/ppapi/host/resource_message_filter_unittest.cc
index 3e4c0e0..7087866 100644
--- a/ppapi/host/resource_message_filter_unittest.cc
+++ b/ppapi/host/resource_message_filter_unittest.cc
@@ -51,7 +51,7 @@ class MyResourceHost : public ResourceHost {
const IPC::Message& last_handled_msg() const { return last_handled_msg_; }
const IPC::Message& last_reply_msg() const { return last_reply_msg_; }
- MessageLoop* last_reply_message_loop() const {
+ base::MessageLoop* last_reply_message_loop() const {
return last_reply_message_loop_;
}
@@ -74,7 +74,7 @@ class MyResourceHost : public ResourceHost {
virtual void SendReply(const ReplyMessageContext& context,
const IPC::Message& msg) OVERRIDE {
last_reply_msg_ = msg;
- last_reply_message_loop_ = MessageLoop::current();
+ last_reply_message_loop_ = base::MessageLoop::current();
g_handler_completion.Signal();
}
@@ -84,7 +84,7 @@ class MyResourceHost : public ResourceHost {
IPC::Message last_handled_msg_;
IPC::Message last_reply_msg_;
- MessageLoop* last_reply_message_loop_;
+ base::MessageLoop* last_reply_message_loop_;
};
// Dummy message filter which simply stores a copy of messages it handles.
@@ -108,7 +108,7 @@ class MyResourceFilter : public ResourceMessageFilter {
}
const IPC::Message& last_handled_msg() const { return last_handled_msg_; }
- MessageLoop* last_message_loop() const { return last_message_loop_; }
+ base::MessageLoop* last_message_loop() const { return last_message_loop_; }
virtual scoped_refptr<base::TaskRunner> OverrideTaskRunnerForMessage(
const IPC::Message& msg) OVERRIDE {
@@ -121,7 +121,7 @@ class MyResourceFilter : public ResourceMessageFilter {
const IPC::Message& msg,
HostMessageContext* context) OVERRIDE {
last_handled_msg_ = msg;
- last_message_loop_ = MessageLoop::current();
+ last_message_loop_ = base::MessageLoop::current();
if (msg.type() == msg_type_) {
context->reply_msg = IPC::Message(0, reply_msg_type_,
IPC::Message::PRIORITY_NORMAL);
@@ -136,7 +136,7 @@ class MyResourceFilter : public ResourceMessageFilter {
uint32 reply_msg_type_;
IPC::Message last_handled_msg_;
- MessageLoop* last_message_loop_;
+ base::MessageLoop* last_message_loop_;
};
} // namespace
diff --git a/ppapi/proxy/plugin_main_nacl.cc b/ppapi/proxy/plugin_main_nacl.cc
index 5d43d3a..90d034c 100644
--- a/ppapi/proxy/plugin_main_nacl.cc
+++ b/ppapi/proxy/plugin_main_nacl.cc
@@ -266,12 +266,12 @@ int PpapiPluginMain() {
// Though it isn't referenced here, we must instantiate an AtExitManager.
base::AtExitManager exit_manager;
- MessageLoop loop;
+ base::MessageLoop loop;
IPC::Logging::set_log_function_map(&g_log_function_mapping);
ppapi::proxy::PluginGlobals plugin_globals;
base::Thread io_thread("Chrome_NaClIOThread");
base::Thread::Options options;
- options.message_loop_type = MessageLoop::TYPE_IO;
+ options.message_loop_type = base::MessageLoop::TYPE_IO;
io_thread.StartWithOptions(options);
// Start up the SRPC server on another thread. Otherwise, when it blocks
diff --git a/ppapi/proxy/ppapi_proxy_test.cc b/ppapi/proxy/ppapi_proxy_test.cc
index 9034d8f..19f41bb 100644
--- a/ppapi/proxy/ppapi_proxy_test.cc
+++ b/ppapi/proxy/ppapi_proxy_test.cc
@@ -537,7 +537,7 @@ TwoWayTest::~TwoWayTest() {
void TwoWayTest::SetUp() {
base::Thread::Options options;
- options.message_loop_type = MessageLoop::TYPE_IO;
+ options.message_loop_type = base::MessageLoop::TYPE_IO;
io_thread_.StartWithOptions(options);
plugin_thread_.Start();
diff --git a/ppapi/proxy/ppapi_proxy_test.h b/ppapi/proxy/ppapi_proxy_test.h
index 0882790..d4e54bf 100644
--- a/ppapi/proxy/ppapi_proxy_test.h
+++ b/ppapi/proxy/ppapi_proxy_test.h
@@ -177,7 +177,7 @@ class PluginProxyTest : public PluginProxyTestHarness, public testing::Test {
virtual void SetUp();
virtual void TearDown();
private:
- MessageLoop message_loop_;
+ base::MessageLoop message_loop_;
};
// This class provides support for multi-thread testing. A secondary thread is
@@ -301,7 +301,7 @@ class HostProxyTest : public HostProxyTestHarness, public testing::Test {
virtual void SetUp();
virtual void TearDown();
private:
- MessageLoop message_loop_;
+ base::MessageLoop message_loop_;
};
// Use this base class to test both sides of a proxy.
@@ -339,7 +339,7 @@ class TwoWayTest : public testing::Test {
// The plugin side of the proxy runs on its own thread.
base::Thread plugin_thread_;
// The message loop for the main (host) thread.
- MessageLoop message_loop_;
+ base::MessageLoop message_loop_;
// Aliases for the host and plugin harnesses; if we're testing a PPP
// interface, remote_harness will point to plugin_, and local_harness
diff --git a/ppapi/proxy/ppb_image_data_proxy.cc b/ppapi/proxy/ppb_image_data_proxy.cc
index cef71d6..40fddf4 100644
--- a/ppapi/proxy/ppb_image_data_proxy.cc
+++ b/ppapi/proxy/ppb_image_data_proxy.cc
@@ -275,11 +275,11 @@ void ImageDataCache::Add(ImageData* image_data) {
cache_[image_data->pp_instance()].Add(image_data);
// Schedule a timer to invalidate this entry.
- MessageLoop::current()->PostDelayedTask(
+ base::MessageLoop::current()->PostDelayedTask(
FROM_HERE,
RunWhileLocked(base::Bind(&ImageDataCache::OnTimer,
- weak_factory_.GetWeakPtr(),
- image_data->pp_instance())),
+ weak_factory_.GetWeakPtr(),
+ image_data->pp_instance())),
base::TimeDelta::FromSeconds(kMaxAgeSeconds));
}
diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc
index 17998dc..ff044b6 100644
--- a/ppapi/proxy/ppb_instance_proxy.cc
+++ b/ppapi/proxy/ppb_instance_proxy.cc
@@ -787,7 +787,7 @@ void PPB_Instance_Proxy::SelectionChanged(PP_Instance instance) {
data->should_do_request_surrounding_text = true;
if (!data->is_request_surrounding_text_pending) {
- MessageLoop::current()->PostTask(
+ base::MessageLoop::current()->PostTask(
FROM_HERE,
RunWhileLocked(base::Bind(&RequestSurroundingText, instance)));
data->is_request_surrounding_text_pending = true;
diff --git a/ppapi/proxy/ppb_message_loop_proxy.cc b/ppapi/proxy/ppb_message_loop_proxy.cc
index 0062fb7..fb01485 100644
--- a/ppapi/proxy/ppb_message_loop_proxy.cc
+++ b/ppapi/proxy/ppb_message_loop_proxy.cc
@@ -86,7 +86,7 @@ int32_t MessageLoopResource::AttachToCurrentThread() {
AddRef();
slot->Set(this);
- loop_.reset(new MessageLoop(MessageLoop::TYPE_DEFAULT));
+ loop_.reset(new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT));
loop_proxy_ = base::MessageLoopProxy::current();
// Post all pending work to the message loop.
@@ -106,8 +106,8 @@ int32_t MessageLoopResource::Run() {
return PP_ERROR_INPROGRESS;
nested_invocations_++;
- CallWhileUnlocked(base::Bind(&MessageLoop::Run,
- base::Unretained(loop_.get())));
+ CallWhileUnlocked(
+ base::Bind(&base::MessageLoop::Run, base::Unretained(loop_.get())));
nested_invocations_--;
if (should_destroy_ && nested_invocations_ == 0) {
@@ -141,7 +141,7 @@ int32_t MessageLoopResource::PostQuit(PP_Bool should_destroy) {
if (IsCurrent() && nested_invocations_ > 0)
loop_->Quit();
else
- PostClosure(FROM_HERE, MessageLoop::QuitClosure(), 0);
+ PostClosure(FROM_HERE, base::MessageLoop::QuitClosure(), 0);
return PP_OK;
}
diff --git a/ppapi/proxy/ppb_message_loop_proxy.h b/ppapi/proxy/ppb_message_loop_proxy.h
index 3fa7674..8bec5a7 100644
--- a/ppapi/proxy/ppb_message_loop_proxy.h
+++ b/ppapi/proxy/ppb_message_loop_proxy.h
@@ -70,7 +70,7 @@ class PPAPI_PROXY_EXPORT MessageLoopResource : public MessageLoopShared {
// that it's created on the thread it will run on. NULL for the main thread
// loop, since that's owned by somebody else. This is needed for Run and Quit.
// Any time we post tasks, we should post them using loop_proxy_.
- scoped_ptr<MessageLoop> loop_;
+ scoped_ptr<base::MessageLoop> loop_;
scoped_refptr<base::MessageLoopProxy> loop_proxy_;
// Number of invocations of Run currently on the stack.
diff --git a/ppapi/proxy/ppb_network_monitor_private_proxy.cc b/ppapi/proxy/ppb_network_monitor_private_proxy.cc
index ad9d06d..055ed2e 100644
--- a/ppapi/proxy/ppb_network_monitor_private_proxy.cc
+++ b/ppapi/proxy/ppb_network_monitor_private_proxy.cc
@@ -106,9 +106,11 @@ PP_Resource PPB_NetworkMonitor_Private_Proxy::CreateProxyResource(
// here.
proxy->current_list_ = NULL;
} else if (proxy->current_list_.get()) {
- MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
- &NetworkMonitor::OnNetworkListReceivedLocks,
- result->AsWeakPtr(), proxy->current_list_));
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&NetworkMonitor::OnNetworkListReceivedLocks,
+ result->AsWeakPtr(),
+ proxy->current_list_));
}
return result->GetReference();
diff --git a/ppapi/proxy/ppb_testing_proxy.cc b/ppapi/proxy/ppb_testing_proxy.cc
index 6cdf598..f28c500 100644
--- a/ppapi/proxy/ppb_testing_proxy.cc
+++ b/ppapi/proxy/ppb_testing_proxy.cc
@@ -51,16 +51,17 @@ PP_Bool ReadImageData(PP_Resource graphics_2d,
}
void RunMessageLoop(PP_Instance instance) {
- MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current());
+ base::MessageLoop::ScopedNestableTaskAllower allow(
+ base::MessageLoop::current());
CHECK(PpapiGlobals::Get()->GetMainThreadMessageLoop()->
- BelongsToCurrentThread());
- MessageLoop::current()->Run();
+ BelongsToCurrentThread());
+ base::MessageLoop::current()->Run();
}
void QuitMessageLoop(PP_Instance instance) {
CHECK(PpapiGlobals::Get()->GetMainThreadMessageLoop()->
BelongsToCurrentThread());
- MessageLoop::current()->QuitNow();
+ base::MessageLoop::current()->QuitNow();
}
uint32_t GetLiveObjectsForInstance(PP_Instance instance_id) {
diff --git a/ppapi/proxy/ppb_var_deprecated_proxy.cc b/ppapi/proxy/ppb_var_deprecated_proxy.cc
index 5c3cf61..29aa2c06 100644
--- a/ppapi/proxy/ppb_var_deprecated_proxy.cc
+++ b/ppapi/proxy/ppb_var_deprecated_proxy.cc
@@ -392,10 +392,11 @@ void PPB_Var_Deprecated_Proxy::OnMsgReleaseObject(int64 object_id) {
// spurious warning).
// TODO(piman): See if we can fix the IPC code to enforce strict ordering, and
// then remove this.
- MessageLoop::current()->PostNonNestableTask(FROM_HERE,
+ base::MessageLoop::current()->PostNonNestableTask(
+ FROM_HERE,
RunWhileLocked(base::Bind(&PPB_Var_Deprecated_Proxy::DoReleaseObject,
- task_factory_.GetWeakPtr(),
- object_id)));
+ task_factory_.GetWeakPtr(),
+ object_id)));
}
void PPB_Var_Deprecated_Proxy::OnMsgHasProperty(
diff --git a/ppapi/proxy/proxy_completion_callback_factory.h b/ppapi/proxy/proxy_completion_callback_factory.h
index 1221f43..9e3ab88 100644
--- a/ppapi/proxy/proxy_completion_callback_factory.h
+++ b/ppapi/proxy/proxy_completion_callback_factory.h
@@ -21,26 +21,26 @@ class ProxyNonThreadSafeThreadTraits {
public:
RefCount() : ref_(0) {
#ifndef NDEBUG
- message_loop_ = MessageLoop::current();
+ message_loop_ = base::MessageLoop::current();
#endif
}
~RefCount() {
#ifndef NDEBUG
- DCHECK(message_loop_ == MessageLoop::current());
+ DCHECK(message_loop_ == base::MessageLoop::current());
#endif
}
int32_t AddRef() {
#ifndef NDEBUG
- DCHECK(message_loop_ == MessageLoop::current());
+ DCHECK(message_loop_ == base::MessageLoop::current());
#endif
return ++ref_;
}
int32_t Release() {
#ifndef NDEBUG
- DCHECK(message_loop_ == MessageLoop::current());
+ DCHECK(message_loop_ == base::MessageLoop::current());
#endif
DCHECK(ref_ > 0);
return --ref_;
@@ -49,7 +49,7 @@ class ProxyNonThreadSafeThreadTraits {
private:
int32_t ref_;
#ifndef NDEBUG
- MessageLoop* message_loop_;
+ base::MessageLoop* message_loop_;
#endif
};
diff --git a/ppapi/shared_impl/resource_tracker.cc b/ppapi/shared_impl/resource_tracker.cc
index 35922cb..da904da 100644
--- a/ppapi/shared_impl/resource_tracker.cc
+++ b/ppapi/shared_impl/resource_tracker.cc
@@ -86,7 +86,7 @@ void ResourceTracker::ReleaseResource(PP_Resource res) {
}
void ResourceTracker::ReleaseResourceSoon(PP_Resource res) {
- MessageLoop::current()->PostNonNestableTask(
+ base::MessageLoop::current()->PostNonNestableTask(
FROM_HERE,
RunWhileLocked(base::Bind(&ResourceTracker::ReleaseResource,
weak_ptr_factory_.GetWeakPtr(),
diff --git a/ppapi/shared_impl/tracked_callback.cc b/ppapi/shared_impl/tracked_callback.cc
index ae4656e..b4cf9e5 100644
--- a/ppapi/shared_impl/tracked_callback.cc
+++ b/ppapi/shared_impl/tracked_callback.cc
@@ -157,7 +157,7 @@ void TrackedCallback::PostRun(int32_t result) {
// classes protect against having a null target_loop_ otherwise).
DCHECK(IsMainThread());
DCHECK(PpapiGlobals::Get()->IsHostGlobals());
- MessageLoop::current()->PostTask(FROM_HERE, callback_closure);
+ base::MessageLoop::current()->PostTask(FROM_HERE, callback_closure);
} else {
target_loop_->PostClosure(FROM_HERE, callback_closure, 0);
}
diff --git a/ppapi/shared_impl/tracked_callback_unittest.cc b/ppapi/shared_impl/tracked_callback_unittest.cc
index bc1c7f3..89db6d0 100644
--- a/ppapi/shared_impl/tracked_callback_unittest.cc
+++ b/ppapi/shared_impl/tracked_callback_unittest.cc
@@ -20,8 +20,7 @@ namespace {
class TrackedCallbackTest : public testing::Test {
public:
TrackedCallbackTest()
- : message_loop_(MessageLoop::TYPE_DEFAULT),
- pp_instance_(1234) {}
+ : message_loop_(base::MessageLoop::TYPE_DEFAULT), pp_instance_(1234) {}
PP_Instance pp_instance() const { return pp_instance_; }
@@ -33,7 +32,7 @@ class TrackedCallbackTest : public testing::Test {
}
private:
- MessageLoop message_loop_;
+ base::MessageLoop message_loop_;
TestGlobals globals_;
PP_Instance pp_instance_;
};
@@ -220,18 +219,18 @@ TEST_F(CallbackResourceTest, AbortOnNoRef) {
// Kill resource #1, spin the message loop to run posted calls, and check that
// things are in the expected states.
resource_tracker->ReleaseResource(resource_1_id);
- MessageLoop::current()->RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
resource_1->CheckFinalState();
resource_2->CheckIntermediateState();
// Kill resource #2.
resource_tracker->ReleaseResource(resource_2_id);
- MessageLoop::current()->RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
resource_1->CheckFinalState();
resource_2->CheckFinalState();
// This shouldn't be needed, but make sure there are no stranded tasks.
- MessageLoop::current()->RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
}
// Test that "resurrecting" a resource (getting a new ID for a |Resource|)
@@ -247,21 +246,21 @@ TEST_F(CallbackResourceTest, Resurrection) {
// Unref it, spin the message loop to run posted calls, and check that things
// are in the expected states.
resource_tracker->ReleaseResource(resource_id);
- MessageLoop::current()->RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
resource->CheckFinalState();
// "Resurrect" it and check that the callbacks are still dead.
PP_Resource new_resource_id = resource->GetReference();
- MessageLoop::current()->RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
resource->CheckFinalState();
// Unref it again and do the same.
resource_tracker->ReleaseResource(new_resource_id);
- MessageLoop::current()->RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
resource->CheckFinalState();
// This shouldn't be needed, but make sure there are no stranded tasks.
- MessageLoop::current()->RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
}
} // namespace ppapi