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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 class IntRect; | 45 class IntRect; |
46 class IntSize; | 46 class IntSize; |
47 class KURL; | 47 class KURL; |
48 class ResourceError; | 48 class ResourceError; |
49 class ResourceRequest; | 49 class ResourceRequest; |
50 class ResourceResponse; | 50 class ResourceResponse; |
51 struct CrossThreadResourceResponseData; | 51 struct CrossThreadResourceResponseData; |
52 struct CrossThreadResourceRequestData; | 52 struct CrossThreadResourceRequestData; |
53 struct ThreadableLoaderOptions; | 53 struct ThreadableLoaderOptions; |
| 54 struct ResourceLoaderOptions; |
54 | 55 |
55 template<typename T> struct CrossThreadCopierPassThrough { | 56 template<typename T> struct CrossThreadCopierPassThrough { |
56 typedef T Type; | 57 typedef T Type; |
57 static Type copy(const T& parameter) | 58 static Type copy(const T& parameter) |
58 { | 59 { |
59 return parameter; | 60 return parameter; |
60 } | 61 } |
61 }; | 62 }; |
62 | 63 |
63 template<bool isConvertibleToInteger, bool isThreadSafeRefCounted, typename
T> struct CrossThreadCopierBase; | 64 template<bool isConvertibleToInteger, bool isThreadSafeRefCounted, typename
T> struct CrossThreadCopierBase; |
64 | 65 |
65 // Integers get passed through without any changes. | 66 // Integers get passed through without any changes. |
66 template<typename T> struct CrossThreadCopierBase<true, false, T> : public C
rossThreadCopierPassThrough<T> { | 67 template<typename T> struct CrossThreadCopierBase<true, false, T> : public C
rossThreadCopierPassThrough<T> { |
67 }; | 68 }; |
68 | 69 |
69 // To allow a type to be passed across threads using its copy constructor, a
dd a forward declaration of the type and | 70 // To allow a type to be passed across threads using its copy constructor, a
dd a forward declaration of the type and |
70 // a CopyThreadCopierBase<false, false, TypeName> : public CrossThreadCopier
PassThrough<TypeName> { }; to this file. | 71 // a CopyThreadCopierBase<false, false, TypeName> : public CrossThreadCopier
PassThrough<TypeName> { }; to this file. |
71 template<> struct CrossThreadCopierBase<false, false, ThreadableLoaderOption
s> : public CrossThreadCopierPassThrough<ThreadableLoaderOptions> { | 72 template<> struct CrossThreadCopierBase<false, false, ThreadableLoaderOption
s> : public CrossThreadCopierPassThrough<ThreadableLoaderOptions> { |
72 }; | 73 }; |
73 | 74 |
| 75 template<> struct CrossThreadCopierBase<false, false, ResourceLoaderOptions>
: public CrossThreadCopierPassThrough<ResourceLoaderOptions> { |
| 76 }; |
| 77 |
74 template<> struct CrossThreadCopierBase<false, false, IntRect> : public Cros
sThreadCopierPassThrough<IntRect> { | 78 template<> struct CrossThreadCopierBase<false, false, IntRect> : public Cros
sThreadCopierPassThrough<IntRect> { |
75 }; | 79 }; |
76 | 80 |
77 template<> struct CrossThreadCopierBase<false, false, IntSize> : public Cros
sThreadCopierPassThrough<IntSize> { | 81 template<> struct CrossThreadCopierBase<false, false, IntSize> : public Cros
sThreadCopierPassThrough<IntSize> { |
78 }; | 82 }; |
79 | 83 |
80 // Custom copy methods. | 84 // Custom copy methods. |
81 template<typename T> struct CrossThreadCopierBase<false, true, T> { | 85 template<typename T> struct CrossThreadCopierBase<false, true, T> { |
82 typedef typename WTF::RemoveTemplate<T, RefPtr>::Type TypeWithoutRefPtr; | 86 typedef typename WTF::RemoveTemplate<T, RefPtr>::Type TypeWithoutRefPtr; |
83 typedef typename WTF::RemoveTemplate<TypeWithoutRefPtr, PassRefPtr>::Typ
e TypeWithoutPassRefPtr; | 87 typedef typename WTF::RemoveTemplate<TypeWithoutRefPtr, PassRefPtr>::Typ
e TypeWithoutPassRefPtr; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 175 |
172 template<typename T> AllowAccessLaterWrapper<T> AllowAccessLater(T* value) | 176 template<typename T> AllowAccessLaterWrapper<T> AllowAccessLater(T* value) |
173 { | 177 { |
174 return AllowAccessLaterWrapper<T>(value); | 178 return AllowAccessLaterWrapper<T>(value); |
175 } | 179 } |
176 | 180 |
177 | 181 |
178 } // namespace WebCore | 182 } // namespace WebCore |
179 | 183 |
180 #endif // CrossThreadCopier_h | 184 #endif // CrossThreadCopier_h |
OLD | NEW |