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

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

Issue 206923002: Adds plumbing to pass WebUI mojo::Handle from browser to renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add TODO and merge to trunk Created 6 years, 8 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
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 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 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 CONTENT_COMMON_MOJO_MOJO_CHANNEL_INIT_H_ 5 #ifndef CONTENT_COMMON_MOJO_MOJO_CHANNEL_INIT_H_
6 #define CONTENT_COMMON_MOJO_MOJO_CHANNEL_INIT_H_ 6 #define CONTENT_COMMON_MOJO_MOJO_CHANNEL_INIT_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/platform_file.h" 10 #include "base/platform_file.h"
(...skipping 13 matching lines...) Expand all
24 24
25 namespace content { 25 namespace content {
26 26
27 // MojoChannelInit handle creation (and destruction) of the mojo channel. It is 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. 28 // expected that this class is created and destroyed on the main thread.
29 class CONTENT_EXPORT MojoChannelInit { 29 class CONTENT_EXPORT MojoChannelInit {
30 public: 30 public:
31 MojoChannelInit(); 31 MojoChannelInit();
32 ~MojoChannelInit(); 32 ~MojoChannelInit();
33 33
34 // Initializes mojo. This is done implicitly when creating a MojoChannelInit,
35 // but can be done explicitly as necessary.
36 static void InitMojo();
37
34 // Inits the channel. This takes ownership of |file|. 38 // Inits the channel. This takes ownership of |file|.
35 void Init(base::PlatformFile file, 39 void Init(base::PlatformFile file,
36 scoped_refptr<base::TaskRunner> io_thread_task_runner); 40 scoped_refptr<base::TaskRunner> io_thread_task_runner);
37 41
38 bool is_handle_valid() const { return bootstrap_message_pipe_.is_valid(); } 42 bool is_handle_valid() const { return bootstrap_message_pipe_.is_valid(); }
39 43
44 mojo::ScopedMessagePipeHandle bootstrap_message_pipe() {
45 return bootstrap_message_pipe_.Pass();
46 }
47
40 private: 48 private:
41 // Invoked on the main thread once the channel has been established. 49 // Invoked on the main thread once the channel has been established.
42 static void OnCreatedChannel( 50 static void OnCreatedChannel(
43 base::WeakPtr<MojoChannelInit> host, 51 base::WeakPtr<MojoChannelInit> host,
44 scoped_refptr<base::TaskRunner> io_thread, 52 scoped_refptr<base::TaskRunner> io_thread,
45 mojo::embedder::ChannelInfo* channel); 53 mojo::embedder::ChannelInfo* channel);
46 54
47 scoped_refptr<base::TaskRunner> io_thread_task_runner_; 55 scoped_refptr<base::TaskRunner> io_thread_task_runner_;
48 56
49 // If non-null the channel has been established. 57 // If non-null the channel has been established.
50 mojo::embedder::ChannelInfo* channel_info_; 58 mojo::embedder::ChannelInfo* channel_info_;
51 59
52 // The handle from channel creation. 60 // The handle from channel creation.
53 mojo::ScopedMessagePipeHandle bootstrap_message_pipe_; 61 mojo::ScopedMessagePipeHandle bootstrap_message_pipe_;
54 62
55 base::WeakPtrFactory<MojoChannelInit> weak_factory_; 63 base::WeakPtrFactory<MojoChannelInit> weak_factory_;
56 64
57 DISALLOW_COPY_AND_ASSIGN(MojoChannelInit); 65 DISALLOW_COPY_AND_ASSIGN(MojoChannelInit);
58 }; 66 };
59 67
60 } // namespace content 68 } // namespace content
61 69
62 #endif // CONTENT_COMMON_MOJO_MOJO_CHANNEL_INIT_H_ 70 #endif // CONTENT_COMMON_MOJO_MOJO_CHANNEL_INIT_H_
OLDNEW
« no previous file with comments | « content/browser/webui/web_ui_mojo_browsertest.cc ('k') | content/common/mojo/mojo_channel_init.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698