Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(946)

Side by Side Diff: Source/wtf/RawPtr.h

Issue 148523016: Move most of the [Pass]RefPtr's of CSSPrimitiveValue to our transition types. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« Source/heap/Handle.h ('K') | « Source/heap/Handle.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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() const { return m_ptr; } 58 RawPtr<T> release()
59 {
60 RawPtr<T> tmp = m_ptr;
61 m_ptr = 0;
haraken 2014/02/12 14:05:45 Nice catch!
62 return tmp;
63 }
59 T* leakRef() 64 T* leakRef()
60 { 65 {
61 T* ptr = m_ptr; 66 T* ptr = m_ptr;
62 m_ptr = 0; 67 m_ptr = 0;
63 return ptr; 68 return ptr;
64 } 69 }
65 70
66 RawPtr& operator=(T* ptr) 71 RawPtr& operator=(T* ptr)
67 { 72 {
68 m_ptr = ptr; 73 m_ptr = ptr;
69 return *this; 74 return *this;
70 } 75 }
71 76
72 operator T*() const { return m_ptr; } 77 operator T*() const { return m_ptr; }
73 T& operator*() const { return *m_ptr; } 78 T& operator*() const { return *m_ptr; }
74 T* operator->() const { return m_ptr; } 79 T* operator->() const { return m_ptr; }
75 80
76 private: 81 private:
77 T* m_ptr; 82 T* m_ptr;
78 }; 83 };
79 84
80 } // namespace WTF 85 } // namespace WTF
81 86
82 using WTF::RawPtr; 87 using WTF::RawPtr;
83 88
84 #endif 89 #endif
OLDNEW
« Source/heap/Handle.h ('K') | « Source/heap/Handle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698