OLD | NEW |
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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 | 490 |
491 WebThreadGlobals& globals = g_globals.Get(); | 491 WebThreadGlobals& globals = g_globals.Get(); |
492 base::AutoLock lock(globals.lock); | 492 base::AutoLock lock(globals.lock); |
493 base::Thread* thread = globals.threads[identifier]; | 493 base::Thread* thread = globals.threads[identifier]; |
494 DCHECK(thread); | 494 DCHECK(thread); |
495 base::MessageLoop* loop = thread->message_loop(); | 495 base::MessageLoop* loop = thread->message_loop(); |
496 return loop; | 496 return loop; |
497 } | 497 } |
498 | 498 |
499 // static | 499 // static |
500 void WebThreadImpl::SetDelegate(ID identifier, WebThreadDelegate* delegate) { | 500 void WebThread::SetDelegate(ID identifier, WebThreadDelegate* delegate) { |
501 using base::subtle::AtomicWord; | 501 using base::subtle::AtomicWord; |
502 WebThreadGlobals& globals = g_globals.Get(); | 502 WebThreadGlobals& globals = g_globals.Get(); |
503 AtomicWord* storage = | 503 AtomicWord* storage = |
504 reinterpret_cast<AtomicWord*>(&globals.thread_delegates[identifier]); | 504 reinterpret_cast<AtomicWord*>(&globals.thread_delegates[identifier]); |
505 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange( | 505 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange( |
506 storage, reinterpret_cast<AtomicWord>(delegate)); | 506 storage, reinterpret_cast<AtomicWord>(delegate)); |
507 | 507 |
508 // This catches registration when previously registered. | 508 // This catches registration when previously registered. |
509 DCHECK(!delegate || !old_pointer); | 509 DCHECK(!delegate || !old_pointer); |
510 } | 510 } |
511 | 511 |
512 } // namespace web | 512 } // namespace web |
OLD | NEW |