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 23 matching lines...) Expand all Loading... |
34 #include "platform/PlatformExport.h" | 34 #include "platform/PlatformExport.h" |
35 #include "platform/heap/Handle.h" | 35 #include "platform/heap/Handle.h" |
36 #include "wtf/Assertions.h" | 36 #include "wtf/Assertions.h" |
37 #include "wtf/Forward.h" | 37 #include "wtf/Forward.h" |
38 #include "wtf/PassOwnPtr.h" | 38 #include "wtf/PassOwnPtr.h" |
39 #include "wtf/PassRefPtr.h" | 39 #include "wtf/PassRefPtr.h" |
40 #include "wtf/RawPtr.h" | 40 #include "wtf/RawPtr.h" |
41 #include "wtf/RefPtr.h" | 41 #include "wtf/RefPtr.h" |
42 #include "wtf/ThreadSafeRefCounted.h" | 42 #include "wtf/ThreadSafeRefCounted.h" |
43 #include "wtf/TypeTraits.h" | 43 #include "wtf/TypeTraits.h" |
| 44 #include "wtf/Vector.h" |
| 45 #include "wtf/text/WTFString.h" |
44 | 46 |
45 namespace blink { | 47 namespace blink { |
46 | 48 |
47 class IntRect; | 49 class IntRect; |
48 class IntSize; | 50 class IntSize; |
49 class KURL; | 51 class KURL; |
50 class ResourceError; | 52 class ResourceError; |
51 class ResourceRequest; | 53 class ResourceRequest; |
52 class ResourceResponse; | 54 class ResourceResponse; |
| 55 class MockAnimationPlayer; |
53 struct CrossThreadResourceResponseData; | 56 struct CrossThreadResourceResponseData; |
54 struct CrossThreadResourceRequestData; | 57 struct CrossThreadResourceRequestData; |
55 struct ThreadableLoaderOptions; | 58 struct ThreadableLoaderOptions; |
56 struct ResourceLoaderOptions; | 59 struct ResourceLoaderOptions; |
| 60 struct Timing; |
| 61 struct ProxyKeyframe; |
| 62 struct ProxyPairs; |
57 | 63 |
58 template<typename T> struct CrossThreadCopierPassThrough { | 64 template<typename T> struct CrossThreadCopierPassThrough { |
59 typedef T Type; | 65 typedef T Type; |
60 static Type copy(const T& parameter) | 66 static Type copy(const T& parameter) |
61 { | 67 { |
62 return parameter; | 68 return parameter; |
63 } | 69 } |
64 }; | 70 }; |
65 | 71 |
66 template<bool isConvertibleToInteger, bool isThreadSafeRefCounted, bool isGa
rbageCollected, typename T> struct CrossThreadCopierBase; | 72 template<bool isConvertibleToInteger, bool isThreadSafeRefCounted, bool isGa
rbageCollected, typename T> struct CrossThreadCopierBase; |
67 | 73 |
68 // Integers get passed through without any changes. | 74 // Integers get passed through without any changes. |
69 template<typename T> struct CrossThreadCopierBase<true, false, false, T> : p
ublic CrossThreadCopierPassThrough<T> { | 75 template<typename T> struct CrossThreadCopierBase<true, false, false, T> : p
ublic CrossThreadCopierPassThrough<T> { |
70 }; | 76 }; |
71 | 77 |
72 // To allow a type to be passed across threads using its copy constructor, a
dd a forward declaration of the type and | 78 // To allow a type to be passed across threads using its copy constructor, a
dd a forward declaration of the type and |
73 // a CopyThreadCopierBase<false, false, TypeName> : public CrossThreadCopier
PassThrough<TypeName> { }; to this file. | 79 // a CopyThreadCopierBase<false, false, TypeName> : public CrossThreadCopier
PassThrough<TypeName> { }; to this file. |
74 template<> struct CrossThreadCopierBase<false, false, false, ThreadableLoade
rOptions> : public CrossThreadCopierPassThrough<ThreadableLoaderOptions> { | 80 template<> struct CrossThreadCopierBase<false, false, false, ThreadableLoade
rOptions> : public CrossThreadCopierPassThrough<ThreadableLoaderOptions> { |
75 }; | 81 }; |
76 | 82 |
77 template<> struct CrossThreadCopierBase<false, false, false, ResourceLoaderO
ptions> : public CrossThreadCopierPassThrough<ResourceLoaderOptions> { | 83 template<> struct CrossThreadCopierBase<false, false, false, ResourceLoaderO
ptions> : public CrossThreadCopierPassThrough<ResourceLoaderOptions> { |
78 }; | 84 }; |
79 | 85 |
| 86 template<> struct CrossThreadCopierBase<false, false, false, Timing> : publi
c CrossThreadCopierPassThrough<Timing> { |
| 87 }; |
| 88 |
| 89 template<> struct CrossThreadCopierBase<false, false, false, MockAnimationPl
ayer*> : public CrossThreadCopierPassThrough<MockAnimationPlayer*> { |
| 90 }; |
| 91 |
| 92 template<> struct CrossThreadCopierBase<false, false, false, Vector<ProxyPai
rs> > : public CrossThreadCopierPassThrough<Vector<ProxyPairs> > { |
| 93 }; |
| 94 |
| 95 template<> struct CrossThreadCopierBase<false, false, false, ProxyKeyframe>
: public CrossThreadCopierPassThrough<ProxyKeyframe> { |
| 96 }; |
| 97 |
| 98 template<> struct CrossThreadCopierBase<false, false, false, Vector<ProxyKey
frame> > : public CrossThreadCopierPassThrough<Vector<ProxyKeyframe> > { |
| 99 }; |
| 100 |
| 101 template<> struct CrossThreadCopierBase<false, false, false, Vector<String>
> : public CrossThreadCopierPassThrough<Vector<String> > { |
| 102 }; |
| 103 |
80 template<> struct CrossThreadCopierBase<false, false, false, IntRect> : publ
ic CrossThreadCopierPassThrough<IntRect> { | 104 template<> struct CrossThreadCopierBase<false, false, false, IntRect> : publ
ic CrossThreadCopierPassThrough<IntRect> { |
81 }; | 105 }; |
82 | 106 |
83 template<> struct CrossThreadCopierBase<false, false, false, IntSize> : publ
ic CrossThreadCopierPassThrough<IntSize> { | 107 template<> struct CrossThreadCopierBase<false, false, false, IntSize> : publ
ic CrossThreadCopierPassThrough<IntSize> { |
84 }; | 108 }; |
85 | 109 |
86 // Custom copy methods. | 110 // Custom copy methods. |
87 template<typename T> struct CrossThreadCopierBase<false, true, false, T> { | 111 template<typename T> struct CrossThreadCopierBase<false, true, false, T> { |
88 typedef typename WTF::RemoveTemplate<T, RefPtr>::Type TypeWithoutRefPtr; | 112 typedef typename WTF::RemoveTemplate<T, RefPtr>::Type TypeWithoutRefPtr; |
89 typedef typename WTF::RemoveTemplate<TypeWithoutRefPtr, PassRefPtr>::Typ
e TypeWithoutPassRefPtr; | 113 typedef typename WTF::RemoveTemplate<TypeWithoutRefPtr, PassRefPtr>::Typ
e TypeWithoutPassRefPtr; |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 246 |
223 template<typename T> AllowAccessLaterWrapper<T> AllowAccessLater(T* value) | 247 template<typename T> AllowAccessLaterWrapper<T> AllowAccessLater(T* value) |
224 { | 248 { |
225 return AllowAccessLaterWrapper<T>(value); | 249 return AllowAccessLaterWrapper<T>(value); |
226 } | 250 } |
227 | 251 |
228 | 252 |
229 } // namespace blink | 253 } // namespace blink |
230 | 254 |
231 #endif // CrossThreadCopier_h | 255 #endif // CrossThreadCopier_h |
OLD | NEW |