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

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

Issue 954643002: Update mojo sdk to rev 3d23dae011859a2aae49f1d1adde705c8e85d819 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use run_renderer_in_process() Created 5 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
« no previous file with comments | « content/child/mojo/mojo_application.cc ('k') | content/common/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 2015 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_CHANNEL_INIT_H_
6 #define CONTENT_COMMON_MOJO_CHANNEL_INIT_H_
7
8 #include "base/files/file.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h"
11 #include "content/common/content_export.h"
12 #include "ipc/mojo/scoped_ipc_support.h"
13 #include "third_party/mojo/src/mojo/edk/embedder/channel_info_forward.h"
14 #include "third_party/mojo/src/mojo/public/cpp/system/message_pipe.h"
15
16 namespace base {
17 class MessageLoopProxy;
18 class TaskRunner;
19 }
20
21 namespace content {
22
23 // ChannelInit handles creation and destruction of the Mojo channel. It is not
24 // thread-safe, but may be used on any single thread with a MessageLoop.
25 class CONTENT_EXPORT ChannelInit {
26 public:
27 ChannelInit();
28 ~ChannelInit();
29
30 // Initializes the channel. This takes ownership of |file|. Returns the
31 // primordial MessagePipe for the channel.
32 mojo::ScopedMessagePipeHandle Init(
33 base::PlatformFile file,
34 scoped_refptr<base::TaskRunner> io_thread_task_runner);
35
36 // Notifies the channel that we (hence it) will soon be destroyed.
37 void WillDestroySoon();
38
39 // Get/Set a shared I/O TaskRunner for children to use in single process mode.
40 static scoped_refptr<base::TaskRunner> GetSingleProcessIOTaskRunner();
41 static void SetSingleProcessIOTaskRunner(
42 scoped_refptr<base::TaskRunner> io_task_runner);
43
44 private:
45 // Invoked on the thread on which this object lives once the channel has been
46 // established. This is a static method that takes a weak pointer to self,
47 // since we want to destroy the channel if we were destroyed first.
48 static void OnCreatedChannel(
49 base::WeakPtr<ChannelInit> self,
50 scoped_ptr<IPC::ScopedIPCSupport> ipc_support,
51 mojo::embedder::ChannelInfo* channel);
52
53 // If non-null the channel has been established.
54 mojo::embedder::ChannelInfo* channel_info_;
55
56 scoped_ptr<IPC::ScopedIPCSupport> ipc_support_;
57 base::WeakPtrFactory<ChannelInit> weak_factory_;
58
59 DISALLOW_COPY_AND_ASSIGN(ChannelInit);
60 };
61
62 } // namespace content
63
64 #endif // CONTENT_COMMON_MOJO_CHANNEL_INIT_H_
OLDNEW
« no previous file with comments | « content/child/mojo/mojo_application.cc ('k') | content/common/mojo/channel_init.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698