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

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

Issue 2419803002: Disallow task observers on some BrowserThreads. (Closed)
Patch Set: 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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