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

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

Issue 137273003: Mojo: Rename PlatformChannelHandle to PlatformHandle, etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 11 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/mojo.gyp ('k') | mojo/system/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_CHANNEL_H_ 5 #ifndef MOJO_SYSTEM_CHANNEL_H_
6 #define MOJO_SYSTEM_CHANNEL_H_ 6 #define MOJO_SYSTEM_CHANNEL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/containers/hash_tables.h" 12 #include "base/containers/hash_tables.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/strings/string_piece.h" 15 #include "base/strings/string_piece.h"
16 #include "base/synchronization/lock.h" 16 #include "base/synchronization/lock.h"
17 #include "base/threading/thread_checker.h" 17 #include "base/threading/thread_checker.h"
18 #include "mojo/public/system/core.h" 18 #include "mojo/public/system/core.h"
19 #include "mojo/system/message_in_transit.h" 19 #include "mojo/system/message_in_transit.h"
20 #include "mojo/system/message_pipe.h" 20 #include "mojo/system/message_pipe.h"
21 #include "mojo/system/raw_channel.h" 21 #include "mojo/system/raw_channel.h"
22 #include "mojo/system/scoped_platform_handle.h"
22 #include "mojo/system/system_impl_export.h" 23 #include "mojo/system/system_impl_export.h"
23 24
24 namespace base { 25 namespace base {
25 class MessageLoop; 26 class MessageLoop;
26 } 27 }
27 28
28 namespace mojo { 29 namespace mojo {
29 namespace system { 30 namespace system {
30 31
31 // This class is mostly thread-safe. It must be created on an "I/O thread" (see 32 // This class is mostly thread-safe. It must be created on an "I/O thread" (see
(...skipping 24 matching lines...) Expand all
56 : public base::RefCountedThreadSafe<Channel>, 57 : public base::RefCountedThreadSafe<Channel>,
57 public RawChannel::Delegate { 58 public RawChannel::Delegate {
58 public: 59 public:
59 // The first message pipe endpoint attached will have this as its local ID. 60 // The first message pipe endpoint attached will have this as its local ID.
60 static const MessageInTransit::EndpointId kBootstrapEndpointId = 1; 61 static const MessageInTransit::EndpointId kBootstrapEndpointId = 1;
61 62
62 Channel(); 63 Channel();
63 64
64 // This must be called on the creation thread before any other methods are 65 // This must be called on the creation thread before any other methods are
65 // called, and before references to this object are given to any other 66 // called, and before references to this object are given to any other
66 // threads. Takes ownership of |handle|. Returns true on success. On failure, 67 // threads. |handle| should be a handle to a (platform-appropriate)
67 // no other methods should be called (including |Shutdown()|). 68 // bidirectional communication channel (e.g., a socket on POSIX, a named pipe
68 bool Init(const PlatformChannelHandle& handle); 69 // on Windows). Returns true on success. On failure, no other methods should
70 // be called (including |Shutdown()|).
71 bool Init(ScopedPlatformHandle handle);
69 72
70 // This must be called on the creation thread before destruction (which can 73 // This must be called on the creation thread before destruction (which can
71 // happen on any thread). 74 // happen on any thread).
72 void Shutdown(); 75 void Shutdown();
73 76
74 // Attaches the given message pipe/port's endpoint (which must be a 77 // Attaches the given message pipe/port's endpoint (which must be a
75 // |ProxyMessagePipeEndpoint|) to this channel. This assigns it a local ID, 78 // |ProxyMessagePipeEndpoint|) to this channel. This assigns it a local ID,
76 // which it returns. The first message pipe endpoint attached will always have 79 // which it returns. The first message pipe endpoint attached will always have
77 // |kBootstrapEndpointId| as its local ID. (For bootstrapping, this occurs on 80 // |kBootstrapEndpointId| as its local ID. (For bootstrapping, this occurs on
78 // both sides, so one should use |kBootstrapEndpointId| for the remote ID for 81 // both sides, so one should use |kBootstrapEndpointId| for the remote ID for
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // be checked for existence before use. 137 // be checked for existence before use.
135 MessageInTransit::EndpointId next_local_id_; 138 MessageInTransit::EndpointId next_local_id_;
136 139
137 DISALLOW_COPY_AND_ASSIGN(Channel); 140 DISALLOW_COPY_AND_ASSIGN(Channel);
138 }; 141 };
139 142
140 } // namespace system 143 } // namespace system
141 } // namespace mojo 144 } // namespace mojo
142 145
143 #endif // MOJO_SYSTEM_CHANNEL_H_ 146 #endif // MOJO_SYSTEM_CHANNEL_H_
OLDNEW
« no previous file with comments | « mojo/mojo.gyp ('k') | mojo/system/channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698