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

Side by Side Diff: mojo/public/c/include/mojo/bindings/internal/util.h

Issue 2250183003: Make the fuchsia mojo/public repo the source of truth. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 4 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
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MOJO_PUBLIC_C_INCLUDE_MOJO_BINDINGS_INTERNAL_UTIL_H_
6 #define MOJO_PUBLIC_C_INCLUDE_MOJO_BINDINGS_INTERNAL_UTIL_H_
7
8 #include <mojo/macros.h>
9 #include <stdint.h>
10
11 // Rounds-up |num| to 8. The result is undefined if this results in an overflow.
12 #define MOJOM_INTERNAL_ROUND_TO_8(num) (((num) + 7) & ~7)
13
14 // Represents the memory layout of a mojom pointer; it is a |ptr| (pointer to
15 // some memory) when unencoded, and refers to a relative |offset| when encoded.
16 union MojomPointer {
17 void* ptr;
18 uint64_t offset;
19 };
20 MOJO_STATIC_ASSERT(sizeof(union MojomPointer) == 8,
21 "union MojomPointer must be 8 bytes");
22
23 // This struct represents the state we need to keep when validating an encoded
24 // mojom type.
25 struct MojomValidationContext {
26 // |next_handle_index| is a counter that represents the next-available index
27 // into the handle array. Previous indices have already been used up. This
28 // counter is non-decreasing as it is used throughout validation.
29 uint32_t next_handle_index;
30
31 // As we validate, we keep track of the point where pointers can point to,
32 // since two pointers may not point to the same memory region.
33 char* next_pointer;
34
35 // TODO(vardhan): Include an error string? How big should it be?
36 };
37
38 #endif // MOJO_PUBLIC_C_INCLUDE_MOJO_BINDINGS_INTERNAL_UTIL_H_
OLDNEW
« no previous file with comments | « mojo/public/c/include/mojo/bindings/internal/type_descriptor.h ('k') | mojo/public/c/include/mojo/bindings/map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698