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

Delta Between Two Patch Sets: compiled/intrusive_ptr.h

Issue 29333474: Issue 4125 - [emscripten] Convert filter classes to C++ (Closed)
Left Patch Set: Properly determine ref_counted offset instead of assuming that it is zero Created March 14, 2017, 10:18 a.m.
Right Patch Set: Addressed comments from Patch Set 28 Created March 21, 2017, 10:04 a.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/debug.h ('k') | compiled/shell.js » ('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 // Parts of this code have been copied from boost/smart_ptr/intrusive_ptr.hpp. 1 // Parts of this code have been copied from boost/smart_ptr/intrusive_ptr.hpp.
2 // 2 //
3 // Copyright (c) 2001, 2002 Peter Dimov 3 // Copyright (c) 2001, 2002 Peter Dimov
4 // 4 //
5 // Distributed under the Boost Software License, Version 1.0. (See 5 // Distributed under the Boost Software License, Version 1.0. (See
6 // accompanying file LICENSE_1_0.txt or copy at 6 // accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt) 7 // http://www.boost.org/LICENSE_1_0.txt)
8 8
9 #pragma once 9 #pragma once
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 { 53 {
54 } 54 }
55 55
56 explicit intrusive_ptr(T* pointer) 56 explicit intrusive_ptr(T* pointer)
57 : mPointer(pointer) 57 : mPointer(pointer)
58 { 58 {
59 // Raw pointers always had their reference count increased by whatever gave 59 // Raw pointers always had their reference count increased by whatever gave
60 // us the pointer so we don't need to do it here. 60 // us the pointer so we don't need to do it here.
61 } 61 }
62 62
63 explicit intrusive_ptr(const intrusive_ptr& other) 63 intrusive_ptr(const intrusive_ptr& other)
sergei 2017/03/20 17:07:20 I think that copy and move constructors should not
Wladimir Palant 2017/03/21 10:10:17 Done.
64 : mPointer(other.mPointer) 64 : mPointer(other.mPointer)
65 { 65 {
66 if (mPointer) 66 if (mPointer)
67 mPointer->AddRef(); 67 mPointer->AddRef();
68 } 68 }
69 69
70 explicit intrusive_ptr(intrusive_ptr&& other) 70 intrusive_ptr(intrusive_ptr&& other)
71 : mPointer(other.mPointer) 71 : mPointer(other.mPointer)
72 { 72 {
73 other.mPointer = nullptr; 73 other.mPointer = nullptr;
74 } 74 }
75 75
76 ~intrusive_ptr() 76 ~intrusive_ptr()
77 { 77 {
78 if (mPointer) 78 if (mPointer)
79 mPointer->ReleaseRef(); 79 mPointer->ReleaseRef();
80 } 80 }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 inline bool operator==(const T* a, const intrusive_ptr<U>& b) 191 inline bool operator==(const T* a, const intrusive_ptr<U>& b)
192 { 192 {
193 return a == b.get(); 193 return a == b.get();
194 } 194 }
195 195
196 template<typename T, typename U> 196 template<typename T, typename U>
197 inline bool operator!=(const T* a, intrusive_ptr<U> const& b) 197 inline bool operator!=(const T* a, intrusive_ptr<U> const& b)
198 { 198 {
199 return a != b.get(); 199 return a != b.get();
200 } 200 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld