| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 RawPtr(T* ptr) : m_ptr(ptr) { } | 46 RawPtr(T* ptr) : m_ptr(ptr) { } |
| 47 | 47 |
| 48 template<typename U> | 48 template<typename U> |
| 49 RawPtr(const RawPtr<U>& other) | 49 RawPtr(const RawPtr<U>& other) |
| 50 : m_ptr(other.get()) | 50 : m_ptr(other.get()) |
| 51 { | 51 { |
| 52 } | 52 } |
| 53 | 53 |
| 54 T* get() const { return m_ptr; } | 54 T* get() const { return m_ptr; } |
| 55 // FIXME: oilpan: Remove this once we remove RefPtrWillBeRawPtr. | 55 // FIXME: oilpan: Remove this once we remove RefPtrWillBeRawPtr. |
| 56 T* release() const { return m_ptr; } | 56 RawPtr<T> release() const { return *this; } |
| 57 void clear() { m_ptr = 0; } | 57 void clear() { m_ptr = 0; } |
| 58 | 58 |
| 59 RawPtr& operator=(T* ptr) | 59 RawPtr& operator=(T* ptr) |
| 60 { | 60 { |
| 61 m_ptr = ptr; | 61 m_ptr = ptr; |
| 62 return *this; | 62 return *this; |
| 63 } | 63 } |
| 64 | 64 |
| 65 RawPtr& operator=(const RawPtr<T>& ptr) | 65 RawPtr& operator=(const RawPtr<T>& ptr) |
| 66 { | 66 { |
| 67 m_ptr = ptr.get(); | 67 m_ptr = ptr.get(); |
| 68 return *this; | 68 return *this; |
| 69 } | 69 } |
| 70 | 70 |
| 71 operator T*() const { return m_ptr; } | 71 operator T*() const { return m_ptr; } |
| 72 T& operator*() const { return *m_ptr; } | 72 T& operator*() const { return *m_ptr; } |
| 73 T* operator->() const { return m_ptr; } | 73 T* operator->() const { return m_ptr; } |
| 74 | 74 |
| 75 private: | 75 private: |
| 76 T* m_ptr; | 76 T* m_ptr; |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 } // namespace WTF | 79 } // namespace WTF |
| 80 | 80 |
| 81 using WTF::RawPtr; | 81 using WTF::RawPtr; |
| 82 | 82 |
| 83 #endif | 83 #endif |
| OLD | NEW |