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

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

Issue 2079423002: Remove calls to MessageLoop::current() in ios. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « ios/crnet/crnet_environment.mm ('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 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 bool WebThread::CurrentlyOn(ID identifier) { 366 bool WebThread::CurrentlyOn(ID identifier) {
367 // This shouldn't use MessageLoop::current() since it uses LazyInstance which 367 // This shouldn't use MessageLoop::current() since it uses LazyInstance which
368 // may be deleted by ~AtExitManager when a WorkerPool thread calls this 368 // may be deleted by ~AtExitManager when a WorkerPool thread calls this
369 // function. 369 // function.
370 // http://crbug.com/63678 370 // http://crbug.com/63678
371 base::ThreadRestrictions::ScopedAllowSingleton allow_singleton; 371 base::ThreadRestrictions::ScopedAllowSingleton allow_singleton;
372 WebThreadGlobals& globals = g_globals.Get(); 372 WebThreadGlobals& globals = g_globals.Get();
373 base::AutoLock lock(globals.lock); 373 base::AutoLock lock(globals.lock);
374 DCHECK(identifier >= 0 && identifier < ID_COUNT); 374 DCHECK(identifier >= 0 && identifier < ID_COUNT);
375 return globals.threads[identifier] && 375 return globals.threads[identifier] &&
376 globals.threads[identifier]->message_loop() == 376 globals.threads[identifier]->task_runner()->BelongsToCurrentThread();
377 base::MessageLoop::current();
378 } 377 }
379 378
380 // static 379 // static
381 std::string WebThread::GetDCheckCurrentlyOnErrorMessage(ID expected) { 380 std::string WebThread::GetDCheckCurrentlyOnErrorMessage(ID expected) {
382 std::string actual_name = base::PlatformThread::GetName(); 381 std::string actual_name = base::PlatformThread::GetName();
383 if (actual_name.empty()) 382 if (actual_name.empty())
384 actual_name = "Unknown Thread"; 383 actual_name = "Unknown Thread";
385 384
386 std::string result = "Must be called on "; 385 std::string result = "Must be called on ";
387 result += GetThreadName(expected); 386 result += GetThreadName(expected);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 AtomicWord* storage = 495 AtomicWord* storage =
497 reinterpret_cast<AtomicWord*>(&globals.thread_delegates[identifier]); 496 reinterpret_cast<AtomicWord*>(&globals.thread_delegates[identifier]);
498 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange( 497 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange(
499 storage, reinterpret_cast<AtomicWord>(delegate)); 498 storage, reinterpret_cast<AtomicWord>(delegate));
500 499
501 // This catches registration when previously registered. 500 // This catches registration when previously registered.
502 DCHECK(!delegate || !old_pointer); 501 DCHECK(!delegate || !old_pointer);
503 } 502 }
504 503
505 } // namespace web 504 } // namespace web
OLDNEW
« no previous file with comments | « ios/crnet/crnet_environment.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698