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

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

Issue 1773403006: [mojo-sdk] Replace assert() usage in bindings with DCHECK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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>
9 #include <stdint.h> 8 #include <stdint.h>
10 #include <limits> 9 #include <limits>
11 10
12 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/logging.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/move.h" 14 #include "base/move.h"
15 #include "mojo/public/c/system/functions.h" 15 #include "mojo/public/c/system/functions.h"
16 #include "mojo/public/c/system/types.h" 16 #include "mojo/public/c/system/types.h"
17 #include "mojo/public/cpp/system/macros.h" 17 #include "mojo/public/cpp/system/macros.h"
18 18
19 namespace mojo { 19 namespace mojo {
20 20
21 // OVERVIEW 21 // OVERVIEW
22 // 22 //
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 } 120 }
121 121
122 bool is_valid() const { return handle_.is_valid(); } 122 bool is_valid() const { return handle_.is_valid(); }
123 123
124 private: 124 private:
125 void CloseIfNecessary() { 125 void CloseIfNecessary() {
126 if (!handle_.is_valid()) 126 if (!handle_.is_valid())
127 return; 127 return;
128 MojoResult result = MojoClose(handle_.value()); 128 MojoResult result = MojoClose(handle_.value());
129 ALLOW_UNUSED_LOCAL(result); 129 ALLOW_UNUSED_LOCAL(result);
130 assert(result == MOJO_RESULT_OK); 130 DCHECK_EQ(MOJO_RESULT_OK, result);
131 } 131 }
132 132
133 HandleType handle_; 133 HandleType handle_;
134 }; 134 };
135 135
136 template <typename HandleType> 136 template <typename HandleType>
137 inline ScopedHandleBase<HandleType> MakeScopedHandle(HandleType handle) { 137 inline ScopedHandleBase<HandleType> MakeScopedHandle(HandleType handle) {
138 return ScopedHandleBase<HandleType>(handle); 138 return ScopedHandleBase<HandleType>(handle);
139 } 139 }
140 140
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 } 290 }
291 291
292 // Comparison, so that |Handle|s can be used as keys in hash maps. 292 // Comparison, so that |Handle|s can be used as keys in hash maps.
293 inline bool operator==(const Handle a, const Handle b) { 293 inline bool operator==(const Handle a, const Handle b) {
294 return a.value() == b.value(); 294 return a.value() == b.value();
295 } 295 }
296 296
297 } // namespace mojo 297 } // namespace mojo
298 298
299 #endif // MOJO_PUBLIC_CPP_SYSTEM_HANDLE_H_ 299 #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