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

Side by Side Diff: third_party/WebKit/Source/platform/CrossThreadCopier.h

Issue 2091713002: Specialize base::IsWeakReceiver for Blink weak pointers to support base::Bind (1/5) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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) 2009, 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2010 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 STATIC_ONLY(CrossThreadCopier); 159 STATIC_ONLY(CrossThreadCopier);
160 }; 160 };
161 161
162 template <typename T> 162 template <typename T>
163 struct CrossThreadCopier<WTF::PassedWrapper<T>> { 163 struct CrossThreadCopier<WTF::PassedWrapper<T>> {
164 STATIC_ONLY(CrossThreadCopier); 164 STATIC_ONLY(CrossThreadCopier);
165 using Type = WTF::PassedWrapper<typename CrossThreadCopier<T>::Type>; 165 using Type = WTF::PassedWrapper<typename CrossThreadCopier<T>::Type>;
166 static Type copy(WTF::PassedWrapper<T>&& value) { return passed(CrossThreadC opier<T>::copy(value.moveOut())); } 166 static Type copy(WTF::PassedWrapper<T>&& value) { return passed(CrossThreadC opier<T>::copy(value.moveOut())); }
167 }; 167 };
168 168
169 template<typename T>
170 struct CrossThreadCopier<CrossThreadWeakPersistentThisPointer<T>> : public Cross ThreadCopierPassThrough<CrossThreadWeakPersistentThisPointer<T>> {
171 STATIC_ONLY(CrossThreadCopier);
172 };
173
174 template <> 169 template <>
175 struct CrossThreadCopier<KURL> { 170 struct CrossThreadCopier<KURL> {
176 STATIC_ONLY(CrossThreadCopier); 171 STATIC_ONLY(CrossThreadCopier);
177 typedef KURL Type; 172 typedef KURL Type;
178 PLATFORM_EXPORT static Type copy(const KURL&); 173 PLATFORM_EXPORT static Type copy(const KURL&);
179 }; 174 };
180 175
181 template <> 176 template <>
182 struct CrossThreadCopier<String> { 177 struct CrossThreadCopier<String> {
183 STATIC_ONLY(CrossThreadCopier); 178 STATIC_ONLY(CrossThreadCopier);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 AllowCrossThreadAccessWrapper<T*> AllowCrossThreadAccess(T* value) 244 AllowCrossThreadAccessWrapper<T*> AllowCrossThreadAccess(T* value)
250 { 245 {
251 static_assert(!IsGarbageCollectedType<T>::value, "Use wrapCrossThreadPersist ent() instead for garbage-collected pointers"); 246 static_assert(!IsGarbageCollectedType<T>::value, "Use wrapCrossThreadPersist ent() instead for garbage-collected pointers");
252 static_assert(!WTF::IsSubclassOfTemplate<T, ThreadSafeRefCounted>::value, "U se PassRefPtr<T> instead for ThreadSafeRefCounted"); 247 static_assert(!WTF::IsSubclassOfTemplate<T, ThreadSafeRefCounted>::value, "U se PassRefPtr<T> instead for ThreadSafeRefCounted");
253 return AllowCrossThreadAccessWrapper<T*>(value); 248 return AllowCrossThreadAccessWrapper<T*>(value);
254 } 249 }
255 250
256 } // namespace blink 251 } // namespace blink
257 252
258 #endif // CrossThreadCopier_h 253 #endif // CrossThreadCopier_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698