Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: compiled/intrusive_ptr.h

Issue 29713591: Noissue - add `addRef = true` argument to `intrusive_ptr::reset` (Closed) Base URL: github.com:adblockplus/adblockpluscore
Patch Set: Created March 2, 2018, 3:40 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | 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 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 { 118 {
119 intrusive_ptr(other).swap(*this); 119 intrusive_ptr(other).swap(*this);
120 return *this; 120 return *this;
121 } 121 }
122 122
123 void reset() 123 void reset()
124 { 124 {
125 intrusive_ptr().swap(*this); 125 intrusive_ptr().swap(*this);
126 } 126 }
127 127
128 void reset(T* other) 128 void reset(T* other, bool addRef = true)
129 { 129 {
130 intrusive_ptr(other).swap(*this); 130 intrusive_ptr(other, addRef).swap(*this);
131 } 131 }
132 132
133 const T* get() const 133 const T* get() const
134 { 134 {
135 return mPointer; 135 return mPointer;
136 } 136 }
137 137
138 T* get() 138 T* get()
139 { 139 {
140 return mPointer; 140 return mPointer;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 return a == b.get(); 216 return a == b.get();
217 } 217 }
218 218
219 template<typename T, typename U> 219 template<typename T, typename U>
220 inline bool operator!=(const T* a, intrusive_ptr<U> const& b) 220 inline bool operator!=(const T* a, intrusive_ptr<U> const& b)
221 { 221 {
222 return a != b.get(); 222 return a != b.get();
223 } 223 }
224 224
225 ABP_NS_END 225 ABP_NS_END
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld