OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 | 46 |
47 #if INSIDE_BLINK | 47 #if INSIDE_BLINK |
48 enum LifetimeManagementType { | 48 enum LifetimeManagementType { |
49 RefCountedLifetime, | 49 RefCountedLifetime, |
50 GarbageCollectedLifetime, | 50 GarbageCollectedLifetime, |
51 RefCountedGarbageCollectedLifetime | 51 RefCountedGarbageCollectedLifetime |
52 }; | 52 }; |
53 | 53 |
54 template<typename T> | 54 template<typename T> |
55 class LifetimeOf { | 55 class LifetimeOf { |
56 typedef char TreeSharedType; | |
Mads Ager (chromium)
2014/05/08 07:27:36
Thanks! I should have removed this when I removed
| |
57 typedef struct { | |
58 char padding[8]; | |
59 } NotTreeSharedType; | |
60 | |
61 template<typename U> static TreeSharedType checkTreeShared(WebCore::TreeShar ed<U>*); | |
62 static NotTreeSharedType checkTreeShared(...); | |
63 | |
64 static const bool isGarbageCollected = WTF::IsSubclassOfTemplate<T, WebCore: :GarbageCollected>::value; | 56 static const bool isGarbageCollected = WTF::IsSubclassOfTemplate<T, WebCore: :GarbageCollected>::value; |
65 static const bool isRefCountedGarbageCollected = WTF::IsSubclassOfTemplate<T , WebCore::RefCountedGarbageCollected>::value; | 57 static const bool isRefCountedGarbageCollected = WTF::IsSubclassOfTemplate<T , WebCore::RefCountedGarbageCollected>::value; |
66 public: | 58 public: |
67 static const LifetimeManagementType value = | 59 static const LifetimeManagementType value = |
68 sizeof(checkTreeShared(static_cast<T*>(0))) == sizeof(TreeSharedType) ? RefCountedLifetime : | |
69 !isGarbageCollected ? RefCountedLifetime : | 60 !isGarbageCollected ? RefCountedLifetime : |
70 isRefCountedGarbageCollected ? RefCountedGarbageCollectedLifetime : Garb ageCollectedLifetime; | 61 isRefCountedGarbageCollected ? RefCountedGarbageCollectedLifetime : Garb ageCollectedLifetime; |
71 }; | 62 }; |
72 | 63 |
73 template<typename T, LifetimeManagementType lifetime> | 64 template<typename T, LifetimeManagementType lifetime> |
74 class PtrStorageImpl; | 65 class PtrStorageImpl; |
75 | 66 |
76 template<typename T> | 67 template<typename T> |
77 class PtrStorageImpl<T, RefCountedLifetime> { | 68 class PtrStorageImpl<T, RefCountedLifetime> { |
78 public: | 69 public: |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
274 // Disable the copy constructor; classes that contain a WebPrivatePtr | 265 // Disable the copy constructor; classes that contain a WebPrivatePtr |
275 // should implement their copy constructor using assign(). | 266 // should implement their copy constructor using assign(). |
276 WebPrivatePtr(const WebPrivatePtr<T>&); | 267 WebPrivatePtr(const WebPrivatePtr<T>&); |
277 | 268 |
278 void* m_storage; | 269 void* m_storage; |
279 }; | 270 }; |
280 | 271 |
281 } // namespace blink | 272 } // namespace blink |
282 | 273 |
283 #endif | 274 #endif |
OLD | NEW |