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