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

Side by Side Diff: mojo/public/c/system/data_pipe.h

Issue 2725133002: Mojo: Armed Watchers (Closed)
Patch Set: . Created 3 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
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 // This file contains types/constants and functions specific to data pipes. 5 // This file contains types/constants and functions specific to data pipes.
6 // 6 //
7 // Note: This header should be compilable as C. 7 // Note: This header should be compilable as C.
8 8
9 #ifndef MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_ 9 #ifndef MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_
10 #define MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_ 10 #define MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 MOJO_ALIGNAS(4) uint32_t capacity_num_bytes; 49 MOJO_ALIGNAS(4) uint32_t capacity_num_bytes;
50 }; 50 };
51 MOJO_STATIC_ASSERT(sizeof(MojoCreateDataPipeOptions) == 16, 51 MOJO_STATIC_ASSERT(sizeof(MojoCreateDataPipeOptions) == 16,
52 "MojoCreateDataPipeOptions has wrong size"); 52 "MojoCreateDataPipeOptions has wrong size");
53 53
54 // |MojoWriteDataFlags|: Used to specify different modes to |MojoWriteData()| 54 // |MojoWriteDataFlags|: Used to specify different modes to |MojoWriteData()|
55 // and |MojoBeginWriteData()|. 55 // and |MojoBeginWriteData()|.
56 // |MOJO_WRITE_DATA_FLAG_NONE| - No flags; default mode. 56 // |MOJO_WRITE_DATA_FLAG_NONE| - No flags; default mode.
57 // |MOJO_WRITE_DATA_FLAG_ALL_OR_NONE| - Write either all the elements 57 // |MOJO_WRITE_DATA_FLAG_ALL_OR_NONE| - Write either all the elements
58 // requested or none of them. 58 // requested or none of them.
59 // |MOJO_WRITE_DATA_FLAG_CLEAR_SIGNAL| - If writing fails due to a lack of
60 // available capacity, clear the |MOJO_HANDLE_SIGNAL_WRITABLE| signal
61 // until more capacity becomes available.
59 62
60 typedef uint32_t MojoWriteDataFlags; 63 typedef uint32_t MojoWriteDataFlags;
61 64
62 #ifdef __cplusplus 65 #ifdef __cplusplus
63 const MojoWriteDataFlags MOJO_WRITE_DATA_FLAG_NONE = 0; 66 const MojoWriteDataFlags MOJO_WRITE_DATA_FLAG_NONE = 0;
64 const MojoWriteDataFlags MOJO_WRITE_DATA_FLAG_ALL_OR_NONE = 1 << 0; 67 const MojoWriteDataFlags MOJO_WRITE_DATA_FLAG_ALL_OR_NONE = 1 << 0;
68 const MojoWriteDataFlags MOJO_WRITE_DATA_FLAG_CLEAR_SIGNAL = 1 << 1;
65 #else 69 #else
66 #define MOJO_WRITE_DATA_FLAG_NONE ((MojoWriteDataFlags)0) 70 #define MOJO_WRITE_DATA_FLAG_NONE ((MojoWriteDataFlags)0)
67 #define MOJO_WRITE_DATA_FLAG_ALL_OR_NONE ((MojoWriteDataFlags)1 << 0) 71 #define MOJO_WRITE_DATA_FLAG_ALL_OR_NONE ((MojoWriteDataFlags)1 << 0)
72 #define MOJO_WRITE_DATA_FLAG_CLEAR_SIGNAL ((MojoWriteDataFlags)1 << 1)
68 #endif 73 #endif
69 74
70 // |MojoReadDataFlags|: Used to specify different modes to |MojoReadData()| and 75 // |MojoReadDataFlags|: Used to specify different modes to |MojoReadData()| and
71 // |MojoBeginReadData()|. 76 // |MojoBeginReadData()|.
72 // |MOJO_READ_DATA_FLAG_NONE| - No flags; default mode. 77 // |MOJO_READ_DATA_FLAG_NONE| - No flags; default mode.
73 // |MOJO_READ_DATA_FLAG_ALL_OR_NONE| - Read (or discard) either the requested 78 // |MOJO_READ_DATA_FLAG_ALL_OR_NONE| - Read (or discard) either the requested
74 // number of elements or none. 79 // number of elements or none.
75 // |MOJO_READ_DATA_FLAG_DISCARD| - Discard (up to) the requested number of 80 // |MOJO_READ_DATA_FLAG_DISCARD| - Discard (up to) the requested number of
76 // elements. 81 // elements.
77 // |MOJO_READ_DATA_FLAG_QUERY| - Query the number of elements available to 82 // |MOJO_READ_DATA_FLAG_QUERY| - Query the number of elements available to
78 // read. For use with |MojoReadData()| only. Mutually exclusive with 83 // read. For use with |MojoReadData()| only. Mutually exclusive with
79 // |MOJO_READ_DATA_FLAG_DISCARD|, and |MOJO_READ_DATA_FLAG_ALL_OR_NONE| 84 // |MOJO_READ_DATA_FLAG_DISCARD|, and |MOJO_READ_DATA_FLAG_ALL_OR_NONE|
80 // is ignored if this flag is set. 85 // is ignored if this flag is set.
81 // |MOJO_READ_DATA_FLAG_PEEK| - Read elements without removing them. For use 86 // |MOJO_READ_DATA_FLAG_PEEK| - Read elements without removing them. For use
82 // with |MojoReadData()| only. Mutually exclusive with 87 // with |MojoReadData()| only. Mutually exclusive with
83 // |MOJO_READ_DATA_FLAG_DISCARD| and |MOJO_READ_DATA_FLAG_QUERY|. 88 // |MOJO_READ_DATA_FLAG_DISCARD| and |MOJO_READ_DATA_FLAG_QUERY|.
89 // |MOJO_READ_DATA_FLAG_CLEAR_SIGNAL| - If reading fails due to a lack of
yzshen1 2017/03/11 00:44:58 An idea for your consideration: One thing is that
Ken Rockot(use gerrit already) 2017/03/12 22:24:13 Argued with myself for a while over this. I think
90 // available data, clear the |MOJO_HANDLE_SIGNAL_READABLE| signal until
91 // more data arrives.
84 92
85 typedef uint32_t MojoReadDataFlags; 93 typedef uint32_t MojoReadDataFlags;
86 94
87 #ifdef __cplusplus 95 #ifdef __cplusplus
88 const MojoReadDataFlags MOJO_READ_DATA_FLAG_NONE = 0; 96 const MojoReadDataFlags MOJO_READ_DATA_FLAG_NONE = 0;
89 const MojoReadDataFlags MOJO_READ_DATA_FLAG_ALL_OR_NONE = 1 << 0; 97 const MojoReadDataFlags MOJO_READ_DATA_FLAG_ALL_OR_NONE = 1 << 0;
90 const MojoReadDataFlags MOJO_READ_DATA_FLAG_DISCARD = 1 << 1; 98 const MojoReadDataFlags MOJO_READ_DATA_FLAG_DISCARD = 1 << 1;
91 const MojoReadDataFlags MOJO_READ_DATA_FLAG_QUERY = 1 << 2; 99 const MojoReadDataFlags MOJO_READ_DATA_FLAG_QUERY = 1 << 2;
92 const MojoReadDataFlags MOJO_READ_DATA_FLAG_PEEK = 1 << 3; 100 const MojoReadDataFlags MOJO_READ_DATA_FLAG_PEEK = 1 << 3;
101 const MojoReadDataFlags MOJO_READ_DATA_FLAG_CLEAR_SIGNAL = 1 << 4;
93 #else 102 #else
94 #define MOJO_READ_DATA_FLAG_NONE ((MojoReadDataFlags)0) 103 #define MOJO_READ_DATA_FLAG_NONE ((MojoReadDataFlags)0)
95 #define MOJO_READ_DATA_FLAG_ALL_OR_NONE ((MojoReadDataFlags)1 << 0) 104 #define MOJO_READ_DATA_FLAG_ALL_OR_NONE ((MojoReadDataFlags)1 << 0)
96 #define MOJO_READ_DATA_FLAG_DISCARD ((MojoReadDataFlags)1 << 1) 105 #define MOJO_READ_DATA_FLAG_DISCARD ((MojoReadDataFlags)1 << 1)
97 #define MOJO_READ_DATA_FLAG_QUERY ((MojoReadDataFlags)1 << 2) 106 #define MOJO_READ_DATA_FLAG_QUERY ((MojoReadDataFlags)1 << 2)
98 #define MOJO_READ_DATA_FLAG_PEEK ((MojoReadDataFlags)1 << 3) 107 #define MOJO_READ_DATA_FLAG_PEEK ((MojoReadDataFlags)1 << 3)
108 #define MOJO_READ_DATA_FLAG_CLEAR_SIGNAL ((MojoReadDataFlags)1 << 4)
99 #endif 109 #endif
100 110
101 #ifdef __cplusplus 111 #ifdef __cplusplus
102 extern "C" { 112 extern "C" {
103 #endif 113 #endif
104 114
105 // Note: See the comment in functions.h about the meaning of the "optional" 115 // Note: See the comment in functions.h about the meaning of the "optional"
106 // label for pointer parameters. 116 // label for pointer parameters.
107 117
108 // Creates a data pipe, which is a unidirectional communication channel for 118 // Creates a data pipe, which is a unidirectional communication channel for
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 // |MojoEndReadData()| has already been called). 369 // |MojoEndReadData()| has already been called).
360 MOJO_SYSTEM_EXPORT MojoResult 370 MOJO_SYSTEM_EXPORT MojoResult
361 MojoEndReadData(MojoHandle data_pipe_consumer_handle, 371 MojoEndReadData(MojoHandle data_pipe_consumer_handle,
362 uint32_t num_bytes_read); 372 uint32_t num_bytes_read);
363 373
364 #ifdef __cplusplus 374 #ifdef __cplusplus
365 } // extern "C" 375 } // extern "C"
366 #endif 376 #endif
367 377
368 #endif // MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_ 378 #endif // MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698