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

Side by Side Diff: third_party/WebKit/Source/wtf/Functional.h

Issue 2329243002: Implement WTF::WeakPtr in terms of base::WeakPtr (Closed)
Patch Set: Thread-safety fix with comment Created 4 years, 3 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 17 matching lines...) Expand all
28 28
29 #include "base/bind.h" 29 #include "base/bind.h"
30 #include "base/threading/thread_checker.h" 30 #include "base/threading/thread_checker.h"
31 #include "wtf/Allocator.h" 31 #include "wtf/Allocator.h"
32 #include "wtf/Assertions.h" 32 #include "wtf/Assertions.h"
33 #include "wtf/PassRefPtr.h" 33 #include "wtf/PassRefPtr.h"
34 #include "wtf/PtrUtil.h" 34 #include "wtf/PtrUtil.h"
35 #include "wtf/RefPtr.h" 35 #include "wtf/RefPtr.h"
36 #include "wtf/ThreadSafeRefCounted.h" 36 #include "wtf/ThreadSafeRefCounted.h"
37 #include "wtf/TypeTraits.h" 37 #include "wtf/TypeTraits.h"
38 #include "wtf/WeakPtr.h"
39 #include <utility> 38 #include <utility>
40 39
41 namespace blink { 40 namespace blink {
42 template <typename T> class Member; 41 template <typename T> class Member;
43 template <typename T> class WeakMember; 42 template <typename T> class WeakMember;
44 } 43 }
45 44
46 namespace WTF { 45 namespace WTF {
47 46
48 // Functional.h provides a very simple way to bind a function pointer and argume nts together into a function object 47 // Functional.h provides a very simple way to bind a function pointer and argume nts together into a function object
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 } 231 }
233 232
234 typedef Function<void(), SameThreadAffinity> Closure; 233 typedef Function<void(), SameThreadAffinity> Closure;
235 typedef Function<void(), CrossThreadAffinity> CrossThreadClosure; 234 typedef Function<void(), CrossThreadAffinity> CrossThreadClosure;
236 235
237 } // namespace WTF 236 } // namespace WTF
238 237
239 namespace base { 238 namespace base {
240 239
241 template <typename T> 240 template <typename T>
242 struct IsWeakReceiver<WTF::WeakPtr<T>> : std::true_type {};
243
244 template <typename T>
245 struct BindUnwrapTraits<WTF::RefPtr<T>> { 241 struct BindUnwrapTraits<WTF::RefPtr<T>> {
246 static T* Unwrap(const WTF::RefPtr<T>& wrapped) 242 static T* Unwrap(const WTF::RefPtr<T>& wrapped)
247 { 243 {
248 return wrapped.get(); 244 return wrapped.get();
249 } 245 }
250 }; 246 };
251 247
252 template <typename T> 248 template <typename T>
253 struct BindUnwrapTraits<WTF::PassedWrapper<T>> { 249 struct BindUnwrapTraits<WTF::PassedWrapper<T>> {
254 static T Unwrap(const WTF::PassedWrapper<T>& wrapped) 250 static T Unwrap(const WTF::PassedWrapper<T>& wrapped)
(...skipping 13 matching lines...) Expand all
268 } // namespace base 264 } // namespace base
269 265
270 using WTF::passed; 266 using WTF::passed;
271 using WTF::unretained; 267 using WTF::unretained;
272 using WTF::crossThreadUnretained; 268 using WTF::crossThreadUnretained;
273 269
274 using WTF::Function; 270 using WTF::Function;
275 using WTF::CrossThreadClosure; 271 using WTF::CrossThreadClosure;
276 272
277 #endif // WTF_Functional_h 273 #endif // WTF_Functional_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698