diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-10-13 13:24:50 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-10-14 10:57:25 +0000 |
commit | af3d4809763ef308f08ced947a73b624729ac7ea (patch) | |
tree | 4402b911e30383f6c6dace1e8cf3b8e85355db3a /chromium/base/message_loop/message_loop.cc | |
parent | 0e8ff63a407fe323e215bb1a2c423c09a4747c8a (diff) |
BASELINE: Update Chromium to 47.0.2526.14
Also adding in sources needed for spellchecking.
Change-Id: Idd44170fa1616f26315188970a8d5ba7d472b18a
Reviewed-by: Michael BrĂ¼ning <michael.bruning@theqtcompany.com>
Diffstat (limited to 'chromium/base/message_loop/message_loop.cc')
-rw-r--r-- | chromium/base/message_loop/message_loop.cc | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/chromium/base/message_loop/message_loop.cc b/chromium/base/message_loop/message_loop.cc index 4fecbc5a603..a44f46863e4 100644 --- a/chromium/base/message_loop/message_loop.cc +++ b/chromium/base/message_loop/message_loop.cc @@ -19,6 +19,7 @@ #include "base/thread_task_runner_handle.h" #include "base/threading/thread_local.h" #include "base/time/time.h" +#include "base/trace_event/trace_event.h" #include "base/tracked_objects.h" #if defined(OS_MACOSX) @@ -43,7 +44,7 @@ namespace { LazyInstance<base::ThreadLocalPointer<MessageLoop> >::Leaky lazy_tls_ptr = LAZY_INSTANCE_INITIALIZER; -// Logical events for Histogram profiling. Run with -message-loop-histogrammer +// Logical events for Histogram profiling. Run with --message-loop-histogrammer // to get an accounting of messages and actions taken on each thread. const int kTaskRunEvent = 0x1; #if !defined(OS_NACL) @@ -55,9 +56,9 @@ const int kMaxMessageId = 1099; const int kNumberOfDistinctMessagesDisplayed = 1100; // Provide a macro that takes an expression (such as a constant, or macro -// constant) and creates a pair to initalize an array of pairs. In this case, +// constant) and creates a pair to initialize an array of pairs. In this case, // our pair consists of the expressions value, and the "stringized" version -// of the expression (i.e., the exrpression put in quotes). For example, if +// of the expression (i.e., the expression put in quotes). For example, if // we have: // #define FOO 2 // #define BAR 5 @@ -78,7 +79,7 @@ const LinearHistogram::DescriptionPair event_descriptions_[] = { VALUE_TO_NUMBER_AND_NAME(kTaskRunEvent) VALUE_TO_NUMBER_AND_NAME(kTimerEvent) - {-1, NULL} // The list must be null terminated, per API to histogram. + {-1, NULL} // The list must be null-terminated, per API to histogram. }; #endif // !defined(OS_NACL) @@ -361,7 +362,7 @@ bool MessageLoop::HasHighResolutionTasks() { } bool MessageLoop::IsIdleForTesting() { - // We only check the imcoming queue|, since we don't want to lock the work + // We only check the incoming queue, since we don't want to lock the work // queue. return incoming_task_queue_->IsIdleForTesting(); } @@ -407,7 +408,8 @@ void MessageLoop::BindToCurrentThread() { incoming_task_queue_->StartScheduling(); unbound_task_runner_->BindToCurrentThread(); - SetTaskRunner(unbound_task_runner_.Pass()); + unbound_task_runner_ = nullptr; + SetThreadTaskRunnerHandle(); } void MessageLoop::SetTaskRunner( @@ -416,7 +418,12 @@ void MessageLoop::SetTaskRunner( DCHECK(task_runner->BelongsToCurrentThread()); DCHECK(!unbound_task_runner_); task_runner_ = task_runner.Pass(); - // Clear the previous thread task runner first because only one can exist at + SetThreadTaskRunnerHandle(); +} + +void MessageLoop::SetThreadTaskRunnerHandle() { + DCHECK_EQ(this, current()); + // Clear the previous thread task runner first, because only one can exist at // a time. thread_task_runner_handle_.reset(); thread_task_runner_handle_.reset(new ThreadTaskRunnerHandle(task_runner_)); @@ -467,10 +474,11 @@ void MessageLoop::RunTask(const PendingTask& pending_task) { HistogramEvent(kTaskRunEvent); + TRACE_TASK_EXECUTION("MessageLoop::RunTask", pending_task); + FOR_EACH_OBSERVER(TaskObserver, task_observers_, WillProcessTask(pending_task)); - task_annotator_.RunTask( - "MessageLoop::PostTask", "MessageLoop::RunTask", pending_task); + task_annotator_.RunTask("MessageLoop::PostTask", pending_task); FOR_EACH_OBSERVER(TaskObserver, task_observers_, DidProcessTask(pending_task)); @@ -557,7 +565,7 @@ void MessageLoop::StartHistogrammer() { "MsgLoop:" + thread_name_, kLeastNonZeroMessageId, kMaxMessageId, kNumberOfDistinctMessagesDisplayed, - message_histogram_->kHexRangePrintingFlag, + HistogramBase::kHexRangePrintingFlag, event_descriptions_); } #endif @@ -607,7 +615,7 @@ bool MessageLoop::DoDelayedWork(TimeTicks* next_delayed_work_time) { return false; } - // When we "fall behind," there will be a lot of tasks in the delayed work + // When we "fall behind", there will be a lot of tasks in the delayed work // queue that are ready to run. To increase efficiency when we fall behind, // we will only call Time::Now() intermittently, and then process all tasks // that are ready to run before calling it again. As a result, the more we |