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

Side by Side Diff: mojo/edk/system/data_pipe_impl.h

Issue 1483823004: EDK: Move {platform_handle,scoped_platform_handle}.* to //mojo/edk/platform. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_EDK_SYSTEM_DATA_PIPE_IMPL_H_ 5 #ifndef MOJO_EDK_SYSTEM_DATA_PIPE_IMPL_H_
6 #define MOJO_EDK_SYSTEM_DATA_PIPE_IMPL_H_ 6 #define MOJO_EDK_SYSTEM_DATA_PIPE_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "mojo/edk/embedder/scoped_platform_handle.h" 13 #include "mojo/edk/platform/scoped_platform_handle.h"
14 #include "mojo/edk/system/data_pipe.h" 14 #include "mojo/edk/system/data_pipe.h"
15 #include "mojo/edk/system/handle_signals_state.h" 15 #include "mojo/edk/system/handle_signals_state.h"
16 #include "mojo/edk/system/memory.h" 16 #include "mojo/edk/system/memory.h"
17 #include "mojo/edk/util/thread_annotations.h" 17 #include "mojo/edk/util/thread_annotations.h"
18 #include "mojo/public/c/system/data_pipe.h" 18 #include "mojo/public/c/system/data_pipe.h"
19 #include "mojo/public/c/system/macros.h" 19 #include "mojo/public/c/system/macros.h"
20 #include "mojo/public/c/system/types.h" 20 #include "mojo/public/c/system/types.h"
21 21
22 namespace mojo { 22 namespace mojo {
23 namespace system { 23 namespace system {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 virtual MojoResult ProducerEndWriteData(uint32_t num_bytes_written) = 0; 69 virtual MojoResult ProducerEndWriteData(uint32_t num_bytes_written) = 0;
70 // Note: A producer should not be writable during a two-phase write. 70 // Note: A producer should not be writable during a two-phase write.
71 virtual HandleSignalsState ProducerGetHandleSignalsState() const = 0; 71 virtual HandleSignalsState ProducerGetHandleSignalsState() const = 0;
72 virtual void ProducerStartSerialize(Channel* channel, 72 virtual void ProducerStartSerialize(Channel* channel,
73 size_t* max_size, 73 size_t* max_size,
74 size_t* max_platform_handles) = 0; 74 size_t* max_platform_handles) = 0;
75 virtual bool ProducerEndSerialize( 75 virtual bool ProducerEndSerialize(
76 Channel* channel, 76 Channel* channel,
77 void* destination, 77 void* destination,
78 size_t* actual_size, 78 size_t* actual_size,
79 std::vector<embedder::ScopedPlatformHandle>* platform_handles) = 0; 79 std::vector<platform::ScopedPlatformHandle>* platform_handles) = 0;
80 80
81 virtual void ConsumerClose() = 0; 81 virtual void ConsumerClose() = 0;
82 // |num_bytes.Get()| will be a nonzero multiple of |element_num_bytes()|. 82 // |num_bytes.Get()| will be a nonzero multiple of |element_num_bytes()|.
83 virtual MojoResult ConsumerReadData(UserPointer<void> elements, 83 virtual MojoResult ConsumerReadData(UserPointer<void> elements,
84 UserPointer<uint32_t> num_bytes, 84 UserPointer<uint32_t> num_bytes,
85 uint32_t max_num_bytes_to_read, 85 uint32_t max_num_bytes_to_read,
86 uint32_t min_num_bytes_to_read, 86 uint32_t min_num_bytes_to_read,
87 bool peek) = 0; 87 bool peek) = 0;
88 virtual MojoResult ConsumerDiscardData(UserPointer<uint32_t> num_bytes, 88 virtual MojoResult ConsumerDiscardData(UserPointer<uint32_t> num_bytes,
89 uint32_t max_num_bytes_to_discard, 89 uint32_t max_num_bytes_to_discard,
90 uint32_t min_num_bytes_to_discard) = 0; 90 uint32_t min_num_bytes_to_discard) = 0;
91 // |num_bytes.Get()| will be a nonzero multiple of |element_num_bytes()|. 91 // |num_bytes.Get()| will be a nonzero multiple of |element_num_bytes()|.
92 virtual MojoResult ConsumerQueryData(UserPointer<uint32_t> num_bytes) = 0; 92 virtual MojoResult ConsumerQueryData(UserPointer<uint32_t> num_bytes) = 0;
93 virtual MojoResult ConsumerBeginReadData( 93 virtual MojoResult ConsumerBeginReadData(
94 UserPointer<const void*> buffer, 94 UserPointer<const void*> buffer,
95 UserPointer<uint32_t> buffer_num_bytes) = 0; 95 UserPointer<uint32_t> buffer_num_bytes) = 0;
96 virtual MojoResult ConsumerEndReadData(uint32_t num_bytes_read) = 0; 96 virtual MojoResult ConsumerEndReadData(uint32_t num_bytes_read) = 0;
97 // Note: A consumer should not be writable during a two-phase read. 97 // Note: A consumer should not be writable during a two-phase read.
98 virtual HandleSignalsState ConsumerGetHandleSignalsState() const = 0; 98 virtual HandleSignalsState ConsumerGetHandleSignalsState() const = 0;
99 virtual void ConsumerStartSerialize(Channel* channel, 99 virtual void ConsumerStartSerialize(Channel* channel,
100 size_t* max_size, 100 size_t* max_size,
101 size_t* max_platform_handles) = 0; 101 size_t* max_platform_handles) = 0;
102 virtual bool ConsumerEndSerialize( 102 virtual bool ConsumerEndSerialize(
103 Channel* channel, 103 Channel* channel,
104 void* destination, 104 void* destination,
105 size_t* actual_size, 105 size_t* actual_size,
106 std::vector<embedder::ScopedPlatformHandle>* platform_handles) = 0; 106 std::vector<platform::ScopedPlatformHandle>* platform_handles) = 0;
107 107
108 virtual bool OnReadMessage(unsigned port, MessageInTransit* message) = 0; 108 virtual bool OnReadMessage(unsigned port, MessageInTransit* message) = 0;
109 virtual void OnDetachFromChannel(unsigned port) = 0; 109 virtual void OnDetachFromChannel(unsigned port) = 0;
110 110
111 protected: 111 protected:
112 DataPipeImpl() : owner_() {} 112 DataPipeImpl() : owner_() {}
113 113
114 // Helper to convert the given circular buffer into messages. The input is a 114 // Helper to convert the given circular buffer into messages. The input is a
115 // circular buffer |buffer| (with appropriate element size and capacity), with 115 // circular buffer |buffer| (with appropriate element size and capacity), with
116 // current contents starting at |start_index| of length |current_num_bytes|. 116 // current contents starting at |start_index| of length |current_num_bytes|.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 struct MOJO_ALIGNAS(8) SerializedDataPipeConsumerDispatcher { 193 struct MOJO_ALIGNAS(8) SerializedDataPipeConsumerDispatcher {
194 // Only validated (and thus canonicalized) options should be serialized. 194 // Only validated (and thus canonicalized) options should be serialized.
195 // However, the deserializer must revalidate (as with everything received). 195 // However, the deserializer must revalidate (as with everything received).
196 MojoCreateDataPipeOptions validated_options; 196 MojoCreateDataPipeOptions validated_options;
197 }; 197 };
198 198
199 } // namespace system 199 } // namespace system
200 } // namespace mojo 200 } // namespace mojo
201 201
202 #endif // MOJO_EDK_SYSTEM_DATA_PIPE_IMPL_H_ 202 #endif // MOJO_EDK_SYSTEM_DATA_PIPE_IMPL_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/data_pipe_consumer_dispatcher.cc ('k') | mojo/edk/system/data_pipe_producer_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698