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

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

Issue 16092013: Use base::MessageLoop in more files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again, sigh Created 7 years, 6 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 <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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 return false; 450 return false;
451 } 451 }
452 452
453 // static 453 // static
454 scoped_refptr<base::MessageLoopProxy> 454 scoped_refptr<base::MessageLoopProxy>
455 BrowserThread::GetMessageLoopProxyForThread(ID identifier) { 455 BrowserThread::GetMessageLoopProxyForThread(ID identifier) {
456 return make_scoped_refptr(new BrowserThreadMessageLoopProxy(identifier)); 456 return make_scoped_refptr(new BrowserThreadMessageLoopProxy(identifier));
457 } 457 }
458 458
459 // static 459 // static
460 MessageLoop* BrowserThread::UnsafeGetMessageLoopForThread(ID identifier) { 460 base::MessageLoop* BrowserThread::UnsafeGetMessageLoopForThread(ID identifier) {
461 if (g_globals == NULL) 461 if (g_globals == NULL)
462 return NULL; 462 return NULL;
463 463
464 BrowserThreadGlobals& globals = g_globals.Get(); 464 BrowserThreadGlobals& globals = g_globals.Get();
465 base::AutoLock lock(globals.lock); 465 base::AutoLock lock(globals.lock);
466 base::Thread* thread = globals.threads[identifier]; 466 base::Thread* thread = globals.threads[identifier];
467 DCHECK(thread); 467 DCHECK(thread);
468 base::MessageLoop* loop = thread->message_loop(); 468 base::MessageLoop* loop = thread->message_loop();
469 return loop; 469 return loop;
470 } 470 }
471 471
472 // static 472 // static
473 void BrowserThread::SetDelegate(ID identifier, 473 void BrowserThread::SetDelegate(ID identifier,
474 BrowserThreadDelegate* delegate) { 474 BrowserThreadDelegate* delegate) {
475 using base::subtle::AtomicWord; 475 using base::subtle::AtomicWord;
476 BrowserThreadGlobals& globals = g_globals.Get(); 476 BrowserThreadGlobals& globals = g_globals.Get();
477 AtomicWord* storage = reinterpret_cast<AtomicWord*>( 477 AtomicWord* storage = reinterpret_cast<AtomicWord*>(
478 &globals.thread_delegates[identifier]); 478 &globals.thread_delegates[identifier]);
479 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange( 479 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange(
480 storage, reinterpret_cast<AtomicWord>(delegate)); 480 storage, reinterpret_cast<AtomicWord>(delegate));
481 481
482 // This catches registration when previously registered. 482 // This catches registration when previously registered.
483 DCHECK(!delegate || !old_pointer); 483 DCHECK(!delegate || !old_pointer);
484 } 484 }
485 485
486 } // namespace content 486 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/browser/gpu/browser_gpu_channel_host_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698