| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef Nullable_h | 5 #ifndef Nullable_h |
| 6 #define Nullable_h | 6 #define Nullable_h |
| 7 | 7 |
| 8 #include "platform/heap/Handle.h" | 8 #include "platform/heap/Handle.h" |
| 9 #include "wtf/Assertions.h" | 9 #include "wtf/Assertions.h" |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 // See comment in RefPtr.h about what UnspecifiedBoolType is. | 45 // See comment in RefPtr.h about what UnspecifiedBoolType is. |
| 46 typedef const T* UnspecifiedBoolType; | 46 typedef const T* UnspecifiedBoolType; |
| 47 operator UnspecifiedBoolType() const { return m_isNull ? 0 : &m_value; } | 47 operator UnspecifiedBoolType() const { return m_isNull ? 0 : &m_value; } |
| 48 | 48 |
| 49 bool operator==(const Nullable& other) const | 49 bool operator==(const Nullable& other) const |
| 50 { | 50 { |
| 51 return (m_isNull && other.m_isNull) || (!m_isNull && !other.m_isNull &&
m_value == other.m_value); | 51 return (m_isNull && other.m_isNull) || (!m_isNull && !other.m_isNull &&
m_value == other.m_value); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void trace(Visitor* visitor) | |
| 55 { | |
| 56 TraceIfNeeded<T>::trace(visitor, &m_value); | |
| 57 } | |
| 58 | |
| 59 private: | 54 private: |
| 60 T m_value; | 55 T m_value; |
| 61 bool m_isNull; | 56 bool m_isNull; |
| 62 }; | 57 }; |
| 63 | 58 |
| 64 } // namespace blink | 59 } // namespace blink |
| 65 | 60 |
| 66 #endif // Nullable_h | 61 #endif // Nullable_h |
| OLD | NEW |