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

Side by Side Diff: ipc/ipc_sync_channel.cc

Issue 5598010: Convert over to channel handles (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed up bad whitespace Created 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_channel.h" 5 #include "ipc/ipc_sync_channel.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/thread_local.h" 9 #include "base/thread_local.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 CancelPendingSends(); 348 CancelPendingSends();
349 } else { 349 } else {
350 // We got the reply, timed out or the process shutdown. 350 // We got the reply, timed out or the process shutdown.
351 DCHECK(event == GetSendDoneEvent()); 351 DCHECK(event == GetSendDoneEvent());
352 MessageLoop::current()->QuitNow(); 352 MessageLoop::current()->QuitNow();
353 } 353 }
354 } 354 }
355 355
356 356
357 SyncChannel::SyncChannel( 357 SyncChannel::SyncChannel(
358 const std::string& channel_id, 358 const IPC::ChannelHandle& channel_handle,
359 Channel::Mode mode, 359 Channel::Mode mode,
360 Channel::Listener* listener, 360 Channel::Listener* listener,
361 MessageLoop* ipc_message_loop, 361 MessageLoop* ipc_message_loop,
362 bool create_pipe_now, 362 bool create_pipe_now,
363 WaitableEvent* shutdown_event) 363 WaitableEvent* shutdown_event)
364 : ChannelProxy( 364 : ChannelProxy(
365 channel_id, mode, ipc_message_loop, 365 channel_handle, mode, ipc_message_loop,
366 new SyncContext(listener, ipc_message_loop, shutdown_event), 366 new SyncContext(listener, ipc_message_loop, shutdown_event),
367 create_pipe_now), 367 create_pipe_now),
368 sync_messages_with_no_timeout_allowed_(true) { 368 sync_messages_with_no_timeout_allowed_(true) {
369 // Ideally we only want to watch this object when running a nested message 369 // Ideally we only want to watch this object when running a nested message
370 // loop. However, we don't know when it exits if there's another nested 370 // loop. However, we don't know when it exits if there's another nested
371 // message loop running under it or not, so we wouldn't know whether to 371 // message loop running under it or not, so we wouldn't know whether to
372 // stop or keep watching. So we always watch it, and create the event as 372 // stop or keep watching. So we always watch it, and create the event as
373 // manual reset since the object watcher might otherwise reset the event 373 // manual reset since the object watcher might otherwise reset the event
374 // when we're doing a WaitMany. 374 // when we're doing a WaitMany.
375 dispatch_watcher_.StartWatching(sync_context()->GetDispatchEvent(), this); 375 dispatch_watcher_.StartWatching(sync_context()->GetDispatchEvent(), this);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 void SyncChannel::OnWaitableEventSignaled(WaitableEvent* event) { 485 void SyncChannel::OnWaitableEventSignaled(WaitableEvent* event) {
486 DCHECK(event == sync_context()->GetDispatchEvent()); 486 DCHECK(event == sync_context()->GetDispatchEvent());
487 // The call to DispatchMessages might delete this object, so reregister 487 // The call to DispatchMessages might delete this object, so reregister
488 // the object watcher first. 488 // the object watcher first.
489 event->Reset(); 489 event->Reset();
490 dispatch_watcher_.StartWatching(event, this); 490 dispatch_watcher_.StartWatching(event, this);
491 sync_context()->DispatchMessages(); 491 sync_context()->DispatchMessages();
492 } 492 }
493 493
494 } // namespace IPC 494 } // namespace IPC
OLDNEW
« ipc/ipc_channel_proxy.cc ('K') | « ipc/ipc_sync_channel.h ('k') | ppapi/proxy/dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698