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

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

Issue 106173003: Split mojo_system dylib into public and private (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win Created 7 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 | Annotate | Revision Log
« no previous file with comments | « mojo/public/system/system_export.h ('k') | mojo/system/core.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/public/system/system_export.h"
20 #include "mojo/system/message_in_transit.h" 19 #include "mojo/system/message_in_transit.h"
21 #include "mojo/system/message_pipe.h" 20 #include "mojo/system/message_pipe.h"
22 #include "mojo/system/raw_channel.h" 21 #include "mojo/system/raw_channel.h"
22 #include "mojo/system/system_impl_export.h"
23 23
24 namespace base { 24 namespace base {
25 class MessageLoop; 25 class MessageLoop;
26 } 26 }
27 27
28 namespace mojo { 28 namespace mojo {
29 namespace system { 29 namespace system {
30 30
31 // This class is mostly thread-safe. It must be created on an "I/O thread" (see 31 // This class is mostly thread-safe. It must be created on an "I/O thread" (see
32 // raw_channel.h). |Init()| must be called on that same thread before it becomes 32 // raw_channel.h). |Init()| must be called on that same thread before it becomes
(...skipping 12 matching lines...) Expand all
45 // |local_id_to_endpoint_info_map_|) under |Channel::lock_| and then release the 45 // |local_id_to_endpoint_info_map_|) under |Channel::lock_| and then release the
46 // lock. 46 // lock.
47 // 47 //
48 // Also, care must be taken with respect to references: While a |Channel| has 48 // Also, care must be taken with respect to references: While a |Channel| has
49 // references to |MessagePipe|s, |MessagePipe|s (via |ProxyMessagePipeEndpoint|) 49 // references to |MessagePipe|s, |MessagePipe|s (via |ProxyMessagePipeEndpoint|)
50 // may also have references to |Channel|s. These references are set up by 50 // may also have references to |Channel|s. These references are set up by
51 // calling |AttachMessagePipeEndpoint()|. The reference to |MessagePipe| owned 51 // calling |AttachMessagePipeEndpoint()|. The reference to |MessagePipe| owned
52 // by |Channel| must be removed by calling |DetachMessagePipeEndpoint()| (which 52 // by |Channel| must be removed by calling |DetachMessagePipeEndpoint()| (which
53 // is done by |MessagePipe|/|ProxyMessagePipeEndpoint|, which simultaneously 53 // is done by |MessagePipe|/|ProxyMessagePipeEndpoint|, which simultaneously
54 // removes its reference to |Channel|). 54 // removes its reference to |Channel|).
55 class MOJO_SYSTEM_EXPORT Channel : public base::RefCountedThreadSafe<Channel>, 55 class MOJO_SYSTEM_IMPL_EXPORT Channel
56 public RawChannel::Delegate { 56 : public base::RefCountedThreadSafe<Channel>,
57 public RawChannel::Delegate {
57 public: 58 public:
58 // The first message pipe endpoint attached will have this as its local ID. 59 // The first message pipe endpoint attached will have this as its local ID.
59 static const MessageInTransit::EndpointId kBootstrapEndpointId = 1; 60 static const MessageInTransit::EndpointId kBootstrapEndpointId = 1;
60 61
61 Channel(); 62 Channel();
62 63
63 // This must be called on the creation thread before any other methods are 64 // This must be called on the creation thread before any other methods are
64 // called, and before references to this object are given to any other 65 // called, and before references to this object are given to any other
65 // threads. Takes ownership of |handle|. Returns true on success. On failure, 66 // threads. Takes ownership of |handle|. Returns true on success. On failure,
66 // no other methods should be called (including |Shutdown()|). 67 // no other methods should be called (including |Shutdown()|).
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 // be checked for existence before use. 134 // be checked for existence before use.
134 MessageInTransit::EndpointId next_local_id_; 135 MessageInTransit::EndpointId next_local_id_;
135 136
136 DISALLOW_COPY_AND_ASSIGN(Channel); 137 DISALLOW_COPY_AND_ASSIGN(Channel);
137 }; 138 };
138 139
139 } // namespace system 140 } // namespace system
140 } // namespace mojo 141 } // namespace mojo
141 142
142 #endif // MOJO_SYSTEM_CHANNEL_H_ 143 #endif // MOJO_SYSTEM_CHANNEL_H_
OLDNEW
« no previous file with comments | « mojo/public/system/system_export.h ('k') | mojo/system/core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698