Skip to content

Commit

Permalink
Move Location to base namespace in base.
Browse files Browse the repository at this point in the history
This removes the obsolete tracked_objects:: qualification on
uses of Location in //base.

TBR=dcheng@chromium.org

Bug: 763556
Change-Id: Iffdbf067f65f6dbfe309413294b8ace2e8917617
Reviewed-on: https://chromium-review.googlesource.com/662597
Reviewed-by: Brett Wilson <brettw@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Brett Wilson <brettw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501192}
  • Loading branch information
Brett Wilson authored and Commit Bot committed Sep 12, 2017
1 parent 9123052 commit 8e88b31
Show file tree
Hide file tree
Showing 56 changed files with 230 additions and 279 deletions.
18 changes: 8 additions & 10 deletions base/deferred_sequenced_task_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ DeferredSequencedTaskRunner::DeferredSequencedTaskRunner(
DeferredSequencedTaskRunner::~DeferredSequencedTaskRunner() {
}

bool DeferredSequencedTaskRunner::PostDelayedTask(
const tracked_objects::Location& from_here,
OnceClosure task,
TimeDelta delay) {
bool DeferredSequencedTaskRunner::PostDelayedTask(const Location& from_here,
OnceClosure task,
TimeDelta delay) {
AutoLock lock(lock_);
if (started_) {
DCHECK(deferred_tasks_queue_.empty());
Expand All @@ -53,7 +52,7 @@ bool DeferredSequencedTaskRunner::RunsTasksInCurrentSequence() const {
}

bool DeferredSequencedTaskRunner::PostNonNestableDelayedTask(
const tracked_objects::Location& from_here,
const Location& from_here,
OnceClosure task,
TimeDelta delay) {
AutoLock lock(lock_);
Expand All @@ -67,11 +66,10 @@ bool DeferredSequencedTaskRunner::PostNonNestableDelayedTask(
return true;
}

void DeferredSequencedTaskRunner::QueueDeferredTask(
const tracked_objects::Location& from_here,
OnceClosure task,
TimeDelta delay,
bool is_non_nestable) {
void DeferredSequencedTaskRunner::QueueDeferredTask(const Location& from_here,
OnceClosure task,
TimeDelta delay,
bool is_non_nestable) {
// Use CHECK instead of DCHECK to crash earlier. See http://crbug.com/711167
// for details.
CHECK(task);
Expand Down
8 changes: 4 additions & 4 deletions base/deferred_sequenced_task_runner.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ class BASE_EXPORT DeferredSequencedTaskRunner : public SequencedTaskRunner {
scoped_refptr<SequencedTaskRunner> target_runner);

// TaskRunner implementation
bool PostDelayedTask(const tracked_objects::Location& from_here,
bool PostDelayedTask(const Location& from_here,
OnceClosure task,
TimeDelta delay) override;
bool RunsTasksInCurrentSequence() const override;

// SequencedTaskRunner implementation
bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here,
bool PostNonNestableDelayedTask(const Location& from_here,
OnceClosure task,
TimeDelta delay) override;

Expand All @@ -50,7 +50,7 @@ class BASE_EXPORT DeferredSequencedTaskRunner : public SequencedTaskRunner {
~DeferredTask();
DeferredTask& operator=(DeferredTask&& other);

tracked_objects::Location posted_from;
Location posted_from;
OnceClosure task;
// The delay this task was initially posted with.
TimeDelta delay;
Expand All @@ -60,7 +60,7 @@ class BASE_EXPORT DeferredSequencedTaskRunner : public SequencedTaskRunner {
~DeferredSequencedTaskRunner() override;

// Creates a |Task| object and adds it to |deferred_tasks_queue_|.
void QueueDeferredTask(const tracked_objects::Location& from_here,
void QueueDeferredTask(const Location& from_here,
OnceClosure task,
TimeDelta delay,
bool is_non_nestable);
Expand Down
9 changes: 4 additions & 5 deletions base/message_loop/incoming_task_queue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,10 @@ IncomingTaskQueue::IncomingTaskQueue(MessageLoop* message_loop)
DETACH_FROM_SEQUENCE(sequence_checker_);
}

bool IncomingTaskQueue::AddToIncomingQueue(
const tracked_objects::Location& from_here,
OnceClosure task,
TimeDelta delay,
bool nestable) {
bool IncomingTaskQueue::AddToIncomingQueue(const Location& from_here,
OnceClosure task,
TimeDelta delay,
bool nestable) {
// Use CHECK instead of DCHECK to crash earlier. See http://crbug.com/711167
// for details.
CHECK(task);
Expand Down
2 changes: 1 addition & 1 deletion base/message_loop/incoming_task_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class BASE_EXPORT IncomingTaskQueue
// Returns true if the task was successfully added to the queue, otherwise
// returns false. In all cases, the ownership of |task| is transferred to the
// called method.
bool AddToIncomingQueue(const tracked_objects::Location& from_here,
bool AddToIncomingQueue(const Location& from_here,
OnceClosure task,
TimeDelta delay,
bool nestable);
Expand Down
9 changes: 4 additions & 5 deletions base/message_loop/message_loop_task_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,16 @@ void MessageLoopTaskRunner::BindToCurrentThread() {
valid_thread_id_ = PlatformThread::CurrentId();
}

bool MessageLoopTaskRunner::PostDelayedTask(
const tracked_objects::Location& from_here,
OnceClosure task,
base::TimeDelta delay) {
bool MessageLoopTaskRunner::PostDelayedTask(const Location& from_here,
OnceClosure task,
base::TimeDelta delay) {
DCHECK(!task.is_null()) << from_here.ToString();
return incoming_queue_->AddToIncomingQueue(from_here, std::move(task), delay,
true);
}

bool MessageLoopTaskRunner::PostNonNestableDelayedTask(
const tracked_objects::Location& from_here,
const Location& from_here,
OnceClosure task,
base::TimeDelta delay) {
DCHECK(!task.is_null()) << from_here.ToString();
Expand Down
8 changes: 4 additions & 4 deletions base/message_loop/message_loop_task_runner.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ class BASE_EXPORT MessageLoopTaskRunner : public SingleThreadTaskRunner {
void BindToCurrentThread();

// SingleThreadTaskRunner implementation
bool PostDelayedTask(const tracked_objects::Location& from_here,
bool PostDelayedTask(const Location& from_here,
OnceClosure task,
base::TimeDelta delay) override;
bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here,
TimeDelta delay) override;
bool PostNonNestableDelayedTask(const Location& from_here,
OnceClosure task,
base::TimeDelta delay) override;
TimeDelta delay) override;
bool RunsTasksInCurrentSequence() const override;

private:
Expand Down
4 changes: 2 additions & 2 deletions base/message_loop/message_pump_fuchsia.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
namespace base {

MessagePumpFuchsia::MxHandleWatchController::MxHandleWatchController(
const tracked_objects::Location& from_here)
const Location& from_here)
: created_from_location_(from_here) {}

MessagePumpFuchsia::MxHandleWatchController::~MxHandleWatchController() {
Expand Down Expand Up @@ -70,7 +70,7 @@ void MessagePumpFuchsia::FdWatchController::OnMxHandleSignalled(
}

MessagePumpFuchsia::FdWatchController::FdWatchController(
const tracked_objects::Location& from_here)
const Location& from_here)
: MxHandleWatchController(from_here) {}

MessagePumpFuchsia::FdWatchController::~FdWatchController() {
Expand Down
11 changes: 4 additions & 7 deletions base/message_loop/message_pump_fuchsia.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,15 @@ class BASE_EXPORT MessagePumpFuchsia : public MessagePump {
// Manages an active watch on an mx_handle_t.
class MxHandleWatchController {
public:
explicit MxHandleWatchController(
const tracked_objects::Location& from_here);
explicit MxHandleWatchController(const Location& from_here);
// Deleting the Controller implicitly calls StopWatchingMxHandle.
virtual ~MxHandleWatchController();

// Stop watching the handle, always safe to call. No-op if there's nothing
// to do.
bool StopWatchingMxHandle();

const tracked_objects::Location& created_from_location() {
return created_from_location_;
}
const Location& created_from_location() { return created_from_location_; }

protected:
// This bool is used by the pump when invoking the MxHandleWatcher callback,
Expand All @@ -79,7 +76,7 @@ class BASE_EXPORT MessagePumpFuchsia : public MessagePump {
return static_cast<uint64_t>(reinterpret_cast<uintptr_t>(this));
}

const tracked_objects::Location created_from_location_;
const Location created_from_location_;

// Set directly from the inputs to WatchFileDescriptor.
MxHandleWatcher* watcher_ = nullptr;
Expand All @@ -104,7 +101,7 @@ class BASE_EXPORT MessagePumpFuchsia : public MessagePump {
class FdWatchController : public MxHandleWatchController,
public MxHandleWatcher {
public:
explicit FdWatchController(const tracked_objects::Location& from_here);
explicit FdWatchController(const Location& from_here);
~FdWatchController() override;

bool StopWatchingFileDescriptor();
Expand Down
3 changes: 1 addition & 2 deletions base/message_loop/message_pump_glib_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ void ExpectProcessedEvents(EventInjector* injector, int count) {
}

// Posts a task on the current message loop.
void PostMessageLoopTask(const tracked_objects::Location& from_here,
OnceClosure task) {
void PostMessageLoopTask(const Location& from_here, OnceClosure task) {
ThreadTaskRunnerHandle::Get()->PostTask(from_here, std::move(task));
}

Expand Down
2 changes: 1 addition & 1 deletion base/message_loop/message_pump_io_ios.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace base {

MessagePumpIOSForIO::FileDescriptorWatcher::FileDescriptorWatcher(
const tracked_objects::Location& from_here)
const Location& from_here)
: is_persistent_(false),
fdref_(NULL),
callback_types_(0),
Expand Down
8 changes: 3 additions & 5 deletions base/message_loop/message_pump_io_ios.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class BASE_EXPORT MessagePumpIOSForIO : public MessagePumpNSRunLoop {
// Object returned by WatchFileDescriptor to manage further watching.
class FileDescriptorWatcher {
public:
explicit FileDescriptorWatcher(const tracked_objects::Location& from_here);
explicit FileDescriptorWatcher(const Location& from_here);
~FileDescriptorWatcher(); // Implicitly calls StopWatchingFileDescriptor.

// NOTE: These methods aren't called StartWatching()/StopWatching() to
Expand All @@ -47,9 +47,7 @@ class BASE_EXPORT MessagePumpIOSForIO : public MessagePumpNSRunLoop {
// to do.
bool StopWatchingFileDescriptor();

const tracked_objects::Location& created_from_location() {
return created_from_location_;
}
const Location& created_from_location() { return created_from_location_; }

private:
friend class MessagePumpIOSForIO;
Expand Down Expand Up @@ -77,7 +75,7 @@ class BASE_EXPORT MessagePumpIOSForIO : public MessagePumpNSRunLoop {
base::WeakPtr<MessagePumpIOSForIO> pump_;
Watcher* watcher_;

tracked_objects::Location created_from_location_;
Location created_from_location_;

DISALLOW_COPY_AND_ASSIGN(FileDescriptorWatcher);
};
Expand Down
2 changes: 1 addition & 1 deletion base/message_loop/message_pump_libevent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
namespace base {

MessagePumpLibevent::FileDescriptorWatcher::FileDescriptorWatcher(
const tracked_objects::Location& from_here)
const Location& from_here)
: event_(NULL),
pump_(NULL),
watcher_(NULL),
Expand Down
8 changes: 3 additions & 5 deletions base/message_loop/message_pump_libevent.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class BASE_EXPORT MessagePumpLibevent : public MessagePump {
// Object returned by WatchFileDescriptor to manage further watching.
class FileDescriptorWatcher {
public:
explicit FileDescriptorWatcher(const tracked_objects::Location& from_here);
explicit FileDescriptorWatcher(const Location& from_here);
~FileDescriptorWatcher(); // Implicitly calls StopWatchingFileDescriptor.

// NOTE: These methods aren't called StartWatching()/StopWatching() to
Expand All @@ -48,9 +48,7 @@ class BASE_EXPORT MessagePumpLibevent : public MessagePump {
// to do.
bool StopWatchingFileDescriptor();

const tracked_objects::Location& created_from_location() {
return created_from_location_;
}
const Location& created_from_location() { return created_from_location_; }

private:
friend class MessagePumpLibevent;
Expand Down Expand Up @@ -78,7 +76,7 @@ class BASE_EXPORT MessagePumpLibevent : public MessagePump {
// destructor.
bool* was_destroyed_;

const tracked_objects::Location created_from_location_;
const Location created_from_location_;

DISALLOW_COPY_AND_ASSIGN(FileDescriptorWatcher);
};
Expand Down
7 changes: 3 additions & 4 deletions base/observer_list_threadsafe.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ class ObserverListThreadSafe
// all Observers have been Notified. The notification may still be pending
// delivery.
template <typename Method, typename... Params>
void Notify(const tracked_objects::Location& from_here,
Method m, Params&&... params) {
void Notify(const Location& from_here, Method m, Params&&... params) {
Callback<void(ObserverType*)> method =
Bind(&internal::Dispatcher<ObserverType, Method>::Run,
m, std::forward<Params>(params)...);
Expand All @@ -151,11 +150,11 @@ class ObserverListThreadSafe
friend class RefCountedThreadSafe<ObserverListThreadSafe<ObserverType>>;

struct NotificationData {
NotificationData(const tracked_objects::Location& from_here_in,
NotificationData(const Location& from_here_in,
const Callback<void(ObserverType*)>& method_in)
: from_here(from_here_in), method(method_in) {}

tracked_objects::Location from_here;
Location from_here;
Callback<void(ObserverType*)> method;
};

Expand Down
5 changes: 2 additions & 3 deletions base/pending_task.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@

namespace base {

PendingTask::PendingTask(const tracked_objects::Location& posted_from,
OnceClosure task)
PendingTask::PendingTask(const Location& posted_from, OnceClosure task)
: PendingTask(posted_from, std::move(task), TimeTicks(), true) {}

PendingTask::PendingTask(const tracked_objects::Location& posted_from,
PendingTask::PendingTask(const Location& posted_from,
OnceClosure task,
TimeTicks delayed_run_time,
bool nestable)
Expand Down
6 changes: 3 additions & 3 deletions base/pending_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ namespace base {
// Contains data about a pending task. Stored in TaskQueue and DelayedTaskQueue
// for use by classes that queue and execute tasks.
struct BASE_EXPORT PendingTask {
PendingTask(const tracked_objects::Location& posted_from, OnceClosure task);
PendingTask(const tracked_objects::Location& posted_from,
PendingTask(const Location& posted_from, OnceClosure task);
PendingTask(const Location& posted_from,
OnceClosure task,
TimeTicks delayed_run_time,
bool nestable);
Expand All @@ -35,7 +35,7 @@ struct BASE_EXPORT PendingTask {
OnceClosure task;

// The site this PendingTask was posted from.
tracked_objects::Location posted_from;
Location posted_from;

// The time when the task should be run.
base::TimeTicks delayed_run_time;
Expand Down
37 changes: 18 additions & 19 deletions base/pending_task_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ class PendingTaskTest : public ::testing::Test {
protected:
using ExpectedTrace = std::vector<const void*>;

static void VerifyTraceAndPost(
const scoped_refptr<TaskRunner>& task_runner,
const tracked_objects::Location& posted_from,
const tracked_objects::Location& next_from_here,
const std::vector<const void*>& expected_trace,
Closure task) {
static void VerifyTraceAndPost(const scoped_refptr<TaskRunner>& task_runner,
const Location& posted_from,
const Location& next_from_here,
const std::vector<const void*>& expected_trace,
Closure task) {
SCOPED_TRACE(StringPrintf("Callback Depth: %zu", expected_trace.size()));

// Beyond depth + 1, the trace is nonsensical because there haven't been
Expand Down Expand Up @@ -57,12 +56,12 @@ class PendingTaskTest : public ::testing::Test {
// Ensure the task backtrace populates correctly.
TEST_F(PendingTaskTest, SingleThreadedSimple) {
MessageLoop loop;
const tracked_objects::Location& location0 = FROM_HERE;
const tracked_objects::Location& location1 = FROM_HERE;
const tracked_objects::Location& location2 = FROM_HERE;
const tracked_objects::Location& location3 = FROM_HERE;
const tracked_objects::Location& location4 = FROM_HERE;
const tracked_objects::Location& location5 = FROM_HERE;
const Location& location0 = FROM_HERE;
const Location& location1 = FROM_HERE;
const Location& location2 = FROM_HERE;
const Location& location3 = FROM_HERE;
const Location& location4 = FROM_HERE;
const Location& location5 = FROM_HERE;

Closure task5 = Bind(
&PendingTaskTest::VerifyTraceAndPost, loop.task_runner(), location4,
Expand Down Expand Up @@ -101,15 +100,15 @@ TEST_F(PendingTaskTest, MultipleThreads) {
thread_b.StartAndWaitForTesting();
thread_c.StartAndWaitForTesting();

const tracked_objects::Location& location_a0 = FROM_HERE;
const tracked_objects::Location& location_a1 = FROM_HERE;
const tracked_objects::Location& location_a2 = FROM_HERE;
const tracked_objects::Location& location_a3 = FROM_HERE;
const Location& location_a0 = FROM_HERE;
const Location& location_a1 = FROM_HERE;
const Location& location_a2 = FROM_HERE;
const Location& location_a3 = FROM_HERE;

const tracked_objects::Location& location_b0 = FROM_HERE;
const tracked_objects::Location& location_b1 = FROM_HERE;
const Location& location_b0 = FROM_HERE;
const Location& location_b1 = FROM_HERE;

const tracked_objects::Location& location_c0 = FROM_HERE;
const Location& location_c0 = FROM_HERE;

// On thread c, post a task back to thread a that verifies its trace
// and terminates after one more self-post.
Expand Down
Loading

0 comments on commit 8e88b31

Please sign in to comment.