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

Side by Side Diff: mojo/public/cpp/system/handle.h

Issue 612243002: Mojo: NULL -> nullptr in mojo/public/cpp outside of bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « mojo/public/cpp/system/data_pipe.h ('k') | mojo/public/cpp/system/message_pipe.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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_PUBLIC_CPP_SYSTEM_HANDLE_H_ 5 #ifndef MOJO_PUBLIC_CPP_SYSTEM_HANDLE_H_
6 #define MOJO_PUBLIC_CPP_SYSTEM_HANDLE_H_ 6 #define MOJO_PUBLIC_CPP_SYSTEM_HANDLE_H_
7 7
8 #include <assert.h> 8 #include <assert.h>
9 #include <limits> 9 #include <limits>
10 10
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 template <class HandleVectorType, class FlagsVectorType> 207 template <class HandleVectorType, class FlagsVectorType>
208 inline MojoResult WaitMany(const HandleVectorType& handles, 208 inline MojoResult WaitMany(const HandleVectorType& handles,
209 const FlagsVectorType& signals, 209 const FlagsVectorType& signals,
210 MojoDeadline deadline) { 210 MojoDeadline deadline) {
211 if (signals.size() != handles.size()) 211 if (signals.size() != handles.size())
212 return MOJO_RESULT_INVALID_ARGUMENT; 212 return MOJO_RESULT_INVALID_ARGUMENT;
213 if (handles.size() > std::numeric_limits<uint32_t>::max()) 213 if (handles.size() > std::numeric_limits<uint32_t>::max())
214 return MOJO_RESULT_OUT_OF_RANGE; 214 return MOJO_RESULT_OUT_OF_RANGE;
215 215
216 if (handles.size() == 0) 216 if (handles.size() == 0)
217 return MojoWaitMany(NULL, NULL, 0, deadline); 217 return MojoWaitMany(nullptr, nullptr, 0, deadline);
218 218
219 const Handle& first_handle = handles[0]; 219 const Handle& first_handle = handles[0];
220 const MojoHandleSignals& first_signals = signals[0]; 220 const MojoHandleSignals& first_signals = signals[0];
221 return MojoWaitMany( 221 return MojoWaitMany(
222 reinterpret_cast<const MojoHandle*>(&first_handle), 222 reinterpret_cast<const MojoHandle*>(&first_handle),
223 reinterpret_cast<const MojoHandleSignals*>(&first_signals), 223 reinterpret_cast<const MojoHandleSignals*>(&first_signals),
224 static_cast<uint32_t>(handles.size()), 224 static_cast<uint32_t>(handles.size()),
225 deadline); 225 deadline);
226 } 226 }
227 227
228 // |Close()| takes ownership of the handle, since it'll invalidate it. 228 // |Close()| takes ownership of the handle, since it'll invalidate it.
229 // Note: There's nothing to do, since the argument will be destroyed when it 229 // Note: There's nothing to do, since the argument will be destroyed when it
230 // goes out of scope. 230 // goes out of scope.
231 template <class HandleType> 231 template <class HandleType>
232 inline void Close(ScopedHandleBase<HandleType> /*handle*/) {} 232 inline void Close(ScopedHandleBase<HandleType> /*handle*/) {}
233 233
234 // Most users should typically use |Close()| (above) instead. 234 // Most users should typically use |Close()| (above) instead.
235 inline MojoResult CloseRaw(Handle handle) { 235 inline MojoResult CloseRaw(Handle handle) {
236 return MojoClose(handle.value()); 236 return MojoClose(handle.value());
237 } 237 }
238 238
239 // Strict weak ordering, so that |Handle|s can be used as keys in |std::map|s, 239 // Strict weak ordering, so that |Handle|s can be used as keys in |std::map|s,
240 inline bool operator<(const Handle a, const Handle b) { 240 inline bool operator<(const Handle a, const Handle b) {
241 return a.value() < b.value(); 241 return a.value() < b.value();
242 } 242 }
243 243
244 } // namespace mojo 244 } // namespace mojo
245 245
246 #endif // MOJO_PUBLIC_CPP_SYSTEM_HANDLE_H_ 246 #endif // MOJO_PUBLIC_CPP_SYSTEM_HANDLE_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/system/data_pipe.h ('k') | mojo/public/cpp/system/message_pipe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698