diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-04-05 17:15:33 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-04-11 07:47:18 +0000 |
commit | 7324afb043a0b1e623d8e8eb906cdc53bdeb4685 (patch) | |
tree | a3fe2d74ea9c9e142c390dac4ca0e219382ace46 /chromium/base/message_loop/message_loop.cc | |
parent | 6a4cabb866f66d4128a97cdc6d9d08ce074f1247 (diff) |
BASELINE: Update Chromium to 58.0.3029.54
Change-Id: I67f57065a7afdc8e4614adb5c0230281428df4d1
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'chromium/base/message_loop/message_loop.cc')
-rw-r--r-- | chromium/base/message_loop/message_loop.cc | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/chromium/base/message_loop/message_loop.cc b/chromium/base/message_loop/message_loop.cc index 2212941db9a..3d55920afdb 100644 --- a/chromium/base/message_loop/message_loop.cc +++ b/chromium/base/message_loop/message_loop.cc @@ -9,7 +9,6 @@ #include "base/bind.h" #include "base/compiler_specific.h" -#include "base/lazy_instance.h" #include "base/logging.h" #include "base/memory/ptr_util.h" #include "base/message_loop/message_pump_default.h" @@ -38,10 +37,11 @@ namespace base { 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> >::Leaky lazy_tls_ptr = - LAZY_INSTANCE_INITIALIZER; - +// loop, if one exists. +base::ThreadLocalPointer<MessageLoop>* GetTLSMessageLoop() { + static auto* lazy_tls_ptr = new base::ThreadLocalPointer<MessageLoop>(); + return lazy_tls_ptr; +} MessageLoop::MessagePumpFactory* message_pump_for_ui_factory_ = NULL; #if defined(OS_IOS) @@ -137,7 +137,7 @@ MessageLoop::~MessageLoop() { // OK, now make it so that no one can find us. if (current() == this) - lazy_tls_ptr.Pointer()->Set(nullptr); + GetTLSMessageLoop()->Set(nullptr); } // static @@ -145,7 +145,7 @@ MessageLoop* MessageLoop::current() { // TODO(darin): sadly, we cannot enable this yet since people call us even // when they have no intention of using us. // DCHECK(loop) << "Ouch, did you forget to initialize me?"; - return lazy_tls_ptr.Pointer()->Get(); + return GetTLSMessageLoop()->Get(); } // static @@ -320,7 +320,8 @@ MessageLoop::MessageLoop(Type type, MessagePumpFactoryCallback pump_factory) #endif nestable_tasks_allowed_(true), pump_factory_(pump_factory), - run_loop_(NULL), + run_loop_(nullptr), + current_pending_task_(nullptr), incoming_task_queue_(new internal::IncomingTaskQueue(this)), unbound_task_runner_( new internal::MessageLoopTaskRunner(incoming_task_queue_)), @@ -338,7 +339,7 @@ void MessageLoop::BindToCurrentThread() { pump_ = CreateMessagePumpForType(type_); DCHECK(!current()) << "should only have one message loop per thread"; - lazy_tls_ptr.Pointer()->Set(this); + GetTLSMessageLoop()->Set(this); incoming_task_queue_->StartScheduling(); unbound_task_runner_->BindToCurrentThread(); @@ -403,6 +404,7 @@ bool MessageLoop::ProcessNextDelayedNonNestableTask() { void MessageLoop::RunTask(PendingTask* pending_task) { DCHECK(nestable_tasks_allowed_); + current_pending_task_ = pending_task; #if defined(OS_WIN) if (pending_task->is_high_res) { @@ -423,6 +425,8 @@ void MessageLoop::RunTask(PendingTask* pending_task) { observer.DidProcessTask(*pending_task); nestable_tasks_allowed_ = true; + + current_pending_task_ = nullptr; } bool MessageLoop::DeferOrRunPendingTask(PendingTask pending_task) { |