summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorpranay.kumar <pranay.kumar@samsung.com>2015-05-05 05:12:46 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-05 12:13:21 +0000
commit7b7ceb183957fc55735153fbacb73a012a69b2cf (patch)
tree0935c9c2dd8ca6d1128d5e7ed7032184805309cb /extensions
parentac428e932505db7625e3f96c4fd8a088a0311778 (diff)
downloadchromium_src-7b7ceb183957fc55735153fbacb73a012a69b2cf.zip
chromium_src-7b7ceb183957fc55735153fbacb73a012a69b2cf.tar.gz
chromium_src-7b7ceb183957fc55735153fbacb73a012a69b2cf.tar.bz2
Replace MessageLoopProxy usage with ThreadTaskRunnerHandle in extensions module.
MessageLoopProxy is deprecated. This basically does a search and replace of: MessageLoopProxy::current() -> ThreadTaskRunnerHandle::Get(). MessageLoopProxy -> SingleThreadTaskRunner BUG=391045 Review URL: https://codereview.chromium.org/1120793007 Cr-Commit-Position: refs/heads/master@{#328313}
Diffstat (limited to 'extensions')
-rw-r--r--extensions/browser/api/declarative/declarative_api.cc6
-rw-r--r--extensions/browser/sandboxed_unpacker_unittest.cc6
-rw-r--r--extensions/common/one_shot_event.cc24
-rw-r--r--extensions/common/one_shot_event.h8
-rw-r--r--extensions/common/one_shot_event_unittest.cc3
-rw-r--r--extensions/renderer/api/serial/serial_api_unittest.cc3
6 files changed, 27 insertions, 23 deletions
diff --git a/extensions/browser/api/declarative/declarative_api.cc b/extensions/browser/api/declarative/declarative_api.cc
index f88bbe8..bb70fd8 100644
--- a/extensions/browser/api/declarative/declarative_api.cc
+++ b/extensions/browser/api/declarative/declarative_api.cc
@@ -7,6 +7,7 @@
#include "base/base64.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
+#include "base/single_thread_task_runner.h"
#include "base/task_runner_util.h"
#include "base/values.h"
#include "content/public/browser/browser_thread.h"
@@ -152,12 +153,11 @@ bool RulesFunction::RunAsync() {
bool success = RunAsyncOnCorrectThread();
SendResponse(success);
} else {
- scoped_refptr<base::MessageLoopProxy> message_loop_proxy =
+ scoped_refptr<base::SingleThreadTaskRunner> thread_task_runner =
content::BrowserThread::GetMessageLoopProxyForThread(
rules_registry_->owner_thread());
base::PostTaskAndReplyWithResult(
- message_loop_proxy.get(),
- FROM_HERE,
+ thread_task_runner.get(), FROM_HERE,
base::Bind(&RulesFunction::RunAsyncOnCorrectThread, this),
base::Bind(&RulesFunction::SendResponse, this));
}
diff --git a/extensions/browser/sandboxed_unpacker_unittest.cc b/extensions/browser/sandboxed_unpacker_unittest.cc
index f85d41d..02fceaf 100644
--- a/extensions/browser/sandboxed_unpacker_unittest.cc
+++ b/extensions/browser/sandboxed_unpacker_unittest.cc
@@ -6,10 +6,10 @@
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/memory/ref_counted.h"
-#include "base/message_loop/message_loop.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
+#include "base/thread_task_runner_handle.h"
#include "base/values.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "content/public/test/test_utils.h"
@@ -89,9 +89,9 @@ class SandboxedUnpackerTest : public ExtensionsTest {
sandboxed_unpacker_ = new SandboxedUnpacker(
extensions::CRXFileInfo(std::string(), original_path, package_hash),
Manifest::INTERNAL, Extension::NO_FLAGS, extensions_dir_.path(),
- base::MessageLoopProxy::current(), client_);
+ base::ThreadTaskRunnerHandle::Get(), client_);
- base::MessageLoopProxy::current()->PostTask(
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::Bind(&SandboxedUnpacker::Start, sandboxed_unpacker_.get()));
client_->WaitForUnpack();
diff --git a/extensions/common/one_shot_event.cc b/extensions/common/one_shot_event.cc
index ebba0d1..a5a4ddc 100644
--- a/extensions/common/one_shot_event.cc
+++ b/extensions/common/one_shot_event.cc
@@ -7,25 +7,26 @@
#include "base/callback.h"
#include "base/lazy_instance.h"
#include "base/location.h"
-#include "base/message_loop/message_loop_proxy.h"
+#include "base/single_thread_task_runner.h"
#include "base/task_runner.h"
+#include "base/thread_task_runner_handle.h"
#include "base/time/time.h"
-using base::TaskRunner;
+using base::SingleThreadTaskRunner;
namespace extensions {
struct OneShotEvent::TaskInfo {
TaskInfo() {}
TaskInfo(const tracked_objects::Location& from_here,
- const scoped_refptr<TaskRunner>& runner,
+ const scoped_refptr<SingleThreadTaskRunner>& runner,
const base::Closure& task,
const base::TimeDelta& delay)
: from_here(from_here), runner(runner), task(task), delay(delay) {
CHECK(runner.get()); // Detect mistakes with a decent stack frame.
}
tracked_objects::Location from_here;
- scoped_refptr<TaskRunner> runner;
+ scoped_refptr<SingleThreadTaskRunner> runner;
base::Closure task;
base::TimeDelta delay;
};
@@ -42,20 +43,21 @@ OneShotEvent::~OneShotEvent() {}
void OneShotEvent::Post(const tracked_objects::Location& from_here,
const base::Closure& task) const {
- PostImpl(
- from_here, task, base::MessageLoopProxy::current(), base::TimeDelta());
+ PostImpl(from_here, task, base::ThreadTaskRunnerHandle::Get(),
+ base::TimeDelta());
}
-void OneShotEvent::Post(const tracked_objects::Location& from_here,
- const base::Closure& task,
- const scoped_refptr<TaskRunner>& runner) const {
+void OneShotEvent::Post(
+ const tracked_objects::Location& from_here,
+ const base::Closure& task,
+ const scoped_refptr<SingleThreadTaskRunner>& runner) const {
PostImpl(from_here, task, runner, base::TimeDelta());
}
void OneShotEvent::PostDelayed(const tracked_objects::Location& from_here,
const base::Closure& task,
const base::TimeDelta& delay) const {
- PostImpl(from_here, task, base::MessageLoopProxy::current(), delay);
+ PostImpl(from_here, task, base::ThreadTaskRunnerHandle::Get(), delay);
}
void OneShotEvent::Signal() {
@@ -81,7 +83,7 @@ void OneShotEvent::Signal() {
void OneShotEvent::PostImpl(const tracked_objects::Location& from_here,
const base::Closure& task,
- const scoped_refptr<TaskRunner>& runner,
+ const scoped_refptr<SingleThreadTaskRunner>& runner,
const base::TimeDelta& delay) const {
DCHECK(thread_checker_.CalledOnValidThread());
diff --git a/extensions/common/one_shot_event.h b/extensions/common/one_shot_event.h
index 4903124..af98538 100644
--- a/extensions/common/one_shot_event.h
+++ b/extensions/common/one_shot_event.h
@@ -14,7 +14,7 @@
#include "base/threading/thread_checker.h"
namespace base {
-class TaskRunner;
+class SingleThreadTaskRunner;
class TimeDelta;
}
@@ -66,7 +66,7 @@ class OneShotEvent {
// tasks will be executed.
//
// Omitting the |runner| argument indicates that |task| should run
- // on MessageLoopProxy::current().
+ // on current thread's TaskRunner.
//
// Tasks may be run in an arbitrary order, not just FIFO. Tasks
// will never be called on the current thread before this function
@@ -80,7 +80,7 @@ class OneShotEvent {
const base::Closure& task) const;
void Post(const tracked_objects::Location& from_here,
const base::Closure& task,
- const scoped_refptr<base::TaskRunner>& runner) const;
+ const scoped_refptr<base::SingleThreadTaskRunner>& runner) const;
void PostDelayed(const tracked_objects::Location& from_here,
const base::Closure& task,
const base::TimeDelta& delay) const;
@@ -90,7 +90,7 @@ class OneShotEvent {
void PostImpl(const tracked_objects::Location& from_here,
const base::Closure& task,
- const scoped_refptr<base::TaskRunner>& runner,
+ const scoped_refptr<base::SingleThreadTaskRunner>& runner,
const base::TimeDelta& delay) const;
base::ThreadChecker thread_checker_;
diff --git a/extensions/common/one_shot_event_unittest.cc b/extensions/common/one_shot_event_unittest.cc
index 4009a01..c19b036 100644
--- a/extensions/common/one_shot_event_unittest.cc
+++ b/extensions/common/one_shot_event_unittest.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/run_loop.h"
+#include "base/single_thread_task_runner.h"
#include "base/test/test_simple_task_runner.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -76,7 +77,7 @@ TEST(OneShotEventTest, PostDefaultsToCurrentMessageLoop) {
void CheckSignaledAndPostIncrement(
OneShotEvent* event,
- const scoped_refptr<base::TaskRunner>& runner,
+ const scoped_refptr<base::SingleThreadTaskRunner>& runner,
int* i) {
EXPECT_TRUE(event->is_signaled());
event->Post(FROM_HERE, base::Bind(&Increment, i), runner);
diff --git a/extensions/renderer/api/serial/serial_api_unittest.cc b/extensions/renderer/api/serial/serial_api_unittest.cc
index 0d247b9..508c4a0 100644
--- a/extensions/renderer/api/serial/serial_api_unittest.cc
+++ b/extensions/renderer/api/serial/serial_api_unittest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/thread_task_runner_handle.h"
#include "device/serial/serial_device_enumerator.h"
#include "device/serial/serial_service_impl.h"
#include "device/serial/test_serial_io_handler.h"
@@ -439,7 +440,7 @@ class SerialApiTest : public ApiTestBase {
new device::SerialConnectionFactory(
base::Bind(&SerialApiTest::GetIoHandler,
base::Unretained(this)),
- base::MessageLoopProxy::current()),
+ base::ThreadTaskRunnerHandle::Get()),
scoped_ptr<device::SerialDeviceEnumerator>(
new FakeSerialDeviceEnumerator)),
&request);