Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 STATIC_ONLY(CrossThreadCopierBase); | 84 STATIC_ONLY(CrossThreadCopierBase); |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 template <typename T> | 87 template <typename T> |
| 88 struct CrossThreadCopier : public CrossThreadCopierBase<T, std::is_arithmetic<T> ::value || std::is_enum<T>::value> { | 88 struct CrossThreadCopier : public CrossThreadCopierBase<T, std::is_arithmetic<T> ::value || std::is_enum<T>::value> { |
| 89 STATIC_ONLY(CrossThreadCopier); | 89 STATIC_ONLY(CrossThreadCopier); |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 // CrossThreadCopier specializations follow. | 92 // CrossThreadCopier specializations follow. |
| 93 template <typename T> | 93 template <typename T> |
| 94 struct CrossThreadCopier<PassRefPtr<T>> : public CrossThreadCopierPassThrough<Pa ssRefPtr<T>> { | 94 struct CrossThreadCopier<PassRefPtr<T>> { |
| 95 STATIC_ONLY(CrossThreadCopier); | 95 STATIC_ONLY(CrossThreadCopier); |
| 96 typedef T Type; | |
|
Yuta Kitamura
2016/09/27 01:59:28
Type should be PassRefPtr<T>, not T. In the origin
| |
| 96 static_assert(WTF::IsSubclassOfTemplate<T, ThreadSafeRefCounted>::value, "Pa ssRefPtr<T> can be passed across threads only if T is ThreadSafeRefCounted."); | 97 static_assert(WTF::IsSubclassOfTemplate<T, ThreadSafeRefCounted>::value, "Pa ssRefPtr<T> can be passed across threads only if T is ThreadSafeRefCounted."); |
| 98 static PassRefPtr<T> copy(PassRefPtr<T>&& pointer) | |
| 99 { | |
| 100 return std::move(pointer); | |
| 101 } | |
| 97 }; | 102 }; |
| 98 template <typename T> | 103 template <typename T> |
| 99 struct CrossThreadCopier<RefPtr<T>> : public CrossThreadCopierPassThrough<RefPtr <T>> { | 104 struct CrossThreadCopier<RefPtr<T>> : public CrossThreadCopierPassThrough<RefPtr <T>> { |
| 100 STATIC_ONLY(CrossThreadCopier); | 105 STATIC_ONLY(CrossThreadCopier); |
| 101 static_assert(WTF::IsSubclassOfTemplate<T, ThreadSafeRefCounted>::value, "Re fPtr<T> can be passed across threads only if T is ThreadSafeRefCounted."); | 106 static_assert(WTF::IsSubclassOfTemplate<T, ThreadSafeRefCounted>::value, "Re fPtr<T> can be passed across threads only if T is ThreadSafeRefCounted."); |
| 102 }; | 107 }; |
| 103 template <typename T> | 108 template <typename T> |
| 104 struct CrossThreadCopier<sk_sp<T>> : public CrossThreadCopierPassThrough<sk_sp<T >> { | 109 struct CrossThreadCopier<sk_sp<T>> : public CrossThreadCopierPassThrough<sk_sp<T >> { |
| 105 STATIC_ONLY(CrossThreadCopier); | 110 STATIC_ONLY(CrossThreadCopier); |
| 106 static_assert(std::is_base_of<SkRefCnt, T>::value, "sk_sp<T> can be passed a cross threads only if T is SkRefCnt."); | 111 static_assert(std::is_base_of<SkRefCnt, T>::value, "sk_sp<T> can be passed a cross threads only if T is SkRefCnt."); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 192 template <> | 197 template <> |
| 193 struct CrossThreadCopier<ResourceResponse> { | 198 struct CrossThreadCopier<ResourceResponse> { |
| 194 STATIC_ONLY(CrossThreadCopier); | 199 STATIC_ONLY(CrossThreadCopier); |
| 195 typedef WTF::PassedWrapper<std::unique_ptr<CrossThreadResourceResponseData>> Type; | 200 typedef WTF::PassedWrapper<std::unique_ptr<CrossThreadResourceResponseData>> Type; |
| 196 PLATFORM_EXPORT static Type copy(const ResourceResponse&); | 201 PLATFORM_EXPORT static Type copy(const ResourceResponse&); |
| 197 }; | 202 }; |
| 198 | 203 |
| 199 } // namespace blink | 204 } // namespace blink |
| 200 | 205 |
| 201 #endif // CrossThreadCopier_h | 206 #endif // CrossThreadCopier_h |
| OLD | NEW |