| OLD | NEW | 
|---|
| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 57 | 57 | 
| 58   virtual ~ref_counted() | 58   virtual ~ref_counted() | 
| 59   { | 59   { | 
| 60     assert2(mRefCount == 0, u"Destroying a ref-counted object with a non-zero re
     ference count"_str); | 60     assert2(mRefCount == 0, u"Destroying a ref-counted object with a non-zero re
     ference count"_str); | 
| 61   } | 61   } | 
| 62 | 62 | 
| 63 private: | 63 private: | 
| 64   int mRefCount; | 64   int mRefCount; | 
| 65 }; | 65 }; | 
| 66 | 66 | 
| 67 template<typename T, | 67 template<typename T> | 
| 68     class = typename std::enable_if<std::is_base_of<ref_counted,T>::value>::type
     > |  | 
| 69 class intrusive_ptr | 68 class intrusive_ptr | 
| 70 { | 69 { | 
|  | 70   static_assert(std::is_base_of<ref_counted, T>::value, "The class T should inhe
     rit ref_counted"); | 
| 71 public: | 71 public: | 
| 72   explicit intrusive_ptr() | 72   explicit intrusive_ptr() | 
| 73       : mPointer(nullptr) | 73       : mPointer(nullptr) | 
| 74   { | 74   { | 
| 75   } | 75   } | 
| 76 | 76 | 
| 77   explicit intrusive_ptr(T* pointer, bool addRef = true) | 77   explicit intrusive_ptr(T* pointer, bool addRef = true) | 
| 78       : mPointer(pointer) | 78       : mPointer(pointer) | 
| 79   { | 79   { | 
| 80     if (mPointer && addRef) | 80     if (mPointer && addRef) | 
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 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 | 
| OLD | NEW | 
|---|