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

Side by Side Diff: compiled/intrusive_ptr.h

Issue 29549903: Issue 5664 - assert now accept one parameter. (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Used the wrong preprocessor operation for assert() Created Sept. 20, 2017, 2:15 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
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 22 matching lines...) Expand all
33 class ref_counted 33 class ref_counted
34 { 34 {
35 public: 35 public:
36 void AddRef() 36 void AddRef()
37 { 37 {
38 mRefCount++; 38 mRefCount++;
39 } 39 }
40 40
41 void ReleaseRef() 41 void ReleaseRef()
42 { 42 {
43 assert(mRefCount > 0, u"Unexpected zero or negative reference count"_str); 43 assert2(mRefCount > 0, u"Unexpected zero or negative reference count"_str);
44 if (--mRefCount == 0) 44 if (--mRefCount == 0)
45 delete this; 45 delete this;
46 } 46 }
47 47
48 protected: 48 protected:
49 ref_counted() 49 ref_counted()
50 : mRefCount(1) 50 : mRefCount(1)
51 { 51 {
52 } 52 }
53 53
54 virtual ~ref_counted() 54 virtual ~ref_counted()
55 { 55 {
56 assert(mRefCount == 0, u"Destroying a ref-counted object with a non-zero ref erence count"_str); 56 assert2(mRefCount == 0, u"Destroying a ref-counted object with a non-zero re ference count"_str);
57 } 57 }
58 58
59 private: 59 private:
60 int mRefCount; 60 int mRefCount;
61 }; 61 };
62 62
63 template<typename T, 63 template<typename T,
64 class = typename std::enable_if<std::is_base_of<ref_counted,T>::value>::type > 64 class = typename std::enable_if<std::is_base_of<ref_counted,T>::value>::type >
65 class intrusive_ptr 65 class intrusive_ptr
66 { 66 {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 inline bool operator==(const T* a, const intrusive_ptr<U>& b) 208 inline bool operator==(const T* a, const intrusive_ptr<U>& b)
209 { 209 {
210 return a == b.get(); 210 return a == b.get();
211 } 211 }
212 212
213 template<typename T, typename U> 213 template<typename T, typename U>
214 inline bool operator!=(const T* a, intrusive_ptr<U> const& b) 214 inline bool operator!=(const T* a, intrusive_ptr<U> const& b)
215 { 215 {
216 return a != b.get(); 216 return a != b.get();
217 } 217 }
OLDNEW
« compiled/debug.h ('K') | « compiled/debug.h ('k') | compiled/storage/FilterStorage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld