Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: sync/internal_api/public/util/weak_handle.h

Issue 11515009: [sync] Componentize sync: Part 2: Add SYNC_EXPORTs to files in src/sync/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR Feedback Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/internal_api/public/util/syncer_error.h ('k') | sync/internal_api/public/write_node.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 // Weak handles provides a way to refer to weak pointers from another 5 // Weak handles provides a way to refer to weak pointers from another
6 // thread. This is useful because it is not safe to reference a weak 6 // thread. This is useful because it is not safe to reference a weak
7 // pointer from a thread other than the thread on which it was 7 // pointer from a thread other than the thread on which it was
8 // created. 8 // created.
9 // 9 //
10 // Weak handles can be passed across threads, so for example, you can 10 // Weak handles can be passed across threads, so for example, you can
11 // use them to do the "real" work on one thread and get notified on 11 // use them to do the "real" work on one thread and get notified on
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 private: 118 private:
119 // May be used on any thread. 119 // May be used on any thread.
120 const scoped_refptr<base::MessageLoopProxy> owner_loop_proxy_; 120 const scoped_refptr<base::MessageLoopProxy> owner_loop_proxy_;
121 121
122 DISALLOW_COPY_AND_ASSIGN(WeakHandleCoreBase); 122 DISALLOW_COPY_AND_ASSIGN(WeakHandleCoreBase);
123 }; 123 };
124 124
125 // WeakHandleCore<T> contains all the logic for WeakHandle<T>. 125 // WeakHandleCore<T> contains all the logic for WeakHandle<T>.
126 template <typename T> 126 template <typename T>
127 class WeakHandleCore 127 class WeakHandleCore
128 : public WeakHandleCoreBase, 128 : public NON_EXPORTED_BASE(WeakHandleCoreBase),
129 public base::RefCountedThreadSafe<WeakHandleCore<T> > { 129 public base::RefCountedThreadSafe<WeakHandleCore<T> > {
130 public: 130 public:
131 // Must be called on |ptr|'s owner thread, which is assumed to be 131 // Must be called on |ptr|'s owner thread, which is assumed to be
132 // the current thread. 132 // the current thread.
133 explicit WeakHandleCore(const base::WeakPtr<T>& ptr) : ptr_(ptr) {} 133 explicit WeakHandleCore(const base::WeakPtr<T>& ptr) : ptr_(ptr) {}
134 134
135 // Must be called on |ptr_|'s owner thread. 135 // Must be called on |ptr_|'s owner thread.
136 base::WeakPtr<T> Get() const { 136 base::WeakPtr<T> Get() const {
137 CHECK(IsOnOwnerThread()); 137 CHECK(IsOnOwnerThread());
138 return ptr_; 138 return ptr_;
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 369
370 // Makes a WeakHandle from a WeakPtr. 370 // Makes a WeakHandle from a WeakPtr.
371 template <typename T> 371 template <typename T>
372 WeakHandle<T> MakeWeakHandle(const base::WeakPtr<T>& ptr) { 372 WeakHandle<T> MakeWeakHandle(const base::WeakPtr<T>& ptr) {
373 return WeakHandle<T>(ptr); 373 return WeakHandle<T>(ptr);
374 } 374 }
375 375
376 } // namespace syncer 376 } // namespace syncer
377 377
378 #endif // SYNC_UTIL_WEAK_HANDLE_H_ 378 #endif // SYNC_UTIL_WEAK_HANDLE_H_
OLDNEW
« no previous file with comments | « sync/internal_api/public/util/syncer_error.h ('k') | sync/internal_api/public/write_node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698