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

Side by Side Diff: content/browser/browser_thread_impl.cc

Issue 9117038: Convert all remaining explicit LeakyLazyInstanceTraits users to ::Leaky (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 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 | Annotate | Revision Log
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 "content/browser/browser_thread_impl.h" 5 #include "content/browser/browser_thread_impl.h"
6 6
7 #include "base/atomicops.h" 7 #include "base/atomicops.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 // Only atomic operations are used on this array. The delegates are not owned 50 // Only atomic operations are used on this array. The delegates are not owned
51 // by this array, rather by whoever calls BrowserThread::SetDelegate. 51 // by this array, rather by whoever calls BrowserThread::SetDelegate.
52 BrowserThreadDelegate* thread_delegates[BrowserThread::ID_COUNT]; 52 BrowserThreadDelegate* thread_delegates[BrowserThread::ID_COUNT];
53 53
54 // This pointer is deliberately leaked on shutdown. This allows the pool to 54 // This pointer is deliberately leaked on shutdown. This allows the pool to
55 // implement "continue on shutdown" semantics. 55 // implement "continue on shutdown" semantics.
56 base::SequencedWorkerPool* blocking_pool; 56 base::SequencedWorkerPool* blocking_pool;
57 }; 57 };
58 58
59 base::LazyInstance<BrowserThreadGlobals, 59 base::LazyInstance<BrowserThreadGlobals>::Leaky
60 base::LeakyLazyInstanceTraits<BrowserThreadGlobals> >
61 g_globals = LAZY_INSTANCE_INITIALIZER; 60 g_globals = LAZY_INSTANCE_INITIALIZER;
62 61
63 } // namespace 62 } // namespace
64 63
65 BrowserThreadImpl::BrowserThreadImpl(ID identifier) 64 BrowserThreadImpl::BrowserThreadImpl(ID identifier)
66 : Thread(g_browser_thread_names[identifier]), 65 : Thread(g_browser_thread_names[identifier]),
67 identifier_(identifier) { 66 identifier_(identifier) {
68 Initialize(); 67 Initialize();
69 } 68 }
70 69
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 AtomicWord* storage = reinterpret_cast<AtomicWord*>( 361 AtomicWord* storage = reinterpret_cast<AtomicWord*>(
363 &globals.thread_delegates[identifier]); 362 &globals.thread_delegates[identifier]);
364 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange( 363 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange(
365 storage, reinterpret_cast<AtomicWord>(delegate)); 364 storage, reinterpret_cast<AtomicWord>(delegate));
366 365
367 // This catches registration when previously registered. 366 // This catches registration when previously registered.
368 DCHECK(!delegate || !old_pointer); 367 DCHECK(!delegate || !old_pointer);
369 } 368 }
370 369
371 } // namespace content 370 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698