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

Side by Side Diff: mojo/public/system/core.h

Issue 23913008: C++ bindings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix windows build error. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « mojo/public/bindings/sample/sample_test.cc ('k') | mojo/public/system/macros.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_SYSTEM_CORE_H_ 5 #ifndef MOJO_PUBLIC_SYSTEM_CORE_H_
6 #define MOJO_PUBLIC_SYSTEM_CORE_H_ 6 #define MOJO_PUBLIC_SYSTEM_CORE_H_
7 7
8 // Note: This header should be compilable as C. 8 // Note: This header should be compilable as C.
9 9
10 #include <stdint.h> 10 #include <stdint.h>
11 11
12 #include "mojo/public/system/macros.h"
12 #include "mojo/public/system/system_export.h" 13 #include "mojo/public/system/system_export.h"
13 14
14 // Types ----------------------------------------------------------------------- 15 // Types -----------------------------------------------------------------------
15 16
16 // TODO(vtl): Notes: Use of undefined flags will lead to undefined behavior 17 // TODO(vtl): Notes: Use of undefined flags will lead to undefined behavior
17 // (typically they'll be ignored), not necessarily an error. 18 // (typically they'll be ignored), not necessarily an error.
18 19
19 // Handles to Mojo objects. 20 // Handles to Mojo objects.
20 typedef uint32_t MojoHandle; 21 typedef uint32_t MojoHandle;
21 22
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 #ifdef __cplusplus 253 #ifdef __cplusplus
253 } // extern "C" 254 } // extern "C"
254 #endif 255 #endif
255 256
256 // C++ wrapper functions ------------------------------------------------------- 257 // C++ wrapper functions -------------------------------------------------------
257 258
258 #ifdef __cplusplus 259 #ifdef __cplusplus
259 260
260 namespace mojo { 261 namespace mojo {
261 262
262 // Used to assert things at compile time. (Use our own copy instead of
263 // Chromium's, since we can't depend on Chromium.)
264 template <bool> struct CompileAssert {};
265 #define MOJO_COMPILE_ASSERT(expr, msg) \
266 typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
267
268 struct Handle { MojoHandle value; }; 263 struct Handle { MojoHandle value; };
269 264
270 const Handle kInvalidHandle = { MOJO_HANDLE_INVALID }; 265 const Handle kInvalidHandle = { MOJO_HANDLE_INVALID };
271 266
272 // A |mojo::Handle| must take no extra space, since we'll treat arrays of them 267 // A |mojo::Handle| must take no extra space, since we'll treat arrays of them
273 // as if they were arrays of |MojoHandle|s. 268 // as if they were arrays of |MojoHandle|s.
274 MOJO_COMPILE_ASSERT(sizeof(Handle) == sizeof(MojoHandle), 269 MOJO_COMPILE_ASSERT(sizeof(Handle) == sizeof(MojoHandle),
275 bad_size_for_cplusplus_handle); 270 bad_size_for_cplusplus_handle);
276 271
277 inline MojoResult Close(Handle handle) { 272 inline MojoResult Close(Handle handle) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 return MojoReadMessage(handle.value, 307 return MojoReadMessage(handle.value,
313 bytes, num_bytes, 308 bytes, num_bytes,
314 &handles[0].value, num_handles, 309 &handles[0].value, num_handles,
315 flags); 310 flags);
316 } 311 }
317 312
318 } // namespace mojo 313 } // namespace mojo
319 #endif 314 #endif
320 315
321 #endif // MOJO_PUBLIC_SYSTEM_CORE_H_ 316 #endif // MOJO_PUBLIC_SYSTEM_CORE_H_
OLDNEW
« no previous file with comments | « mojo/public/bindings/sample/sample_test.cc ('k') | mojo/public/system/macros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698