diff options
author | Andras Becsi <andras.becsi@digia.com> | 2013-12-11 21:33:03 +0100 |
---|---|---|
committer | Andras Becsi <andras.becsi@digia.com> | 2013-12-13 12:34:07 +0100 |
commit | f2a33ff9cbc6d19943f1c7fbddd1f23d23975577 (patch) | |
tree | 0586a32aa390ade8557dfd6b4897f43a07449578 /chromium/base/message_loop/message_loop.cc | |
parent | 5362912cdb5eea702b68ebe23702468d17c3017a (diff) |
Update Chromium to branch 1650 (31.0.1650.63)
Change-Id: I57d8c832eaec1eb2364e0a8e7352a6dd354db99f
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'chromium/base/message_loop/message_loop.cc')
-rw-r--r-- | chromium/base/message_loop/message_loop.cc | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/chromium/base/message_loop/message_loop.cc b/chromium/base/message_loop/message_loop.cc index 826c7573ee6..87a0b631735 100644 --- a/chromium/base/message_loop/message_loop.cc +++ b/chromium/base/message_loop/message_loop.cc @@ -44,7 +44,7 @@ namespace { // A lazily created thread local storage for quick access to a thread's message // loop, if one exists. This should be safe and free of static constructors. -LazyInstance<base::ThreadLocalPointer<MessageLoop> > lazy_tls_ptr = +LazyInstance<base::ThreadLocalPointer<MessageLoop> >::Leaky lazy_tls_ptr = LAZY_INSTANCE_INITIALIZER; // Logical events for Histogram profiling. Run with -message-loop-histogrammer @@ -184,6 +184,10 @@ MessageLoop::MessageLoop(Type type) pump_.reset(MESSAGE_PUMP_UI); } else if (type_ == TYPE_IO) { pump_.reset(MESSAGE_PUMP_IO); +#if defined(TOOLKIT_GTK) + } else if (type_ == TYPE_GPU) { + pump_.reset(new MessagePumpX11()); +#endif #if defined(OS_ANDROID) } else if (type_ == TYPE_JAVA) { pump_.reset(MESSAGE_PUMP_UI); @@ -425,7 +429,8 @@ void MessageLoop::RunInternal() { StartHistogrammer(); -#if !defined(OS_MACOSX) && !defined(OS_ANDROID) +#if !defined(OS_MACOSX) && !defined(OS_ANDROID) && \ + !defined(USE_GTK_MESSAGE_PUMP) if (run_loop_->dispatcher_ && type() == TYPE_UI) { static_cast<MessagePumpForUI*>(pump_.get())-> RunWithDispatcher(this, run_loop_->dispatcher_); @@ -458,9 +463,13 @@ void MessageLoop::RunTask(const PendingTask& pending_task) { TRACE_ID_MANGLE(GetTaskTraceID(pending_task)), "queue_duration", (start_time - pending_task.EffectiveTimePosted()).InMilliseconds()); - TRACE_EVENT2("task", "MessageLoop::RunTask", - "src_file", pending_task.posted_from.file_name(), - "src_func", pending_task.posted_from.function_name()); + // When tracing memory for posted tasks it's more valuable to attribute the + // memory allocations to the source function than generically to "RunTask". + TRACE_EVENT_WITH_MEMORY_TAG2( + "task", "MessageLoop::RunTask", + pending_task.posted_from.function_name(), // Name for memory tracking. + "src_file", pending_task.posted_from.file_name(), + "src_func", pending_task.posted_from.function_name()); DCHECK(nestable_tasks_allowed_); // Execute the task and assume the worst: It is probably not reentrant. @@ -539,7 +548,7 @@ bool MessageLoop::DeletePendingTasks() { uint64 MessageLoop::GetTaskTraceID(const PendingTask& task) { return (static_cast<uint64>(task.sequence_num) << 32) | - static_cast<uint64>(reinterpret_cast<intptr_t>(this)); + ((static_cast<uint64>(reinterpret_cast<intptr_t>(this)) << 32) >> 32); } void MessageLoop::ReloadWorkQueue() { @@ -656,6 +665,20 @@ bool MessageLoop::DoIdleWork() { return false; } +void MessageLoop::GetQueueingInformation(size_t* queue_size, + TimeDelta* queueing_delay) { + *queue_size = work_queue_.size(); + if (*queue_size == 0) { + *queueing_delay = TimeDelta(); + return; + } + + const PendingTask& next_to_run = work_queue_.front(); + tracked_objects::Duration duration = + tracked_objects::TrackedTime::Now() - next_to_run.EffectiveTimePosted(); + *queueing_delay = TimeDelta::FromMilliseconds(duration.InMilliseconds()); +} + void MessageLoop::DeleteSoonInternal(const tracked_objects::Location& from_here, void(*deleter)(const void*), const void* object) { |