Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 // etc. | 240 // etc. |
| 241 #ifdef __native_client__ | |
| 242 // Passing the operands by reference confuses the STL implementation in NaCl's | |
|
viettrungluu
2014/08/20 19:52:38
Probably we can just make it take |Handle|s by val
Nick Bray (chromium)
2014/09/03 23:45:03
Done. The only quirk would be if Handle got a des
| |
| 243 // GCC toolchain and results in specialized templates that break strict aliasing | |
|
Mark Seaborn
2014/08/26 16:25:54
I don't think we build with -fstrict-aliasing thou
Nick Bray (chromium)
2014/09/03 23:45:03
No bug filed because NaCl GCC is old and awful, an
| |
| 244 // rules. | |
| 245 // TODO(ncbray): unhack this. | |
| 246 inline bool operator<(const Handle a, const Handle b) { | |
| 247 #else | |
| 241 inline bool operator<(const Handle& a, const Handle& b) { | 248 inline bool operator<(const Handle& a, const Handle& b) { |
| 249 #endif | |
| 242 return a.value() < b.value(); | 250 return a.value() < b.value(); |
| 243 } | 251 } |
| 244 | 252 |
| 245 } // namespace mojo | 253 } // namespace mojo |
| 246 | 254 |
| 247 #endif // MOJO_PUBLIC_CPP_SYSTEM_HANDLE_H_ | 255 #endif // MOJO_PUBLIC_CPP_SYSTEM_HANDLE_H_ |
| OLD | NEW |