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 WebDataConsumerHandle_h | 5 #ifndef WebDataConsumerHandle_h |
6 #define WebDataConsumerHandle_h | 6 #define WebDataConsumerHandle_h |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> |
9 | 10 |
10 namespace blink { | 11 namespace blink { |
11 | 12 |
12 // WebDataConsumerHandle represents the "consumer" side of a data pipe. A user | 13 // WebDataConsumerHandle represents the "consumer" side of a data pipe. A user |
13 // can read data from it. | 14 // can read data from it. |
14 // This data type is basically a wrapper of mojo data pipe consumer handle. | 15 // This data type is basically a wrapper of mojo data pipe consumer handle. |
15 // See mojo/public/c/system/data_pipe.h for details. | 16 // See mojo/public/c/system/data_pipe.h for details. |
16 // | 17 // |
17 // Note: | 18 // Note: |
18 // - If you register a client, all of read / beginRead / endRead / | 19 // - If you register a client, all of read / beginRead / endRead / |
19 // registerClient / unregisterClient must be called on the same thread. | 20 // registerClient / unregisterClient must be called on the same thread. |
20 // Client notification is called on the thread. | 21 // Client notification is called on the thread. |
21 class WebDataConsumerHandle { | 22 class WebDataConsumerHandle { |
22 public: | 23 public: |
23 // This corresponds to MojoReadDataFlags. | 24 // This corresponds to MojoReadDataFlags. |
24 using Flags = unsigned; | 25 using Flags = uint32_t; |
25 static const Flags FlagNone = 0; | 26 static const Flags FlagNone = 0; |
26 | 27 |
27 enum Result { | 28 enum Result { |
28 Ok, | 29 Ok, |
29 Done, | 30 Done, |
30 Busy, | 31 Busy, |
31 ShouldWait, | 32 ShouldWait, |
32 ResourceExhausted, | 33 ResourceExhausted, |
33 UnexpectedError, | 34 UnexpectedError, |
34 }; | 35 }; |
(...skipping 30 matching lines...) Expand all Loading... |
65 // Only one registration can be made for a handle at a time. | 66 // Only one registration can be made for a handle at a time. |
66 virtual void registerClient(Client* /* client */) { } | 67 virtual void registerClient(Client* /* client */) { } |
67 | 68 |
68 // Unregisters |client| from this handle. | 69 // Unregisters |client| from this handle. |
69 virtual void unregisterClient() { } | 70 virtual void unregisterClient() { } |
70 }; | 71 }; |
71 | 72 |
72 } // namespace blink | 73 } // namespace blink |
73 | 74 |
74 #endif // WebDataConsumerHandle_h | 75 #endif // WebDataConsumerHandle_h |
OLD | NEW |