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

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

Issue 2407313002: Disallow nesting on some BrowserThreads. (Closed)
Patch Set: self-review Created 4 years, 2 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 | « base/message_loop/message_loop.cc ('k') | no next file » | 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.h> 7 #include <string.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // We don't want to create a pool if none exists. 178 // We don't want to create a pool if none exists.
179 if (g_globals == nullptr) 179 if (g_globals == nullptr)
180 return; 180 return;
181 g_globals.Get().blocking_pool->FlushForTesting(); 181 g_globals.Get().blocking_pool->FlushForTesting();
182 disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting(); 182 disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting();
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) ||
189 BrowserThread::CurrentlyOn(BrowserThread::FILE) ||
190 BrowserThread::CurrentlyOn(BrowserThread::FILE_USER_BLOCKING) ||
191 BrowserThread::CurrentlyOn(BrowserThread::PROCESS_LAUNCHER) ||
192 BrowserThread::CurrentlyOn(BrowserThread::CACHE)) {
193 base::MessageLoop::current()->DisallowNesting();
194 }
195
188 using base::subtle::AtomicWord; 196 using base::subtle::AtomicWord;
189 AtomicWord* storage = 197 AtomicWord* storage =
190 reinterpret_cast<AtomicWord*>(&globals.thread_delegates[identifier_]); 198 reinterpret_cast<AtomicWord*>(&globals.thread_delegates[identifier_]);
191 AtomicWord stored_pointer = base::subtle::NoBarrier_Load(storage); 199 AtomicWord stored_pointer = base::subtle::NoBarrier_Load(storage);
192 BrowserThreadDelegate* delegate = 200 BrowserThreadDelegate* delegate =
193 reinterpret_cast<BrowserThreadDelegate*>(stored_pointer); 201 reinterpret_cast<BrowserThreadDelegate*>(stored_pointer);
194 if (delegate) 202 if (delegate)
195 delegate->Init(); 203 delegate->Init();
196 } 204 }
197 205
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 AtomicWord* storage = reinterpret_cast<AtomicWord*>( 590 AtomicWord* storage = reinterpret_cast<AtomicWord*>(
583 &globals.thread_delegates[identifier]); 591 &globals.thread_delegates[identifier]);
584 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange( 592 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange(
585 storage, reinterpret_cast<AtomicWord>(delegate)); 593 storage, reinterpret_cast<AtomicWord>(delegate));
586 594
587 // This catches registration when previously registered. 595 // This catches registration when previously registered.
588 DCHECK(!delegate || !old_pointer); 596 DCHECK(!delegate || !old_pointer);
589 } 597 }
590 598
591 } // namespace content 599 } // namespace content
OLDNEW
« no previous file with comments | « base/message_loop/message_loop.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698