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

Side by Side Diff: ipc/ipc_sync_message_filter.cc

Issue 2370643004: Port messages sent by WebIDBFactoryImpl to Mojo. (Closed)
Patch Set: Allow cpp_only to be set by the invoker. Created 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ipc/ipc_sync_message_filter.h" 5 #include "ipc/ipc_sync_message_filter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 165 }
166 166
167 return pending_message.send_result; 167 return pending_message.send_result;
168 } 168 }
169 169
170 void SyncMessageFilter::OnFilterAdded(Channel* channel) { 170 void SyncMessageFilter::OnFilterAdded(Channel* channel) {
171 std::vector<std::unique_ptr<Message>> pending_messages; 171 std::vector<std::unique_ptr<Message>> pending_messages;
172 { 172 {
173 base::AutoLock auto_lock(lock_); 173 base::AutoLock auto_lock(lock_);
174 channel_ = channel; 174 channel_ = channel;
175 Channel::AssociatedInterfaceSupport* support =
176 channel_->GetAssociatedInterfaceSupport();
177 if (support)
178 channel_associated_group_ = *support->GetAssociatedGroup();
179
175 io_task_runner_ = base::ThreadTaskRunnerHandle::Get(); 180 io_task_runner_ = base::ThreadTaskRunnerHandle::Get();
176 shutdown_watcher_.StartWatching( 181 shutdown_watcher_.StartWatching(
177 shutdown_event_, 182 shutdown_event_,
178 base::Bind(&SyncMessageFilter::OnShutdownEventSignaled, this)); 183 base::Bind(&SyncMessageFilter::OnShutdownEventSignaled, this));
179 io_message_loop_observer_->StartOnIOThread(); 184 io_message_loop_observer_->StartOnIOThread();
180 std::swap(pending_messages_, pending_messages); 185 std::swap(pending_messages_, pending_messages);
181 } 186 }
182 for (auto& msg : pending_messages) 187 for (auto& msg : pending_messages)
183 SendOnIOThread(msg.release()); 188 SendOnIOThread(msg.release());
184 } 189 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 } 268 }
264 269
265 void SyncMessageFilter::OnIOMessageLoopDestroyed() { 270 void SyncMessageFilter::OnIOMessageLoopDestroyed() {
266 // Since we use an async WaitableEventWatcher to watch the shutdown event 271 // Since we use an async WaitableEventWatcher to watch the shutdown event
267 // from the IO thread, we can't forward the shutdown signal after the IO 272 // from the IO thread, we can't forward the shutdown signal after the IO
268 // message loop is destroyed. Since that destruction indicates shutdown 273 // message loop is destroyed. Since that destruction indicates shutdown
269 // anyway, we manually signal the shutdown event in this case. 274 // anyway, we manually signal the shutdown event in this case.
270 shutdown_mojo_event_.Signal(); 275 shutdown_mojo_event_.Signal();
271 } 276 }
272 277
278 void SyncMessageFilter::GetGenericRemoteAssociatedInterface(
279 const std::string& interface_name,
280 mojo::ScopedInterfaceEndpointHandle handle) {
281 base::AutoLock auto_lock(lock_);
282 DCHECK(io_task_runner_);
283 DCHECK(io_task_runner_->BelongsToCurrentThread());
284 if (!channel_)
285 return;
286
287 Channel::AssociatedInterfaceSupport* support =
288 channel_->GetAssociatedInterfaceSupport();
289 support->GetGenericRemoteAssociatedInterface(interface_name,
290 std::move(handle));
291 }
292
273 } // namespace IPC 293 } // namespace IPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698