Index: third_party/WebKit/Source/platform/scheduler/test/lazy_scheduler_message_loop_delegate_for_tests.cc |
diff --git a/third_party/WebKit/Source/platform/scheduler/test/lazy_scheduler_message_loop_delegate_for_tests.cc b/third_party/WebKit/Source/platform/scheduler/test/lazy_scheduler_message_loop_delegate_for_tests.cc |
index bd41c59fef331ffed136343a1e3a45d4f71680ac..0a0d08baeba30add86aa15923f39df47ad88fc22 100644 |
--- a/third_party/WebKit/Source/platform/scheduler/test/lazy_scheduler_message_loop_delegate_for_tests.cc |
+++ b/third_party/WebKit/Source/platform/scheduler/test/lazy_scheduler_message_loop_delegate_for_tests.cc |
@@ -7,6 +7,7 @@ |
#include <utility> |
#include "base/memory/ptr_util.h" |
+#include "base/run_loop.h" |
#include "base/time/default_tick_clock.h" |
namespace blink { |
@@ -22,8 +23,7 @@ LazySchedulerMessageLoopDelegateForTests:: |
LazySchedulerMessageLoopDelegateForTests() |
: message_loop_(base::MessageLoop::current()), |
thread_id_(base::PlatformThread::CurrentId()), |
- time_source_(base::MakeUnique<base::DefaultTickClock>()), |
- pending_observer_(nullptr) { |
+ time_source_(base::MakeUnique<base::DefaultTickClock>()) { |
if (message_loop_) |
original_task_runner_ = message_loop_->task_runner(); |
} |
@@ -43,8 +43,6 @@ base::MessageLoop* LazySchedulerMessageLoopDelegateForTests::EnsureMessageLoop() |
original_task_runner_ = message_loop_->task_runner(); |
if (pending_task_runner_) |
message_loop_->SetTaskRunner(std::move(pending_task_runner_)); |
- if (pending_observer_) |
- message_loop_->AddNestingObserver(pending_observer_); |
return message_loop_; |
} |
@@ -90,26 +88,19 @@ bool LazySchedulerMessageLoopDelegateForTests::RunsTasksOnCurrentThread() |
} |
bool LazySchedulerMessageLoopDelegateForTests::IsNested() const { |
- return EnsureMessageLoop()->IsNested(); |
+ DCHECK(RunsTasksOnCurrentThread()); |
+ EnsureMessageLoop(); |
+ return base::RunLoop::IsNestedOnCurrentThread(); |
} |
void LazySchedulerMessageLoopDelegateForTests::AddNestingObserver( |
- base::MessageLoop::NestingObserver* observer) { |
- if (!HasMessageLoop()) { |
- pending_observer_ = observer; |
- return; |
- } |
- message_loop_->AddNestingObserver(observer); |
+ base::RunLoop::NestingObserver* observer) { |
+ base::RunLoop::AddNestingObserverOnCurrentThread(observer); |
} |
void LazySchedulerMessageLoopDelegateForTests::RemoveNestingObserver( |
- base::MessageLoop::NestingObserver* observer) { |
- if (!message_loop_ || message_loop_ != base::MessageLoop::current()) { |
- DCHECK_EQ(pending_observer_, observer); |
- pending_observer_ = nullptr; |
- return; |
- } |
- message_loop_->RemoveNestingObserver(observer); |
+ base::RunLoop::NestingObserver* observer) { |
+ base::RunLoop::AddNestingObserverOnCurrentThread(observer); |
} |
base::TimeTicks LazySchedulerMessageLoopDelegateForTests::NowTicks() { |