OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sync/util/weak_handle.h" | 5 #include "chrome/browser/sync/util/weak_handle.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
| 9 #include "base/location.h" |
9 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
10 #include "base/tracked.h" | |
11 | 11 |
12 namespace browser_sync { | 12 namespace browser_sync { |
13 | 13 |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 WeakHandleCoreBase::WeakHandleCoreBase() | 16 WeakHandleCoreBase::WeakHandleCoreBase() |
17 : owner_loop_proxy_(base::MessageLoopProxy::current()) {} | 17 : owner_loop_proxy_(base::MessageLoopProxy::current()) {} |
18 | 18 |
19 bool WeakHandleCoreBase::IsOnOwnerThread() const { | 19 bool WeakHandleCoreBase::IsOnOwnerThread() const { |
20 return owner_loop_proxy_->BelongsToCurrentThread(); | 20 return owner_loop_proxy_->BelongsToCurrentThread(); |
21 } | 21 } |
22 | 22 |
23 WeakHandleCoreBase::~WeakHandleCoreBase() {} | 23 WeakHandleCoreBase::~WeakHandleCoreBase() {} |
24 | 24 |
25 void WeakHandleCoreBase::PostToOwnerThread( | 25 void WeakHandleCoreBase::PostToOwnerThread( |
26 const tracked_objects::Location& from_here, | 26 const tracked_objects::Location& from_here, |
27 const base::Closure& fn) const { | 27 const base::Closure& fn) const { |
28 if (!owner_loop_proxy_->PostTask(from_here, fn)) { | 28 if (!owner_loop_proxy_->PostTask(from_here, fn)) { |
29 VLOG(1) << "Could not post task from " << from_here.ToString(); | 29 VLOG(1) << "Could not post task from " << from_here.ToString(); |
30 } | 30 } |
31 } | 31 } |
32 | 32 |
33 } // namespace internal | 33 } // namespace internal |
34 | 34 |
35 } // namespace base | 35 } // namespace base |
OLD | NEW |