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

Side by Side Diff: ipc/ipc_sync_message_filter.cc

Issue 2772983002: Make sure channel-associated interface pointers are always safe to call. (Closed)
Patch Set: . Created 3 years, 9 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 | « ipc/ipc_channel_mojo.cc ('k') | mojo/public/cpp/bindings/BUILD.gn » ('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 (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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 // message loop is destroyed. Since that destruction indicates shutdown 269 // message loop is destroyed. Since that destruction indicates shutdown
270 // anyway, we manually signal the shutdown event in this case. 270 // anyway, we manually signal the shutdown event in this case.
271 shutdown_mojo_event_.Signal(); 271 shutdown_mojo_event_.Signal();
272 } 272 }
273 273
274 void SyncMessageFilter::GetGenericRemoteAssociatedInterface( 274 void SyncMessageFilter::GetGenericRemoteAssociatedInterface(
275 const std::string& interface_name, 275 const std::string& interface_name,
276 mojo::ScopedInterfaceEndpointHandle handle) { 276 mojo::ScopedInterfaceEndpointHandle handle) {
277 base::AutoLock auto_lock(lock_); 277 base::AutoLock auto_lock(lock_);
278 DCHECK(io_task_runner_ && io_task_runner_->BelongsToCurrentThread()); 278 DCHECK(io_task_runner_ && io_task_runner_->BelongsToCurrentThread());
279 if (!channel_) 279 if (!channel_) {
280 // Attach the associated interface to a disconnected pipe, so that the
281 // associated interface pointer can be used to make calls (which are
282 // dropped).
283 mojo::GetIsolatedInterface(std::move(handle));
280 return; 284 return;
285 }
281 286
282 Channel::AssociatedInterfaceSupport* support = 287 Channel::AssociatedInterfaceSupport* support =
283 channel_->GetAssociatedInterfaceSupport(); 288 channel_->GetAssociatedInterfaceSupport();
284 support->GetGenericRemoteAssociatedInterface( 289 support->GetGenericRemoteAssociatedInterface(
285 interface_name, std::move(handle)); 290 interface_name, std::move(handle));
286 } 291 }
287 292
288 } // namespace IPC 293 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_channel_mojo.cc ('k') | mojo/public/cpp/bindings/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698