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

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

Issue 133533007: Mojo: Move PlatformChannelPair to its own files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/system/platform_channel.cc ('k') | mojo/system/platform_channel_pair.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 2014 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_PLATFORM_CHANNEL_H_ 5 #ifndef MOJO_SYSTEM_PLATFORM_CHANNEL_PAIR_H_
6 #define MOJO_SYSTEM_PLATFORM_CHANNEL_H_ 6 #define MOJO_SYSTEM_PLATFORM_CHANNEL_PAIR_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/process/launch.h" 10 #include "base/process/launch.h"
11 #include "mojo/system/platform_channel_handle.h" 11 #include "mojo/system/platform_channel_handle.h"
12 #include "mojo/system/system_impl_export.h" 12 #include "mojo/system/system_impl_export.h"
13 13
14 class CommandLine; 14 class CommandLine;
15 15
16 namespace mojo { 16 namespace mojo {
17 namespace system { 17 namespace system {
18 18
19 class MOJO_SYSTEM_IMPL_EXPORT PlatformChannel { 19 class PlatformChannel;
20 public:
21 virtual ~PlatformChannel();
22
23 // Creates a channel if you already have the underlying handle for it, taking
24 // ownership of |handle|.
25 static scoped_ptr<PlatformChannel> CreateFromHandle(
26 const PlatformChannelHandle& handle);
27
28 // Returns the channel's handle, passing ownership.
29 PlatformChannelHandle PassHandle();
30
31 bool is_valid() const { return handle_.is_valid(); }
32
33 protected:
34 PlatformChannel();
35
36 PlatformChannelHandle* mutable_handle() { return &handle_; }
37
38 private:
39 PlatformChannelHandle handle_;
40
41 DISALLOW_COPY_AND_ASSIGN(PlatformChannel);
42 };
43 20
44 // This is used to create a pair of connected |PlatformChannel|s. The resulting 21 // This is used to create a pair of connected |PlatformChannel|s. The resulting
45 // channels can then be used in the same process (e.g., in tests) or between 22 // channels can then be used in the same process (e.g., in tests) or between
46 // processes. (The "server" channel is the one that will be used in the process 23 // processes. (The "server" channel is the one that will be used in the process
47 // that created the pair, whereas the "client" channel is the one that will be 24 // that created the pair, whereas the "client" channel is the one that will be
48 // used in a different process.) 25 // used in a different process.)
49 // 26 //
50 // This class provides facilities for passing the client channel to a child 27 // This class provides facilities for passing the client channel to a child
51 // process. The parent should call |PrepareToPassClientChannelToChildProcess()| 28 // process. The parent should call |PrepareToPassClientChannelToChildProcess()|
52 // to get the data needed to do this, spawn the child using that data, and then 29 // to get the data needed to do this, spawn the child using that data, and then
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 private: 67 private:
91 PlatformChannelHandle server_handle_; 68 PlatformChannelHandle server_handle_;
92 PlatformChannelHandle client_handle_; 69 PlatformChannelHandle client_handle_;
93 70
94 DISALLOW_COPY_AND_ASSIGN(PlatformChannelPair); 71 DISALLOW_COPY_AND_ASSIGN(PlatformChannelPair);
95 }; 72 };
96 73
97 } // namespace system 74 } // namespace system
98 } // namespace mojo 75 } // namespace mojo
99 76
100 #endif // MOJO_SYSTEM_PLATFORM_CHANNEL_H_ 77 #endif // MOJO_SYSTEM_PLATFORM_CHANNEL_PAIR_H_
OLDNEW
« no previous file with comments | « mojo/system/platform_channel.cc ('k') | mojo/system/platform_channel_pair.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698