| OLD | NEW |
| 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.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 } | 183 } |
| 184 | 184 |
| 185 void BrowserThreadImpl::Init() { | 185 void BrowserThreadImpl::Init() { |
| 186 BrowserThreadGlobals& globals = g_globals.Get(); | 186 BrowserThreadGlobals& globals = g_globals.Get(); |
| 187 | 187 |
| 188 if (BrowserThread::CurrentlyOn(BrowserThread::DB) || | 188 if (BrowserThread::CurrentlyOn(BrowserThread::DB) || |
| 189 BrowserThread::CurrentlyOn(BrowserThread::FILE) || | 189 BrowserThread::CurrentlyOn(BrowserThread::FILE) || |
| 190 BrowserThread::CurrentlyOn(BrowserThread::FILE_USER_BLOCKING) || | 190 BrowserThread::CurrentlyOn(BrowserThread::FILE_USER_BLOCKING) || |
| 191 BrowserThread::CurrentlyOn(BrowserThread::PROCESS_LAUNCHER) || | 191 BrowserThread::CurrentlyOn(BrowserThread::PROCESS_LAUNCHER) || |
| 192 BrowserThread::CurrentlyOn(BrowserThread::CACHE)) { | 192 BrowserThread::CurrentlyOn(BrowserThread::CACHE)) { |
| 193 base::MessageLoop::current()->DisallowNesting(); | 193 base::MessageLoop* message_loop = base::MessageLoop::current(); |
| 194 message_loop->DisallowNesting(); |
| 195 message_loop->DisallowTaskObservers(); |
| 194 } | 196 } |
| 195 | 197 |
| 196 using base::subtle::AtomicWord; | 198 using base::subtle::AtomicWord; |
| 197 AtomicWord* storage = | 199 AtomicWord* storage = |
| 198 reinterpret_cast<AtomicWord*>(&globals.thread_delegates[identifier_]); | 200 reinterpret_cast<AtomicWord*>(&globals.thread_delegates[identifier_]); |
| 199 AtomicWord stored_pointer = base::subtle::NoBarrier_Load(storage); | 201 AtomicWord stored_pointer = base::subtle::NoBarrier_Load(storage); |
| 200 BrowserThreadDelegate* delegate = | 202 BrowserThreadDelegate* delegate = |
| 201 reinterpret_cast<BrowserThreadDelegate*>(stored_pointer); | 203 reinterpret_cast<BrowserThreadDelegate*>(stored_pointer); |
| 202 if (delegate) | 204 if (delegate) |
| 203 delegate->Init(); | 205 delegate->Init(); |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 AtomicWord* storage = reinterpret_cast<AtomicWord*>( | 592 AtomicWord* storage = reinterpret_cast<AtomicWord*>( |
| 591 &globals.thread_delegates[identifier]); | 593 &globals.thread_delegates[identifier]); |
| 592 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange( | 594 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange( |
| 593 storage, reinterpret_cast<AtomicWord>(delegate)); | 595 storage, reinterpret_cast<AtomicWord>(delegate)); |
| 594 | 596 |
| 595 // This catches registration when previously registered. | 597 // This catches registration when previously registered. |
| 596 DCHECK(!delegate || !old_pointer); | 598 DCHECK(!delegate || !old_pointer); |
| 597 } | 599 } |
| 598 | 600 |
| 599 } // namespace content | 601 } // namespace content |
| OLD | NEW |