| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 namespace WTF { | 46 namespace WTF { |
| 47 | 47 |
| 48 template<typename T> | 48 template<typename T> |
| 49 class RawPtr { | 49 class RawPtr { |
| 50 WTF_DISALLOW_CONSTRUCTION_FROM_ZERO(RawPtr); | 50 WTF_DISALLOW_CONSTRUCTION_FROM_ZERO(RawPtr); |
| 51 WTF_DISALLOW_ZERO_ASSIGNMENT(RawPtr); | 51 WTF_DISALLOW_ZERO_ASSIGNMENT(RawPtr); |
| 52 public: | 52 public: |
| 53 RawPtr() | 53 RawPtr() |
| 54 { | 54 { |
| 55 #ifndef NDEBUG | 55 #if ENABLE(ASSERT) |
| 56 m_ptr = reinterpret_cast<T*>(rawPtrZapValue); | 56 m_ptr = reinterpret_cast<T*>(rawPtrZapValue); |
| 57 #endif | 57 #endif |
| 58 } | 58 } |
| 59 RawPtr(std::nullptr_t) : m_ptr(0) { } | 59 RawPtr(std::nullptr_t) : m_ptr(0) { } |
| 60 RawPtr(T* ptr) : m_ptr(ptr) { } | 60 RawPtr(T* ptr) : m_ptr(ptr) { } |
| 61 explicit RawPtr(T& reference) : m_ptr(&reference) { } | 61 explicit RawPtr(T& reference) : m_ptr(&reference) { } |
| 62 RawPtr(const RawPtr& other) | 62 RawPtr(const RawPtr& other) |
| 63 : m_ptr(other.get()) | 63 : m_ptr(other.get()) |
| 64 { | 64 { |
| 65 } | 65 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 template<typename T> inline T* getPtr(const RawPtr<T>& p) | 135 template<typename T> inline T* getPtr(const RawPtr<T>& p) |
| 136 { | 136 { |
| 137 return p.get(); | 137 return p.get(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 } // namespace WTF | 140 } // namespace WTF |
| 141 | 141 |
| 142 using WTF::RawPtr; | 142 using WTF::RawPtr; |
| 143 | 143 |
| 144 #endif | 144 #endif |
| OLD | NEW |