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

Side by Side Diff: ios/web/web_thread_impl.cc

Issue 2473823002: Remove BrowserThread::UnsafeGetMessageLoopForThread() (Closed)
Patch Set: rebase again? Created 4 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
« no previous file with comments | « ios/web/public/web_thread.h ('k') | ios/web/webui/url_data_manager_ios_backend.mm » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ios/web/web_thread_impl.h" 5 #include "ios/web/web_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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 return false; 474 return false;
475 } 475 }
476 476
477 // static 477 // static
478 scoped_refptr<base::SingleThreadTaskRunner> WebThread::GetTaskRunnerForThread( 478 scoped_refptr<base::SingleThreadTaskRunner> WebThread::GetTaskRunnerForThread(
479 ID identifier) { 479 ID identifier) {
480 return g_task_runners.Get().task_runners[identifier]; 480 return g_task_runners.Get().task_runners[identifier];
481 } 481 }
482 482
483 // static 483 // static
484 base::MessageLoop* WebThread::UnsafeGetMessageLoopForThread(ID identifier) {
485 if (g_globals == nullptr)
486 return nullptr;
487
488 WebThreadGlobals& globals = g_globals.Get();
489 base::AutoLock lock(globals.lock);
490 base::Thread* thread = globals.threads[identifier];
491 DCHECK(thread);
492 base::MessageLoop* loop = thread->message_loop();
493 return loop;
494 }
495
496 // static
497 void WebThread::SetDelegate(ID identifier, WebThreadDelegate* delegate) { 484 void WebThread::SetDelegate(ID identifier, WebThreadDelegate* delegate) {
498 using base::subtle::AtomicWord; 485 using base::subtle::AtomicWord;
499 WebThreadGlobals& globals = g_globals.Get(); 486 WebThreadGlobals& globals = g_globals.Get();
500 AtomicWord* storage = 487 AtomicWord* storage =
501 reinterpret_cast<AtomicWord*>(&globals.thread_delegates[identifier]); 488 reinterpret_cast<AtomicWord*>(&globals.thread_delegates[identifier]);
502 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange( 489 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange(
503 storage, reinterpret_cast<AtomicWord>(delegate)); 490 storage, reinterpret_cast<AtomicWord>(delegate));
504 491
505 // This catches registration when previously registered. 492 // This catches registration when previously registered.
506 DCHECK(!delegate || !old_pointer); 493 DCHECK(!delegate || !old_pointer);
507 } 494 }
508 495
509 } // namespace web 496 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/public/web_thread.h ('k') | ios/web/webui/url_data_manager_ios_backend.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698