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

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

Issue 277083003: Mojo: (Theoretically) implement the read side of platform handle passing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: asdf Created 6 years, 7 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/message_in_transit.cc ('k') | mojo/system/raw_channel.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_RAW_CHANNEL_H_ 5 #ifndef MOJO_SYSTEM_RAW_CHANNEL_H_
6 #define MOJO_SYSTEM_RAW_CHANNEL_H_ 6 #define MOJO_SYSTEM_RAW_CHANNEL_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/synchronization/lock.h" 14 #include "base/synchronization/lock.h"
15 #include "mojo/embedder/platform_handle_vector.h"
15 #include "mojo/embedder/scoped_platform_handle.h" 16 #include "mojo/embedder/scoped_platform_handle.h"
16 #include "mojo/system/constants.h" 17 #include "mojo/system/constants.h"
17 #include "mojo/system/message_in_transit.h" 18 #include "mojo/system/message_in_transit.h"
18 #include "mojo/system/system_impl_export.h" 19 #include "mojo/system/system_impl_export.h"
19 20
20 namespace base { 21 namespace base {
21 class MessageLoopForIO; 22 class MessageLoopForIO;
22 } 23 }
23 24
24 namespace mojo { 25 namespace mojo {
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 // The implementing subclass must guarantee that: 202 // The implementing subclass must guarantee that:
202 // - |bytes_read| is untouched unless |Read()| returns |IO_SUCCEEDED|; 203 // - |bytes_read| is untouched unless |Read()| returns |IO_SUCCEEDED|;
203 // - if the method returns |IO_PENDING|, |OnReadCompleted()| will be called on 204 // - if the method returns |IO_PENDING|, |OnReadCompleted()| will be called on
204 // the I/O thread to report the result, unless |Shutdown()| is called. 205 // the I/O thread to report the result, unless |Shutdown()| is called.
205 virtual IOResult Read(size_t* bytes_read) = 0; 206 virtual IOResult Read(size_t* bytes_read) = 0;
206 // Similar to |Read()|, except that the implementing subclass must also 207 // Similar to |Read()|, except that the implementing subclass must also
207 // guarantee that the method doesn't succeed synchronously, i.e., it only 208 // guarantee that the method doesn't succeed synchronously, i.e., it only
208 // returns |IO_FAILED| or |IO_PENDING|. 209 // returns |IO_FAILED| or |IO_PENDING|.
209 virtual IOResult ScheduleRead() = 0; 210 virtual IOResult ScheduleRead() = 0;
210 211
212 // Called by |OnReadCompleted()| to get the platform handles associated with
213 // the given platform handle table (from a message). This should only be
214 // called when |num_platform_handles| is nonzero. Returns null if the
215 // |num_platform_handles| handles are not available. Only called on the I/O
216 // thread (without |write_lock_| held).
217 virtual scoped_ptr<embedder::PlatformHandleVector> GetReadPlatformHandles(
218 size_t num_platform_handles,
219 const void* platform_handle_table) = 0;
220
211 // Writes contents in |write_buffer_no_lock()|. 221 // Writes contents in |write_buffer_no_lock()|.
212 // This class guarantees that: 222 // This class guarantees that:
213 // - the |PlatformHandle|s given by |GetPlatformHandlesToSend()| and the 223 // - the |PlatformHandle|s given by |GetPlatformHandlesToSend()| and the
214 // buffer(s) given by |GetBuffers()| will remain valid until write 224 // buffer(s) given by |GetBuffers()| will remain valid until write
215 // completion (see also the comments for |OnShutdownNoLock()|); 225 // completion (see also the comments for |OnShutdownNoLock()|);
216 // - a second write is not started if there is a pending write; 226 // - a second write is not started if there is a pending write;
217 // - the method is called under |write_lock_|. 227 // - the method is called under |write_lock_|.
218 // 228 //
219 // The implementing subclass must guarantee that: 229 // The implementing subclass must guarantee that:
220 // - |platform_handles_written| and |bytes_written| are untouched unless 230 // - |platform_handles_written| and |bytes_written| are untouched unless
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 // are only used/invalidated on the I/O thread. 286 // are only used/invalidated on the I/O thread.
277 base::WeakPtrFactory<RawChannel> weak_ptr_factory_; 287 base::WeakPtrFactory<RawChannel> weak_ptr_factory_;
278 288
279 DISALLOW_COPY_AND_ASSIGN(RawChannel); 289 DISALLOW_COPY_AND_ASSIGN(RawChannel);
280 }; 290 };
281 291
282 } // namespace system 292 } // namespace system
283 } // namespace mojo 293 } // namespace mojo
284 294
285 #endif // MOJO_SYSTEM_RAW_CHANNEL_H_ 295 #endif // MOJO_SYSTEM_RAW_CHANNEL_H_
OLDNEW
« no previous file with comments | « mojo/system/message_in_transit.cc ('k') | mojo/system/raw_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698