| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/sync/base/weak_handle.h" | 5 #include "components/sync/base/weak_handle.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/location.h" | |
| 11 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| 12 | 11 |
| 13 namespace syncer { | 12 namespace syncer { |
| 14 | 13 |
| 15 namespace internal { | 14 namespace internal { |
| 16 | 15 |
| 17 WeakHandleCoreBase::WeakHandleCoreBase() | 16 WeakHandleCoreBase::WeakHandleCoreBase() |
| 18 : owner_loop_task_runner_(base::ThreadTaskRunnerHandle::Get()) {} | 17 : owner_loop_task_runner_(base::ThreadTaskRunnerHandle::Get()) {} |
| 19 | 18 |
| 20 bool WeakHandleCoreBase::IsOnOwnerThread() const { | 19 bool WeakHandleCoreBase::IsOnOwnerThread() const { |
| 21 return owner_loop_task_runner_->BelongsToCurrentThread(); | 20 return owner_loop_task_runner_->BelongsToCurrentThread(); |
| 22 } | 21 } |
| 23 | 22 |
| 24 WeakHandleCoreBase::~WeakHandleCoreBase() {} | 23 WeakHandleCoreBase::~WeakHandleCoreBase() {} |
| 25 | 24 |
| 26 void WeakHandleCoreBase::PostToOwnerThread( | 25 void WeakHandleCoreBase::PostToOwnerThread( |
| 27 const tracked_objects::Location& from_here, | 26 const tracked_objects::Location& from_here, |
| 28 const base::Closure& fn) const { | 27 const base::Closure& fn) const { |
| 29 if (!owner_loop_task_runner_->PostTask(from_here, fn)) { | 28 if (!owner_loop_task_runner_->PostTask(from_here, fn)) { |
| 30 DVLOG(1) << "Could not post task from " << from_here.ToString(); | 29 DVLOG(1) << "Could not post task from " << from_here.ToString(); |
| 31 } | 30 } |
| 32 } | 31 } |
| 33 | 32 |
| 34 } // namespace internal | 33 } // namespace internal |
| 35 | 34 |
| 36 } // namespace syncer | 35 } // namespace syncer |
| OLD | NEW |