| 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 14 matching lines...) Expand all Loading... |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef WebPrivatePtr_h | 31 #ifndef WebPrivatePtr_h |
| 32 #define WebPrivatePtr_h | 32 #define WebPrivatePtr_h |
| 33 | 33 |
| 34 #include "WebCommon.h" | 34 #include "WebCommon.h" |
| 35 #include "base/logging.h" |
| 35 | 36 |
| 36 #if INSIDE_BLINK | 37 #if INSIDE_BLINK |
| 37 #include "platform/heap/Handle.h" | 38 #include "platform/heap/Handle.h" |
| 38 #include "wtf/PassRefPtr.h" | 39 #include "wtf/PassRefPtr.h" |
| 39 #include "wtf/TypeTraits.h" | 40 #include "wtf/TypeTraits.h" |
| 40 #endif | 41 #endif |
| 41 | 42 |
| 42 namespace WTF { | 43 namespace WTF { |
| 43 template<class T> class ThreadSafeRefCounted; | 44 template<class T> class ThreadSafeRefCounted; |
| 44 } | 45 } |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 template <typename T, WebPrivatePtrDestruction crossThreadDestruction = WebPriva
tePtrDestructionSameThread, WebPrivatePtrStrength strongOrWeak = WebPrivatePtrSt
rength::Normal> | 242 template <typename T, WebPrivatePtrDestruction crossThreadDestruction = WebPriva
tePtrDestructionSameThread, WebPrivatePtrStrength strongOrWeak = WebPrivatePtrSt
rength::Normal> |
| 242 class WebPrivatePtr { | 243 class WebPrivatePtr { |
| 243 public: | 244 public: |
| 244 WebPrivatePtr() : m_storage(0) { } | 245 WebPrivatePtr() : m_storage(0) { } |
| 245 ~WebPrivatePtr() | 246 ~WebPrivatePtr() |
| 246 { | 247 { |
| 247 // We don't destruct the object pointed by m_ptr here because we don't | 248 // We don't destruct the object pointed by m_ptr here because we don't |
| 248 // want to expose destructors of core classes to embedders. We should | 249 // want to expose destructors of core classes to embedders. We should |
| 249 // call reset() manually in destructors of classes with WebPrivatePtr | 250 // call reset() manually in destructors of classes with WebPrivatePtr |
| 250 // members. | 251 // members. |
| 251 BLINK_ASSERT(!m_storage); | 252 DCHECK(!m_storage); |
| 252 } | 253 } |
| 253 | 254 |
| 254 bool isNull() const { return !m_storage; } | 255 bool isNull() const { return !m_storage; } |
| 255 | 256 |
| 256 #if INSIDE_BLINK | 257 #if INSIDE_BLINK |
| 257 template<typename U> | 258 template<typename U> |
| 258 WebPrivatePtr(const U& ptr) | 259 WebPrivatePtr(const U& ptr) |
| 259 : m_storage(0) | 260 : m_storage(0) |
| 260 { | 261 { |
| 261 storage().assign(ptr); | 262 storage().assign(ptr); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 // Disable the copy constructor; classes that contain a WebPrivatePtr | 308 // Disable the copy constructor; classes that contain a WebPrivatePtr |
| 308 // should implement their copy constructor using assign(). | 309 // should implement their copy constructor using assign(). |
| 309 WebPrivatePtr(const WebPrivatePtr&); | 310 WebPrivatePtr(const WebPrivatePtr&); |
| 310 | 311 |
| 311 void* m_storage; | 312 void* m_storage; |
| 312 }; | 313 }; |
| 313 | 314 |
| 314 } // namespace blink | 315 } // namespace blink |
| 315 | 316 |
| 316 #endif // WebPrivatePtr_h | 317 #endif // WebPrivatePtr_h |
| OLD | NEW |