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

Side by Side Diff: mojo/common/channel_init.h

Issue 346633002: Move channel_init out of mojo_common. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix exports Created 6 years, 6 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/common/DEPS ('k') | mojo/common/channel_init.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MOJO_COMMON_CHANNEL_INIT_H_
6 #define MOJO_COMMON_CHANNEL_INIT_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/weak_ptr.h"
10 #include "base/platform_file.h"
11 #include "mojo/common/mojo_common_export.h"
12 #include "mojo/public/cpp/system/core.h"
13
14 namespace base {
15 class MessageLoopProxy;
16 class TaskRunner;
17 }
18
19 namespace mojo {
20 namespace embedder {
21 struct ChannelInfo;
22 }
23
24 namespace common {
25
26 // ChannelInit handle creation (and destruction) of the mojo channel. It is
27 // expected that this class is created and destroyed on the main thread.
28 class MOJO_COMMON_EXPORT ChannelInit {
29 public:
30 ChannelInit();
31 ~ChannelInit();
32
33 // Initializes the channel. This takes ownership of |file|. Returns the
34 // primordial MessagePipe for the channel.
35 mojo::ScopedMessagePipeHandle Init(
36 base::PlatformFile file,
37 scoped_refptr<base::TaskRunner> io_thread_task_runner);
38
39 private:
40 // Invoked on the main thread once the channel has been established.
41 static void OnCreatedChannel(
42 base::WeakPtr<ChannelInit> host,
43 scoped_refptr<base::TaskRunner> io_thread,
44 embedder::ChannelInfo* channel);
45
46 scoped_refptr<base::TaskRunner> io_thread_task_runner_;
47
48 // If non-null the channel has been established.
49 embedder::ChannelInfo* channel_info_;
50
51 base::WeakPtrFactory<ChannelInit> weak_factory_;
52
53 DISALLOW_COPY_AND_ASSIGN(ChannelInit);
54 };
55
56 } // namespace common
57 } // namespace mojo
58
59 #endif // MOJO_COMMON_CHANNEL_INIT_H_
OLDNEW
« no previous file with comments | « mojo/common/DEPS ('k') | mojo/common/channel_init.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698