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

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

Issue 416203002: Convert BeginReadData...() to use the new user pointer handling (see r285350). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 5 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/system/core_test_base.cc ('k') | mojo/system/data_pipe.cc » ('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_SYSTEM_DATA_PIPE_H_ 5 #ifndef MOJO_SYSTEM_DATA_PIPE_H_
6 #define MOJO_SYSTEM_DATA_PIPE_H_ 6 #define MOJO_SYSTEM_DATA_PIPE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 void ConsumerCancelAllWaiters(); 70 void ConsumerCancelAllWaiters();
71 void ConsumerClose(); 71 void ConsumerClose();
72 // This does not validate its arguments, except to check that |*num_bytes| is 72 // This does not validate its arguments, except to check that |*num_bytes| is
73 // a multiple of |element_num_bytes_|. 73 // a multiple of |element_num_bytes_|.
74 MojoResult ConsumerReadData(void* elements, 74 MojoResult ConsumerReadData(void* elements,
75 uint32_t* num_bytes, 75 uint32_t* num_bytes,
76 bool all_or_none); 76 bool all_or_none);
77 MojoResult ConsumerDiscardData(uint32_t* num_bytes, 77 MojoResult ConsumerDiscardData(uint32_t* num_bytes,
78 bool all_or_none); 78 bool all_or_none);
79 MojoResult ConsumerQueryData(uint32_t* num_bytes); 79 MojoResult ConsumerQueryData(uint32_t* num_bytes);
80 // This does not validate its arguments. 80 MojoResult ConsumerBeginReadData(UserPointer<const void*> buffer,
81 MojoResult ConsumerBeginReadData(const void** buffer, 81 UserPointer<uint32_t> buffer_num_bytes,
82 uint32_t* buffer_num_bytes,
83 bool all_or_none); 82 bool all_or_none);
84 MojoResult ConsumerEndReadData(uint32_t num_bytes_read); 83 MojoResult ConsumerEndReadData(uint32_t num_bytes_read);
85 MojoResult ConsumerAddWaiter(Waiter* waiter, 84 MojoResult ConsumerAddWaiter(Waiter* waiter,
86 MojoHandleSignals signals, 85 MojoHandleSignals signals,
87 uint32_t context); 86 uint32_t context);
88 void ConsumerRemoveWaiter(Waiter* waiter); 87 void ConsumerRemoveWaiter(Waiter* waiter);
89 bool ConsumerIsBusy() const; 88 bool ConsumerIsBusy() const;
90 89
91 protected: 90 protected:
92 DataPipe(bool has_local_producer, 91 DataPipe(bool has_local_producer,
(...skipping 19 matching lines...) Expand all
112 111
113 virtual void ConsumerCloseImplNoLock() = 0; 112 virtual void ConsumerCloseImplNoLock() = 0;
114 // |*num_bytes| will be a nonzero multiple of |element_num_bytes_|. 113 // |*num_bytes| will be a nonzero multiple of |element_num_bytes_|.
115 virtual MojoResult ConsumerReadDataImplNoLock(void* elements, 114 virtual MojoResult ConsumerReadDataImplNoLock(void* elements,
116 uint32_t* num_bytes, 115 uint32_t* num_bytes,
117 bool all_or_none) = 0; 116 bool all_or_none) = 0;
118 virtual MojoResult ConsumerDiscardDataImplNoLock(uint32_t* num_bytes, 117 virtual MojoResult ConsumerDiscardDataImplNoLock(uint32_t* num_bytes,
119 bool all_or_none) = 0; 118 bool all_or_none) = 0;
120 // |*num_bytes| will be a nonzero multiple of |element_num_bytes_|. 119 // |*num_bytes| will be a nonzero multiple of |element_num_bytes_|.
121 virtual MojoResult ConsumerQueryDataImplNoLock(uint32_t* num_bytes) = 0; 120 virtual MojoResult ConsumerQueryDataImplNoLock(uint32_t* num_bytes) = 0;
122 virtual MojoResult ConsumerBeginReadDataImplNoLock(const void** buffer, 121 virtual MojoResult ConsumerBeginReadDataImplNoLock(
123 uint32_t* buffer_num_bytes, 122 UserPointer<const void*> buffer,
124 bool all_or_none) = 0; 123 UserPointer<uint32_t> buffer_num_bytes,
124 uint32_t min_num_bytes_to_read) = 0;
125 virtual MojoResult ConsumerEndReadDataImplNoLock(uint32_t num_bytes_read) = 0; 125 virtual MojoResult ConsumerEndReadDataImplNoLock(uint32_t num_bytes_read) = 0;
126 // Note: A consumer should not be writable during a two-phase read. 126 // Note: A consumer should not be writable during a two-phase read.
127 virtual HandleSignalsState ConsumerGetHandleSignalsStateNoLock() const = 0; 127 virtual HandleSignalsState ConsumerGetHandleSignalsStateNoLock() const = 0;
128 128
129 // Thread-safe and fast (they don't take the lock): 129 // Thread-safe and fast (they don't take the lock):
130 bool may_discard() const { return may_discard_; } 130 bool may_discard() const { return may_discard_; }
131 size_t element_num_bytes() const { return element_num_bytes_; } 131 size_t element_num_bytes() const { return element_num_bytes_; }
132 size_t capacity_num_bytes() const { return capacity_num_bytes_; } 132 size_t capacity_num_bytes() const { return capacity_num_bytes_; }
133 133
134 // Must be called under lock. 134 // Must be called under lock.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 uint32_t producer_two_phase_max_num_bytes_written_; 196 uint32_t producer_two_phase_max_num_bytes_written_;
197 uint32_t consumer_two_phase_max_num_bytes_read_; 197 uint32_t consumer_two_phase_max_num_bytes_read_;
198 198
199 DISALLOW_COPY_AND_ASSIGN(DataPipe); 199 DISALLOW_COPY_AND_ASSIGN(DataPipe);
200 }; 200 };
201 201
202 } // namespace system 202 } // namespace system
203 } // namespace mojo 203 } // namespace mojo
204 204
205 #endif // MOJO_SYSTEM_DATA_PIPE_H_ 205 #endif // MOJO_SYSTEM_DATA_PIPE_H_
OLDNEW
« no previous file with comments | « mojo/system/core_test_base.cc ('k') | mojo/system/data_pipe.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698