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>> : public CrossThreadCopierPassThrough<Pa ssRefPtr<T>> { |
Yuta Kitamura
2016/09/23 07:33:35
You probably should remove this inheritance and de
| |
95 STATIC_ONLY(CrossThreadCopier); | 95 STATIC_ONLY(CrossThreadCopier); |
96 static_assert(WTF::IsSubclassOfTemplate<T, ThreadSafeRefCounted>::value, "Pa ssRefPtr<T> can be passed across threads only if T is ThreadSafeRefCounted."); | 96 static_assert(WTF::IsSubclassOfTemplate<T, ThreadSafeRefCounted>::value, "Pa ssRefPtr<T> can be passed across threads only if T is ThreadSafeRefCounted."); |
97 static PassRefPtr<T> copy(PassRefPtr<T>&& pointer) | |
98 { | |
99 return std::move(pointer); | |
100 } | |
97 }; | 101 }; |
98 template <typename T> | 102 template <typename T> |
99 struct CrossThreadCopier<RefPtr<T>> : public CrossThreadCopierPassThrough<RefPtr <T>> { | 103 struct CrossThreadCopier<RefPtr<T>> : public CrossThreadCopierPassThrough<RefPtr <T>> { |
100 STATIC_ONLY(CrossThreadCopier); | 104 STATIC_ONLY(CrossThreadCopier); |
101 static_assert(WTF::IsSubclassOfTemplate<T, ThreadSafeRefCounted>::value, "Re fPtr<T> can be passed across threads only if T is ThreadSafeRefCounted."); | 105 static_assert(WTF::IsSubclassOfTemplate<T, ThreadSafeRefCounted>::value, "Re fPtr<T> can be passed across threads only if T is ThreadSafeRefCounted."); |
102 }; | 106 }; |
103 template <typename T> | 107 template <typename T> |
104 struct CrossThreadCopier<sk_sp<T>> : public CrossThreadCopierPassThrough<sk_sp<T >> { | 108 struct CrossThreadCopier<sk_sp<T>> : public CrossThreadCopierPassThrough<sk_sp<T >> { |
105 STATIC_ONLY(CrossThreadCopier); | 109 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."); | 110 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 <> | 196 template <> |
193 struct CrossThreadCopier<ResourceResponse> { | 197 struct CrossThreadCopier<ResourceResponse> { |
194 STATIC_ONLY(CrossThreadCopier); | 198 STATIC_ONLY(CrossThreadCopier); |
195 typedef WTF::PassedWrapper<std::unique_ptr<CrossThreadResourceResponseData>> Type; | 199 typedef WTF::PassedWrapper<std::unique_ptr<CrossThreadResourceResponseData>> Type; |
196 PLATFORM_EXPORT static Type copy(const ResourceResponse&); | 200 PLATFORM_EXPORT static Type copy(const ResourceResponse&); |
197 }; | 201 }; |
198 | 202 |
199 } // namespace blink | 203 } // namespace blink |
200 | 204 |
201 #endif // CrossThreadCopier_h | 205 #endif // CrossThreadCopier_h |
OLD | NEW |