Chromium Code Reviews

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

Issue 1914453002: Replace AllowCrossThreadAccess() + GCed pointers with wrapCrossThreadPersistent() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Kuroneko_2
Patch Set: Rebase. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 232 matching lines...)
243 template <typename T> 243 template <typename T>
244 struct CrossThreadCopier<AllowCrossThreadAccessWrapper<T>> { 244 struct CrossThreadCopier<AllowCrossThreadAccessWrapper<T>> {
245 STATIC_ONLY(CrossThreadCopier); 245 STATIC_ONLY(CrossThreadCopier);
246 typedef T Type; 246 typedef T Type;
247 static Type copy(const AllowCrossThreadAccessWrapper<T>& wrapper) { return w rapper.value(); } 247 static Type copy(const AllowCrossThreadAccessWrapper<T>& wrapper) { return w rapper.value(); }
248 }; 248 };
249 249
250 template <typename T> 250 template <typename T>
251 AllowCrossThreadAccessWrapper<T*> AllowCrossThreadAccess(T* value) 251 AllowCrossThreadAccessWrapper<T*> AllowCrossThreadAccess(T* value)
252 { 252 {
253 static_assert(!blink::IsGarbageCollectedType<T>::value, "Use wrapCrossThread Persistent() instead for garbage-collected pointers");
253 return AllowCrossThreadAccessWrapper<T*>(value); 254 return AllowCrossThreadAccessWrapper<T*>(value);
254 } 255 }
255 256
256 template <typename T> 257 template <typename T>
257 AllowCrossThreadAccessWrapper<const WeakPtr<T>&> AllowCrossThreadAccess(const We akPtr<T>& value) 258 AllowCrossThreadAccessWrapper<const WeakPtr<T>&> AllowCrossThreadAccess(const We akPtr<T>& value)
258 { 259 {
259 return AllowCrossThreadAccessWrapper<const WeakPtr<T>&>(value); 260 return AllowCrossThreadAccessWrapper<const WeakPtr<T>&>(value);
260 } 261 }
261 262
262 } // namespace blink 263 } // namespace blink
263 264
264 #endif // CrossThreadCopier_h 265 #endif // CrossThreadCopier_h
OLDNEW

Powered by Google App Engine