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

Delta Between Two Patch Sets: compiled/intrusive_ptr.h

Issue 29385742: Issue 4127 - [emscripten] Convert subscription classes to C++ - Part 2 (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Left Patch Set: Created March 16, 2017, 6:27 p.m.
Right Patch Set: Rebased Created April 13, 2017, 1:01 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « compiled/filter/Filter.cpp ('k') | compiled/subscription/Subscription.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2017 eyeo GmbH
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */
17
1 // Parts of this code have been copied from boost/smart_ptr/intrusive_ptr.hpp. 18 // Parts of this code have been copied from boost/smart_ptr/intrusive_ptr.hpp.
2 // 19 //
3 // Copyright (c) 2001, 2002 Peter Dimov 20 // Copyright (c) 2001, 2002 Peter Dimov
4 // 21 //
5 // Distributed under the Boost Software License, Version 1.0. (See 22 // Distributed under the Boost Software License, Version 1.0. (See
6 // accompanying file LICENSE_1_0.txt or copy at 23 // accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt) 24 // http://www.boost.org/LICENSE_1_0.txt)
8 25
9 #pragma once 26 #pragma once
10 27
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 { 70 {
54 } 71 }
55 72
56 explicit intrusive_ptr(T* pointer, bool addRef = true) 73 explicit intrusive_ptr(T* pointer, bool addRef = true)
57 : mPointer(pointer) 74 : mPointer(pointer)
58 { 75 {
59 if (mPointer && addRef) 76 if (mPointer && addRef)
60 mPointer->AddRef(); 77 mPointer->AddRef();
61 } 78 }
62 79
63 explicit intrusive_ptr(const intrusive_ptr& other) 80 intrusive_ptr(const intrusive_ptr& other)
64 : mPointer(other.mPointer) 81 : mPointer(other.mPointer)
65 { 82 {
66 if (mPointer) 83 if (mPointer)
67 mPointer->AddRef(); 84 mPointer->AddRef();
68 } 85 }
69 86
70 explicit intrusive_ptr(intrusive_ptr&& other) 87 intrusive_ptr(intrusive_ptr&& other)
71 : mPointer(other.mPointer) 88 : mPointer(other.mPointer)
72 { 89 {
73 other.mPointer = nullptr; 90 other.mPointer = nullptr;
74 } 91 }
75 92
76 ~intrusive_ptr() 93 ~intrusive_ptr()
77 { 94 {
78 if (mPointer) 95 if (mPointer)
79 mPointer->ReleaseRef(); 96 mPointer->ReleaseRef();
80 } 97 }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 inline bool operator==(const T* a, const intrusive_ptr<U>& b) 208 inline bool operator==(const T* a, const intrusive_ptr<U>& b)
192 { 209 {
193 return a == b.get(); 210 return a == b.get();
194 } 211 }
195 212
196 template<typename T, typename U> 213 template<typename T, typename U>
197 inline bool operator!=(const T* a, intrusive_ptr<U> const& b) 214 inline bool operator!=(const T* a, intrusive_ptr<U> const& b)
198 { 215 {
199 return a != b.get(); 216 return a != b.get();
200 } 217 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld