Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: Source/wtf/PassOwnArrayPtr.h

Issue 20300002: Fix trailing whitespace in .cpp, .h, and .idl files (ex. Source/core) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/wtf/OwnPtrCommon.h ('k') | Source/wtf/PassOwnPtr.h » ('j') | 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 * Copyright (C) 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef WTF_PassOwnArrayPtr_h 26 #ifndef WTF_PassOwnArrayPtr_h
27 #define WTF_PassOwnArrayPtr_h 27 #define WTF_PassOwnArrayPtr_h
28 28
29 #include "wtf/Assertions.h" 29 #include "wtf/Assertions.h"
30 #include "wtf/NullPtr.h" 30 #include "wtf/NullPtr.h"
31 #include "wtf/TypeTraits.h" 31 #include "wtf/TypeTraits.h"
32 32
33 namespace WTF { 33 namespace WTF {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 mutable PtrType m_ptr; 76 mutable PtrType m_ptr;
77 }; 77 };
78 78
79 template<typename T> inline typename PassOwnArrayPtr<T>::PtrType PassOwnArrayPtr <T>::leakPtr() const 79 template<typename T> inline typename PassOwnArrayPtr<T>::PtrType PassOwnArrayPtr <T>::leakPtr() const
80 { 80 {
81 PtrType ptr = m_ptr; 81 PtrType ptr = m_ptr;
82 m_ptr = 0; 82 m_ptr = 0;
83 return ptr; 83 return ptr;
84 } 84 }
85 85
86 template<typename T, typename U> inline bool operator==(const PassOwnArrayPtr<T> & a, const PassOwnArrayPtr<U>& b) 86 template<typename T, typename U> inline bool operator==(const PassOwnArrayPtr<T> & a, const PassOwnArrayPtr<U>& b)
87 { 87 {
88 return a.get() == b.get(); 88 return a.get() == b.get();
89 } 89 }
90 90
91 template<typename T, typename U> inline bool operator==(const PassOwnArrayPtr<T> & a, const OwnArrayPtr<U>& b) 91 template<typename T, typename U> inline bool operator==(const PassOwnArrayPtr<T> & a, const OwnArrayPtr<U>& b)
92 { 92 {
93 return a.get() == b.get(); 93 return a.get() == b.get();
94 } 94 }
95 95
96 template<typename T, typename U> inline bool operator==(const OwnArrayPtr<T>& a, const PassOwnArrayPtr<U>& b) 96 template<typename T, typename U> inline bool operator==(const OwnArrayPtr<T>& a, const PassOwnArrayPtr<U>& b)
97 { 97 {
98 return a.get() == b.get(); 98 return a.get() == b.get();
99 } 99 }
100 100
101 template<typename T, typename U> inline bool operator==(const PassOwnArrayPtr<T> & a, U* b) 101 template<typename T, typename U> inline bool operator==(const PassOwnArrayPtr<T> & a, U* b)
102 { 102 {
103 return a.get() == b; 103 return a.get() == b;
104 } 104 }
105 105
106 template<typename T, typename U> inline bool operator==(T* a, const PassOwnArray Ptr<U>& b) 106 template<typename T, typename U> inline bool operator==(T* a, const PassOwnArray Ptr<U>& b)
107 { 107 {
108 return a == b.get(); 108 return a == b.get();
109 } 109 }
110 110
111 template<typename T, typename U> inline bool operator!=(const PassOwnArrayPtr<T> & a, const PassOwnArrayPtr<U>& b) 111 template<typename T, typename U> inline bool operator!=(const PassOwnArrayPtr<T> & a, const PassOwnArrayPtr<U>& b)
112 { 112 {
113 return a.get() != b.get(); 113 return a.get() != b.get();
114 } 114 }
115 115
116 template<typename T, typename U> inline bool operator!=(const PassOwnArrayPtr<T> & a, const OwnArrayPtr<U>& b) 116 template<typename T, typename U> inline bool operator!=(const PassOwnArrayPtr<T> & a, const OwnArrayPtr<U>& b)
117 { 117 {
118 return a.get() != b.get(); 118 return a.get() != b.get();
119 } 119 }
120 120
121 template<typename T, typename U> inline bool operator!=(const OwnArrayPtr<T>& a, const PassOwnArrayPtr<U>& b) 121 template<typename T, typename U> inline bool operator!=(const OwnArrayPtr<T>& a, const PassOwnArrayPtr<U>& b)
122 { 122 {
123 return a.get() != b.get(); 123 return a.get() != b.get();
124 } 124 }
125 125
126 template<typename T, typename U> inline bool operator!=(const PassOwnArrayPtr<T> & a, U* b) 126 template<typename T, typename U> inline bool operator!=(const PassOwnArrayPtr<T> & a, U* b)
127 { 127 {
128 return a.get() != b; 128 return a.get() != b;
129 } 129 }
130 130
131 template<typename T, typename U> inline bool operator!=(T* a, const PassOwnArray Ptr<U>& b) 131 template<typename T, typename U> inline bool operator!=(T* a, const PassOwnArray Ptr<U>& b)
132 { 132 {
133 return a != b.get(); 133 return a != b.get();
134 } 134 }
135 135
136 template<typename T> inline PassOwnArrayPtr<T> adoptArrayPtr(T* ptr) 136 template<typename T> inline PassOwnArrayPtr<T> adoptArrayPtr(T* ptr)
137 { 137 {
138 return PassOwnArrayPtr<T>(ptr); 138 return PassOwnArrayPtr<T>(ptr);
139 } 139 }
140 140
141 template<typename T> inline void deleteOwnedArrayPtr(T* ptr) 141 template<typename T> inline void deleteOwnedArrayPtr(T* ptr)
142 { 142 {
143 typedef char known[sizeof(T) ? 1 : -1]; 143 typedef char known[sizeof(T) ? 1 : -1];
144 if (sizeof(known)) 144 if (sizeof(known))
145 delete [] ptr; 145 delete [] ptr;
146 } 146 }
147 147
148 template<typename T, typename U> inline PassOwnArrayPtr<T> static_pointer_cast(c onst PassOwnArrayPtr<U>& p) 148 template<typename T, typename U> inline PassOwnArrayPtr<T> static_pointer_cast(c onst PassOwnArrayPtr<U>& p)
149 { 149 {
150 return adoptArrayPtr(static_cast<T*>(p.leakPtr())); 150 return adoptArrayPtr(static_cast<T*>(p.leakPtr()));
151 } 151 }
152 152
153 template<typename T, typename U> inline PassOwnArrayPtr<T> const_pointer_cast(co nst PassOwnArrayPtr<U>& p) 153 template<typename T, typename U> inline PassOwnArrayPtr<T> const_pointer_cast(co nst PassOwnArrayPtr<U>& p)
154 { 154 {
155 return adoptArrayPtr(const_cast<T*>(p.leakPtr())); 155 return adoptArrayPtr(const_cast<T*>(p.leakPtr()));
156 } 156 }
157 157
158 template<typename T> inline T* getPtr(const PassOwnArrayPtr<T>& p) 158 template<typename T> inline T* getPtr(const PassOwnArrayPtr<T>& p)
159 { 159 {
160 return p.get(); 160 return p.get();
161 } 161 }
162 162
163 } // namespace WTF 163 } // namespace WTF
164 164
165 using WTF::PassOwnArrayPtr; 165 using WTF::PassOwnArrayPtr;
166 using WTF::adoptArrayPtr; 166 using WTF::adoptArrayPtr;
167 using WTF::const_pointer_cast; 167 using WTF::const_pointer_cast;
168 using WTF::static_pointer_cast; 168 using WTF::static_pointer_cast;
169 169
170 #endif // WTF_PassOwnArrayPtr_h 170 #endif // WTF_PassOwnArrayPtr_h
OLDNEW
« no previous file with comments | « Source/wtf/OwnPtrCommon.h ('k') | Source/wtf/PassOwnPtr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698