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
3 // found in the LICENSE file.
5 #include "sync/internal_api/public/util/weak_handle.h"
9 #include "base/callback.h"
10 #include "base/location.h"
11 #include "base/message_loop/message_loop_proxy.h"
17 WeakHandleCoreBase::WeakHandleCoreBase()
18 : owner_loop_proxy_(base::MessageLoopProxy::current()) {}
20 bool WeakHandleCoreBase::IsOnOwnerThread() const {
21 return owner_loop_proxy_
->BelongsToCurrentThread();
24 WeakHandleCoreBase::~WeakHandleCoreBase() {}
26 void WeakHandleCoreBase::PostToOwnerThread(
27 const tracked_objects::Location
& from_here
,
28 const base::Closure
& fn
) const {
29 if (!owner_loop_proxy_
->PostTask(from_here
, fn
)) {
30 DVLOG(1) << "Could not post task from " << from_here
.ToString();
34 } // namespace internal