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

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: thakis comment, renamed LAZY_INSTANCE_INITIALIZER 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
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/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/threading/thread_local.h" 10 #include "base/threading/thread_local.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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 void SyncChannel::OnWaitableEventSignaled(WaitableEvent* event) { 506 void SyncChannel::OnWaitableEventSignaled(WaitableEvent* event) {
506 DCHECK(event == sync_context()->GetDispatchEvent()); 507 DCHECK(event == sync_context()->GetDispatchEvent());
507 // The call to DispatchMessages might delete this object, so reregister 508 // The call to DispatchMessages might delete this object, so reregister
508 // the object watcher first. 509 // the object watcher first.
509 event->Reset(); 510 event->Reset();
510 dispatch_watcher_.StartWatching(event, this); 511 dispatch_watcher_.StartWatching(event, this);
511 sync_context()->DispatchMessages(); 512 sync_context()->DispatchMessages();
512 } 513 }
513 514
514 } // namespace IPC 515 } // namespace IPC
OLDNEW
« base/lazy_instance.cc ('K') | « 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