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

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

Issue 1920193002: Remove CrossThreadCopier for WeakMember and WeakMember* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Kuroneko_5
Patch Set: Rebase Created 4 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 struct CrossThreadCopier<PassOwnPtr<T>> { 151 struct CrossThreadCopier<PassOwnPtr<T>> {
152 STATIC_ONLY(CrossThreadCopier); 152 STATIC_ONLY(CrossThreadCopier);
153 typedef PassOwnPtr<T> Type; 153 typedef PassOwnPtr<T> Type;
154 static Type copy(Type ownPtr) 154 static Type copy(Type ownPtr)
155 { 155 {
156 return ownPtr; 156 return ownPtr;
157 } 157 }
158 }; 158 };
159 159
160 template <typename T> 160 template <typename T>
161 struct CrossThreadCopier<WeakMember<T>*> {
162 STATIC_ONLY(CrossThreadCopier);
163 typedef WeakMember<T>* Type;
164 static Type copy(Type ptr)
165 {
166 return ptr;
167 }
168 };
169
170 template <typename T>
171 struct CrossThreadCopier<WTF::PassedWrapper<T>> { 161 struct CrossThreadCopier<WTF::PassedWrapper<T>> {
172 STATIC_ONLY(CrossThreadCopier); 162 STATIC_ONLY(CrossThreadCopier);
173 using Type = WTF::PassedWrapper<typename CrossThreadCopier<T>::Type>; 163 using Type = WTF::PassedWrapper<typename CrossThreadCopier<T>::Type>;
174 static Type copy(WTF::PassedWrapper<T>&& value) { return passed(CrossThreadC opier<T>::copy(value.moveOut())); } 164 static Type copy(WTF::PassedWrapper<T>&& value) { return passed(CrossThreadC opier<T>::copy(value.moveOut())); }
175 }; 165 };
176 166
177 template<typename T> 167 template<typename T>
178 struct CrossThreadCopier<CrossThreadWeakPersistentThisPointer<T>> : public Cross ThreadCopierPassThrough<CrossThreadWeakPersistentThisPointer<T>> { 168 struct CrossThreadCopier<CrossThreadWeakPersistentThisPointer<T>> : public Cross ThreadCopierPassThrough<CrossThreadWeakPersistentThisPointer<T>> {
179 STATIC_ONLY(CrossThreadCopier); 169 STATIC_ONLY(CrossThreadCopier);
180 }; 170 };
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 struct CrossThreadCopier<Member<T>> { 208 struct CrossThreadCopier<Member<T>> {
219 STATIC_ONLY(CrossThreadCopier); 209 STATIC_ONLY(CrossThreadCopier);
220 static_assert(IsGarbageCollectedType<T>::value, "T must be a garbage-collect ed type."); 210 static_assert(IsGarbageCollectedType<T>::value, "T must be a garbage-collect ed type.");
221 typedef T* Type; 211 typedef T* Type;
222 static Type copy(const Member<T>& ptr) 212 static Type copy(const Member<T>& ptr)
223 { 213 {
224 return ptr; 214 return ptr;
225 } 215 }
226 }; 216 };
227 217
228 template <typename T>
229 struct CrossThreadCopier<WeakMember<T>> {
230 STATIC_ONLY(CrossThreadCopier);
231 static_assert(IsGarbageCollectedType<T>::value, "T must be a garbage-collect ed type.");
232 typedef T* Type;
233 static Type copy(const WeakMember<T>& ptr)
234 {
235 return ptr;
236 }
237 };
238
239 // |T| is |C*| or |const WeakPtr<C>&|. 218 // |T| is |C*| or |const WeakPtr<C>&|.
240 template <typename T> 219 template <typename T>
241 struct AllowCrossThreadAccessWrapper { 220 struct AllowCrossThreadAccessWrapper {
242 STACK_ALLOCATED(); 221 STACK_ALLOCATED();
243 public: 222 public:
244 explicit AllowCrossThreadAccessWrapper(T value) : m_value(value) { } 223 explicit AllowCrossThreadAccessWrapper(T value) : m_value(value) { }
245 T value() const { return m_value; } 224 T value() const { return m_value; }
246 private: 225 private:
247 // This raw pointer is safe since AllowCrossThreadAccessWrapper is 226 // This raw pointer is safe since AllowCrossThreadAccessWrapper is
248 // always stack-allocated. Ideally this should be Member<T> if T is 227 // always stack-allocated. Ideally this should be Member<T> if T is
(...skipping 19 matching lines...) Expand all
268 247
269 template <typename T> 248 template <typename T>
270 AllowCrossThreadAccessWrapper<const WeakPtr<T>&> AllowCrossThreadAccess(const We akPtr<T>& value) 249 AllowCrossThreadAccessWrapper<const WeakPtr<T>&> AllowCrossThreadAccess(const We akPtr<T>& value)
271 { 250 {
272 return AllowCrossThreadAccessWrapper<const WeakPtr<T>&>(value); 251 return AllowCrossThreadAccessWrapper<const WeakPtr<T>&>(value);
273 } 252 }
274 253
275 } // namespace blink 254 } // namespace blink
276 255
277 #endif // CrossThreadCopier_h 256 #endif // CrossThreadCopier_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698