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

Side by Side Diff: mojo/edk/system/ipc_support.h

Issue 1412283002: Convert mojo::system::Dispatcher to use our new refcounting stuff (instead of base's). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: no change Created 5 years, 2 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 | « mojo/edk/system/handle_table.cc ('k') | mojo/edk/system/ipc_support.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 MOJO_EDK_SYSTEM_IPC_SUPPORT_H_ 5 #ifndef MOJO_EDK_SYSTEM_IPC_SUPPORT_H_
6 #define MOJO_EDK_SYSTEM_IPC_SUPPORT_H_ 6 #define MOJO_EDK_SYSTEM_IPC_SUPPORT_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/task_runner.h" 13 #include "base/task_runner.h"
14 #include "mojo/edk/embedder/process_type.h" 14 #include "mojo/edk/embedder/process_type.h"
15 #include "mojo/edk/embedder/scoped_platform_handle.h" 15 #include "mojo/edk/embedder/scoped_platform_handle.h"
16 #include "mojo/edk/embedder/slave_info.h" 16 #include "mojo/edk/embedder/slave_info.h"
17 #include "mojo/edk/system/channel_id.h" 17 #include "mojo/edk/system/channel_id.h"
18 #include "mojo/edk/system/connection_identifier.h" 18 #include "mojo/edk/system/connection_identifier.h"
19 #include "mojo/edk/system/process_identifier.h" 19 #include "mojo/edk/system/process_identifier.h"
20 #include "mojo/edk/system/ref_ptr.h"
20 #include "mojo/public/cpp/system/macros.h" 21 #include "mojo/public/cpp/system/macros.h"
21 22
22 namespace mojo { 23 namespace mojo {
23 24
24 namespace embedder { 25 namespace embedder {
25 class PlatformSupport; 26 class PlatformSupport;
26 class ProcessDelegate; 27 class ProcessDelegate;
27 } 28 }
28 29
29 namespace system { 30 namespace system {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // master's side). 93 // master's side).
93 // 94 //
94 // |callback| will be run after the |Channel| is created, either using 95 // |callback| will be run after the |Channel| is created, either using
95 // |callback_thread_task_runner| (if it is non-null) or on the I/O thread. 96 // |callback_thread_task_runner| (if it is non-null) or on the I/O thread.
96 // |*channel_id| will be set to the ID for the channel (immediately); the 97 // |*channel_id| will be set to the ID for the channel (immediately); the
97 // channel may be destroyed using this ID, but only after the callback has 98 // channel may be destroyed using this ID, but only after the callback has
98 // been run. 99 // been run.
99 // 100 //
100 // TODO(vtl): Add some more channel management functionality to this class. 101 // TODO(vtl): Add some more channel management functionality to this class.
101 // Maybe make this callback interface more sane. 102 // Maybe make this callback interface more sane.
102 scoped_refptr<system::MessagePipeDispatcher> ConnectToSlave( 103 RefPtr<MessagePipeDispatcher> ConnectToSlave(
103 const ConnectionIdentifier& connection_id, 104 const ConnectionIdentifier& connection_id,
104 embedder::SlaveInfo slave_info, 105 embedder::SlaveInfo slave_info,
105 embedder::ScopedPlatformHandle platform_handle, 106 embedder::ScopedPlatformHandle platform_handle,
106 const base::Closure& callback, 107 const base::Closure& callback,
107 scoped_refptr<base::TaskRunner> callback_thread_task_runner, 108 scoped_refptr<base::TaskRunner> callback_thread_task_runner,
108 ChannelId* channel_id); 109 ChannelId* channel_id);
109 110
110 // Called in a slave process to connect it to the master process and thus the 111 // Called in a slave process to connect it to the master process and thus the
111 // IPC system, creating a |Channel| and an initial message pipe (return a 112 // IPC system, creating a |Channel| and an initial message pipe (return a
112 // dispatcher for the slave's side). See |ConnectToSlave()|, above. 113 // dispatcher for the slave's side). See |ConnectToSlave()|, above.
113 // 114 //
114 // |callback|, |callback_thread_task_runner|, and |channel_id| are as in 115 // |callback|, |callback_thread_task_runner|, and |channel_id| are as in
115 // |ConnectToSlave()|. 116 // |ConnectToSlave()|.
116 // 117 //
117 // TODO(vtl): |ConnectToSlave()|'s channel management TODO also applies here. 118 // TODO(vtl): |ConnectToSlave()|'s channel management TODO also applies here.
118 scoped_refptr<system::MessagePipeDispatcher> ConnectToMaster( 119 RefPtr<MessagePipeDispatcher> ConnectToMaster(
119 const ConnectionIdentifier& connection_id, 120 const ConnectionIdentifier& connection_id,
120 const base::Closure& callback, 121 const base::Closure& callback,
121 scoped_refptr<base::TaskRunner> callback_thread_task_runner, 122 scoped_refptr<base::TaskRunner> callback_thread_task_runner,
122 ChannelId* channel_id); 123 ChannelId* channel_id);
123 124
124 embedder::ProcessType process_type() const { return process_type_; } 125 embedder::ProcessType process_type() const { return process_type_; }
125 embedder::ProcessDelegate* process_delegate() const { 126 embedder::ProcessDelegate* process_delegate() const {
126 return process_delegate_; 127 return process_delegate_;
127 } 128 }
128 base::TaskRunner* delegate_thread_task_runner() const { 129 base::TaskRunner* delegate_thread_task_runner() const {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 std::unique_ptr<ConnectionManager> connection_manager_; 173 std::unique_ptr<ConnectionManager> connection_manager_;
173 std::unique_ptr<ChannelManager> channel_manager_; 174 std::unique_ptr<ChannelManager> channel_manager_;
174 175
175 MOJO_DISALLOW_COPY_AND_ASSIGN(IPCSupport); 176 MOJO_DISALLOW_COPY_AND_ASSIGN(IPCSupport);
176 }; 177 };
177 178
178 } // namespace system 179 } // namespace system
179 } // namespace mojo 180 } // namespace mojo
180 181
181 #endif // MOJO_EDK_SYSTEM_IPC_SUPPORT_H_ 182 #endif // MOJO_EDK_SYSTEM_IPC_SUPPORT_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/handle_table.cc ('k') | mojo/edk/system/ipc_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698