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

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

Issue 2657603004: Clear PostTaskAndReply task on the destination thread (3) (Closed)
Patch Set: rebase Created 3 years, 10 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
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> 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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 // static 531 // static
532 bool BrowserThread::PostBlockingPoolTask( 532 bool BrowserThread::PostBlockingPoolTask(
533 const tracked_objects::Location& from_here, 533 const tracked_objects::Location& from_here,
534 const base::Closure& task) { 534 const base::Closure& task) {
535 return g_globals.Get().blocking_pool->PostWorkerTask(from_here, task); 535 return g_globals.Get().blocking_pool->PostWorkerTask(from_here, task);
536 } 536 }
537 537
538 // static 538 // static
539 bool BrowserThread::PostBlockingPoolTaskAndReply( 539 bool BrowserThread::PostBlockingPoolTaskAndReply(
540 const tracked_objects::Location& from_here, 540 const tracked_objects::Location& from_here,
541 const base::Closure& task, 541 base::Closure task,
542 const base::Closure& reply) { 542 base::Closure reply) {
543 return g_globals.Get().blocking_pool->PostTaskAndReply( 543 return g_globals.Get().blocking_pool->PostTaskAndReply(
544 from_here, task, reply); 544 from_here, std::move(task), std::move(reply));
545 } 545 }
546 546
547 // static 547 // static
548 bool BrowserThread::PostBlockingPoolSequencedTask( 548 bool BrowserThread::PostBlockingPoolSequencedTask(
549 const std::string& sequence_token_name, 549 const std::string& sequence_token_name,
550 const tracked_objects::Location& from_here, 550 const tracked_objects::Location& from_here,
551 const base::Closure& task) { 551 const base::Closure& task) {
552 return g_globals.Get().blocking_pool->PostNamedSequencedWorkerTask( 552 return g_globals.Get().blocking_pool->PostNamedSequencedWorkerTask(
553 sequence_token_name, from_here, task); 553 sequence_token_name, from_here, task);
554 } 554 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 bool BrowserThread::PostNonNestableDelayedTask( 646 bool BrowserThread::PostNonNestableDelayedTask(
647 ID identifier, 647 ID identifier,
648 const tracked_objects::Location& from_here, 648 const tracked_objects::Location& from_here,
649 const base::Closure& task, 649 const base::Closure& task,
650 base::TimeDelta delay) { 650 base::TimeDelta delay) {
651 return BrowserThreadImpl::PostTaskHelper( 651 return BrowserThreadImpl::PostTaskHelper(
652 identifier, from_here, task, delay, false); 652 identifier, from_here, task, delay, false);
653 } 653 }
654 654
655 // static 655 // static
656 bool BrowserThread::PostTaskAndReply( 656 bool BrowserThread::PostTaskAndReply(ID identifier,
657 ID identifier, 657 const tracked_objects::Location& from_here,
658 const tracked_objects::Location& from_here, 658 base::Closure task,
659 const base::Closure& task, 659 base::Closure reply) {
660 const base::Closure& reply) {
661 return GetTaskRunnerForThread(identifier) 660 return GetTaskRunnerForThread(identifier)
662 ->PostTaskAndReply(from_here, task, reply); 661 ->PostTaskAndReply(from_here, std::move(task), std::move(reply));
663 } 662 }
664 663
665 // static 664 // static
666 bool BrowserThread::GetCurrentThreadIdentifier(ID* identifier) { 665 bool BrowserThread::GetCurrentThreadIdentifier(ID* identifier) {
667 if (g_globals == nullptr) 666 if (g_globals == nullptr)
668 return false; 667 return false;
669 668
670 BrowserThreadGlobals& globals = g_globals.Get(); 669 BrowserThreadGlobals& globals = g_globals.Get();
671 // Profiler to track potential contention on |globals.lock|. This only does 670 // Profiler to track potential contention on |globals.lock|. This only does
672 // real work on canary and local dev builds, so the cost of having this here 671 // real work on canary and local dev builds, so the cost of having this here
(...skipping 23 matching lines...) Expand all
696 BrowserThreadDelegateAtomicPtr old_delegate = 695 BrowserThreadDelegateAtomicPtr old_delegate =
697 base::subtle::NoBarrier_AtomicExchange( 696 base::subtle::NoBarrier_AtomicExchange(
698 &globals.io_thread_delegate, 697 &globals.io_thread_delegate,
699 reinterpret_cast<BrowserThreadDelegateAtomicPtr>(delegate)); 698 reinterpret_cast<BrowserThreadDelegateAtomicPtr>(delegate));
700 699
701 // This catches registration when previously registered. 700 // This catches registration when previously registered.
702 DCHECK(!delegate || !old_delegate); 701 DCHECK(!delegate || !old_delegate);
703 } 702 }
704 703
705 } // namespace content 704 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698