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

Side by Side Diff: ipc/ipc_sync_channel.cc

Issue 8491043: Allow linker initialization of lazy instance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: willchan comments + rebase Created 9 years, 1 month 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
« no previous file with comments | « crypto/nss_util.cc ('k') | jingle/glue/thread_wrapper.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/bind.h" 7 #include "base/bind.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 bool task_pending_; 199 bool task_pending_;
200 int listener_count_; 200 int listener_count_;
201 201
202 // The current send done event watcher for this thread. Used to maintain 202 // The current send done event watcher for this thread. Used to maintain
203 // a local global stack of send done watchers to ensure that nested sync 203 // a local global stack of send done watchers to ensure that nested sync
204 // message loops complete correctly. 204 // message loops complete correctly.
205 base::WaitableEventWatcher* top_send_done_watcher_; 205 base::WaitableEventWatcher* top_send_done_watcher_;
206 }; 206 };
207 207
208 base::LazyInstance<base::ThreadLocalPointer<SyncChannel::ReceivedSyncMsgQueue> > 208 base::LazyInstance<base::ThreadLocalPointer<SyncChannel::ReceivedSyncMsgQueue> >
209 SyncChannel::ReceivedSyncMsgQueue::lazy_tls_ptr_(base::LINKER_INITIALIZED); 209 SyncChannel::ReceivedSyncMsgQueue::lazy_tls_ptr_ =
210 LAZY_INSTANCE_INITIALIZER;
210 211
211 SyncChannel::SyncContext::SyncContext( 212 SyncChannel::SyncContext::SyncContext(
212 Channel::Listener* listener, 213 Channel::Listener* listener,
213 base::MessageLoopProxy* ipc_thread, 214 base::MessageLoopProxy* ipc_thread,
214 WaitableEvent* shutdown_event) 215 WaitableEvent* shutdown_event)
215 : ChannelProxy::Context(listener, ipc_thread), 216 : ChannelProxy::Context(listener, ipc_thread),
216 received_sync_msgs_(ReceivedSyncMsgQueue::AddContext()), 217 received_sync_msgs_(ReceivedSyncMsgQueue::AddContext()),
217 shutdown_event_(shutdown_event), 218 shutdown_event_(shutdown_event),
218 restrict_dispatch_(false) { 219 restrict_dispatch_(false) {
219 } 220 }
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 void SyncChannel::OnWaitableEventSignaled(WaitableEvent* event) { 508 void SyncChannel::OnWaitableEventSignaled(WaitableEvent* event) {
508 DCHECK(event == sync_context()->GetDispatchEvent()); 509 DCHECK(event == sync_context()->GetDispatchEvent());
509 // The call to DispatchMessages might delete this object, so reregister 510 // The call to DispatchMessages might delete this object, so reregister
510 // the object watcher first. 511 // the object watcher first.
511 event->Reset(); 512 event->Reset();
512 dispatch_watcher_.StartWatching(event, this); 513 dispatch_watcher_.StartWatching(event, this);
513 sync_context()->DispatchMessages(); 514 sync_context()->DispatchMessages();
514 } 515 }
515 516
516 } // namespace IPC 517 } // namespace IPC
OLDNEW
« no previous file with comments | « crypto/nss_util.cc ('k') | jingle/glue/thread_wrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698