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

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

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

Powered by Google App Engine
This is Rietveld 408576698