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

Side by Side Diff: mojo/edk/embedder/embedder.cc

Issue 1525883002: EDK: Add PlatformHandleWatcher to IPCSupport class. (Closed) Base URL: https://github.com/domokit/mojo.git@embedder_watcher
Patch Set: Created 5 years 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 | « no previous file | mojo/edk/system/ipc_support.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "mojo/edk/embedder/embedder.h" 5 #include "mojo/edk/embedder/embedder.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/atomicops.h" 9 #include "base/atomicops.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 RefPtr<TaskRunner>&& delegate_thread_task_runner, 128 RefPtr<TaskRunner>&& delegate_thread_task_runner,
129 ProcessDelegate* process_delegate, 129 ProcessDelegate* process_delegate,
130 RefPtr<TaskRunner>&& io_task_runner, 130 RefPtr<TaskRunner>&& io_task_runner,
131 PlatformHandleWatcher* io_watcher, 131 PlatformHandleWatcher* io_watcher,
132 ScopedPlatformHandle platform_handle) { 132 ScopedPlatformHandle platform_handle) {
133 // |Init()| must have already been called. 133 // |Init()| must have already been called.
134 DCHECK(internal::g_core); 134 DCHECK(internal::g_core);
135 // And not |InitIPCSupport()| (without |ShutdownIPCSupport()|). 135 // And not |InitIPCSupport()| (without |ShutdownIPCSupport()|).
136 DCHECK(!internal::g_ipc_support); 136 DCHECK(!internal::g_ipc_support);
137 137
138 // TODO(vtl): Make IPCSUpport also take |io_watcher|.
139 internal::g_ipc_support = new system::IPCSupport( 138 internal::g_ipc_support = new system::IPCSupport(
140 internal::g_platform_support, process_type, 139 internal::g_platform_support, process_type,
141 std::move(delegate_thread_task_runner), process_delegate, 140 std::move(delegate_thread_task_runner), process_delegate,
142 std::move(io_task_runner), platform_handle.Pass()); 141 std::move(io_task_runner), io_watcher, platform_handle.Pass());
143 } 142 }
144 143
145 void ShutdownIPCSupportOnIOThread() { 144 void ShutdownIPCSupportOnIOThread() {
146 DCHECK(internal::g_ipc_support); 145 DCHECK(internal::g_ipc_support);
147 146
148 internal::g_ipc_support->ShutdownOnIOThread(); 147 internal::g_ipc_support->ShutdownOnIOThread();
149 delete internal::g_ipc_support; 148 delete internal::g_ipc_support;
150 internal::g_ipc_support = nullptr; 149 internal::g_ipc_support = nullptr;
151 } 150 }
152 151
153 void ShutdownIPCSupport() { 152 void ShutdownIPCSupport() {
154 DCHECK(internal::g_ipc_support); 153 DCHECK(internal::g_ipc_support);
155 154
156 internal::g_ipc_support->io_thread_task_runner()->PostTask([]() { 155 internal::g_ipc_support->io_task_runner()->PostTask([]() {
157 // Save these before they get nuked by |ShutdownChannelOnIOThread()|. 156 // Save these before they get nuked by |ShutdownChannelOnIOThread()|.
158 RefPtr<TaskRunner> delegate_thread_task_runner( 157 RefPtr<TaskRunner> delegate_thread_task_runner(
159 internal::g_ipc_support->delegate_thread_task_runner()); 158 internal::g_ipc_support->delegate_thread_task_runner());
160 ProcessDelegate* process_delegate = 159 ProcessDelegate* process_delegate =
161 internal::g_ipc_support->process_delegate(); 160 internal::g_ipc_support->process_delegate();
162 161
163 ShutdownIPCSupportOnIOThread(); 162 ShutdownIPCSupportOnIOThread();
164 163
165 delegate_thread_task_runner->PostTask( 164 delegate_thread_task_runner->PostTask(
166 [process_delegate]() { process_delegate->OnShutdownComplete(); }); 165 [process_delegate]() { process_delegate->OnShutdownComplete(); });
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 DCHECK(channel_info); 303 DCHECK(channel_info);
305 DCHECK(internal::g_ipc_support); 304 DCHECK(internal::g_ipc_support);
306 305
307 system::ChannelManager* channel_manager = 306 system::ChannelManager* channel_manager =
308 internal::g_ipc_support->channel_manager(); 307 internal::g_ipc_support->channel_manager();
309 channel_manager->WillShutdownChannel(channel_info->channel_id); 308 channel_manager->WillShutdownChannel(channel_info->channel_id);
310 } 309 }
311 310
312 } // namespace embedder 311 } // namespace embedder
313 } // namespace mojo 312 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/edk/system/ipc_support.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698