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

Side by Side Diff: content/common/mojo/mojo_channel_init.h

Issue 195993010: Adds the ability for the renderer to create the mojo channel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use_mojo Created 6 years, 9 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 | « content/common/mojo/OWNERS ('k') | content/common/mojo/mojo_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 (c) 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 CONTENT_COMMON_MOJO_MOJO_CHANNEL_INIT_H_
6 #define CONTENT_COMMON_MOJO_MOJO_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 "content/common/content_export.h"
12 #include "mojo/public/system/core_cpp.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
25 namespace content {
26
27 // MojoChannelInit handle creation (and destruction) of the mojo channel. It is
28 // expected that this class is created and destroyed on the main thread.
29 class CONTENT_EXPORT MojoChannelInit {
30 public:
31 MojoChannelInit();
32 ~MojoChannelInit();
33
34 // Inits the channel. This takes ownership of |file|.
35 void Init(base::PlatformFile file,
36 scoped_refptr<base::TaskRunner> io_thread_task_runner);
37
38 bool is_handle_valid() const { return bootstrap_message_pipe_.is_valid(); }
39
40 private:
41 // Invoked on the IO thread once the channel has been established.
42 static void OnCreatedChannelOnIOThread(
43 base::WeakPtr<MojoChannelInit> host,
44 scoped_refptr<base::TaskRunner> main_thread,
45 scoped_refptr<base::TaskRunner> io_thread,
46 mojo::embedder::ChannelInfo* channel);
47
48 // Invoked on the main thread once the channel has been established.
49 static void OnCreatedChannelOnMainThread(
50 base::WeakPtr<MojoChannelInit> host,
51 scoped_refptr<base::TaskRunner> io_thread,
52 mojo::embedder::ChannelInfo* channel);
53
54 // Thread where this object lives.
55 scoped_refptr<base::TaskRunner> main_thread_;
56
57 scoped_refptr<base::TaskRunner> io_thread_task_runner_;
58
59 // If non-null the channel has been established.
60 mojo::embedder::ChannelInfo* channel_info_;
61
62 // The handle from channel creation.
63 mojo::ScopedHandle bootstrap_message_pipe_;
64
65 base::WeakPtrFactory<MojoChannelInit> weak_factory_;
66
67 DISALLOW_COPY_AND_ASSIGN(MojoChannelInit);
68 };
69
70 } // namespace content
71
72 #endif // CONTENT_COMMON_MOJO_MOJO_CHANNEL_INIT_H_
OLDNEW
« no previous file with comments | « content/common/mojo/OWNERS ('k') | content/common/mojo/mojo_channel_init.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698