OLD | NEW |
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 Loading... |
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 | |
38 // Inits the channel. This takes ownership of |file|. | 34 // Inits the channel. This takes ownership of |file|. |
39 void Init(base::PlatformFile file, | 35 void Init(base::PlatformFile file, |
40 scoped_refptr<base::TaskRunner> io_thread_task_runner); | 36 scoped_refptr<base::TaskRunner> io_thread_task_runner); |
41 | 37 |
42 bool is_handle_valid() const { return bootstrap_message_pipe_.is_valid(); } | 38 bool is_handle_valid() const { return bootstrap_message_pipe_.is_valid(); } |
43 | 39 |
44 mojo::ScopedMessagePipeHandle bootstrap_message_pipe() { | 40 mojo::ScopedMessagePipeHandle bootstrap_message_pipe() { |
45 return bootstrap_message_pipe_.Pass(); | 41 return bootstrap_message_pipe_.Pass(); |
46 } | 42 } |
47 | 43 |
(...skipping 13 matching lines...) Expand all Loading... |
61 mojo::ScopedMessagePipeHandle bootstrap_message_pipe_; | 57 mojo::ScopedMessagePipeHandle bootstrap_message_pipe_; |
62 | 58 |
63 base::WeakPtrFactory<MojoChannelInit> weak_factory_; | 59 base::WeakPtrFactory<MojoChannelInit> weak_factory_; |
64 | 60 |
65 DISALLOW_COPY_AND_ASSIGN(MojoChannelInit); | 61 DISALLOW_COPY_AND_ASSIGN(MojoChannelInit); |
66 }; | 62 }; |
67 | 63 |
68 } // namespace content | 64 } // namespace content |
69 | 65 |
70 #endif // CONTENT_COMMON_MOJO_MOJO_CHANNEL_INIT_H_ | 66 #endif // CONTENT_COMMON_MOJO_MOJO_CHANNEL_INIT_H_ |
OLD | NEW |