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

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

Issue 22031003: Rename BrowserThread::IsWellKnownThread to IsThreadInitialized. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Minor comment reword. Created 7 years, 4 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 | « chrome/test/base/testing_profile.cc ('k') | content/public/browser/browser_thread.h » ('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 "content/browser/browser_thread_impl.h" 5 #include "content/browser/browser_thread_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/atomicops.h" 9 #include "base/atomicops.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 return g_globals.Get().blocking_pool->PostNamedSequencedWorkerTask( 332 return g_globals.Get().blocking_pool->PostNamedSequencedWorkerTask(
333 sequence_token_name, from_here, task); 333 sequence_token_name, from_here, task);
334 } 334 }
335 335
336 // static 336 // static
337 base::SequencedWorkerPool* BrowserThread::GetBlockingPool() { 337 base::SequencedWorkerPool* BrowserThread::GetBlockingPool() {
338 return g_globals.Get().blocking_pool.get(); 338 return g_globals.Get().blocking_pool.get();
339 } 339 }
340 340
341 // static 341 // static
342 bool BrowserThread::IsWellKnownThread(ID identifier) { 342 bool BrowserThread::IsThreadInitialized(ID identifier) {
343 if (g_globals == NULL) 343 if (g_globals == NULL)
344 return false; 344 return false;
345 345
346 BrowserThreadGlobals& globals = g_globals.Get(); 346 BrowserThreadGlobals& globals = g_globals.Get();
347 base::AutoLock lock(globals.lock); 347 base::AutoLock lock(globals.lock);
348 return (identifier >= 0 && identifier < ID_COUNT && 348 DCHECK(identifier >= 0 && identifier < ID_COUNT);
349 globals.threads[identifier]); 349 return globals.threads[identifier] != NULL;
350 } 350 }
351 351
352 // static 352 // static
353 bool BrowserThread::CurrentlyOn(ID identifier) { 353 bool BrowserThread::CurrentlyOn(ID identifier) {
354 // We shouldn't use MessageLoop::current() since it uses LazyInstance which 354 // We shouldn't use MessageLoop::current() since it uses LazyInstance which
355 // may be deleted by ~AtExitManager when a WorkerPool thread calls this 355 // may be deleted by ~AtExitManager when a WorkerPool thread calls this
356 // function. 356 // function.
357 // http://crbug.com/63678 357 // http://crbug.com/63678
358 base::ThreadRestrictions::ScopedAllowSingleton allow_singleton; 358 base::ThreadRestrictions::ScopedAllowSingleton allow_singleton;
359 BrowserThreadGlobals& globals = g_globals.Get(); 359 BrowserThreadGlobals& globals = g_globals.Get();
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 AtomicWord* storage = reinterpret_cast<AtomicWord*>( 473 AtomicWord* storage = reinterpret_cast<AtomicWord*>(
474 &globals.thread_delegates[identifier]); 474 &globals.thread_delegates[identifier]);
475 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange( 475 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange(
476 storage, reinterpret_cast<AtomicWord>(delegate)); 476 storage, reinterpret_cast<AtomicWord>(delegate));
477 477
478 // This catches registration when previously registered. 478 // This catches registration when previously registered.
479 DCHECK(!delegate || !old_pointer); 479 DCHECK(!delegate || !old_pointer);
480 } 480 }
481 481
482 } // namespace content 482 } // namespace content
OLDNEW
« no previous file with comments | « chrome/test/base/testing_profile.cc ('k') | content/public/browser/browser_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698