Commit 2163f301 authored by Etienne Pierre-doray's avatar Etienne Pierre-doray Committed by Commit Bot

[base]: Rename DoSomeWork()->DoWork()

Since old DoWork/DoDelayedWork() was removed completely.

Bug: 885371
Change-Id: I3e59d89ace56900859bbb1359d36cb54c7981b47
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2130823Reviewed-by: default avatarFrançois Doray <fdoray@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756010}
parent 4523ec57
......@@ -37,9 +37,9 @@ class BASE_EXPORT MessagePump {
virtual ~Delegate() = default;
// Called before a unit of work internal to the message pump is executed.
// This allows reports about individual units of work to be produced.
// The unit of work ends when BeforeDoInternalWork() is called again, or
// when BeforeWait(), DoSomeWork(), or DoIdleWork() is called.
// This allows reports about individual units of work to be produced. The
// unit of work ends when BeforeDoInternalWork() is called again, or when
// BeforeWait(), DoWork(), or DoIdleWork() is called.
// TODO(crbug.com/851163): Place calls for all platforms.
virtual void BeforeDoInternalWork() = 0;
......@@ -72,14 +72,14 @@ class BASE_EXPORT MessagePump {
};
// Executes an immediate task or a ripe delayed task. Returns information
// about when DoSomeWork() should be called again. If the returned
// NextWorkInfo is_immediate(), DoSomeWork() must be invoked again shortly.
// Else, DoSomeWork() must be invoked at |NextWorkInfo::delayed_run_time| or
// when ScheduleWork() is invoked, whichever comes first. Redundant/spurious
// invocations of DoSomeWork() outside of those requirements are tolerated.
// about when DoWork() should be called again. If the returned NextWorkInfo
// is_immediate(), DoWork() must be invoked again shortly. Else, DoWork()
// must be invoked at |NextWorkInfo::delayed_run_time| or when
// ScheduleWork() is invoked, whichever comes first. Redundant/spurious
// invocations of DoWork() outside of those requirements are tolerated.
// DoIdleWork() will not be called so long as this returns a NextWorkInfo
// which is_immediate().
virtual NextWorkInfo DoSomeWork() = 0;
virtual NextWorkInfo DoWork() = 0;
// Called from within Run just before the message pump goes to sleep.
// Returns true to indicate that idle work was done. Returning false means
......@@ -106,7 +106,7 @@ class BASE_EXPORT MessagePump {
// if (should_quit_)
// break;
//
// Delegate::NextWorkInfo next_work_info = delegate->DoSomeWork();
// Delegate::NextWorkInfo next_work_info = delegate->DoWork();
// if (should_quit_)
// break;
//
......@@ -129,9 +129,9 @@ class BASE_EXPORT MessagePump {
// completion (for example). WaitForWork is a private method that simply
// blocks until there is more work of any type to do.
//
// Notice that the run loop cycles between calling DoInternalWork and
// DoSomeWork methods. This helps ensure that none of these work queues starve
// the others. This is important for message pumps that are used to drive
// Notice that the run loop cycles between calling DoInternalWork and DoWork
// methods. This helps ensure that none of these work queues starve the
// others. This is important for message pumps that are used to drive
// animations, for example.
//
// Notice also that after each callout to foreign code, the run loop checks to
......@@ -139,42 +139,42 @@ class BASE_EXPORT MessagePump {
// flag. No further work is done once the quit flag is set.
//
// NOTE 1: Run may be called reentrantly from any of the callouts to foreign
// code (internal work, DoSomeWork, DoIdleWork). As a result, DoSomeWork and
// code (internal work, DoWork, DoIdleWork). As a result, DoWork and
// DoIdleWork must be reentrant.
//
// NOTE 2: Run implementations must arrange for DoSomeWork to be invoked as
// NOTE 2: Run implementations must arrange for DoWork to be invoked as
// expected if a callout to foreign code enters a message pump outside their
// control. For example, the MessageBox API on Windows pumps UI messages. If
// the MessageBox API is called (indirectly) from within Run, it is expected
// that DoSomeWork will be invoked from within that call in response to
// ScheduleWork or as requested by the last NextWorkInfo returned by
// DoSomeWork. The MessagePump::Delegate may then elect to do nested work or
// not depending on its policy in that context. Regardless of that decision
// (and return value of the nested DoSomeWork() call), DoSomeWork() will be
// invoked again when the nested loop unwinds.
// that DoWork will be invoked from within that call in response to
// ScheduleWork or as requested by the last NextWorkInfo returned by DoWork.
// The MessagePump::Delegate may then elect to do nested work or not depending
// on its policy in that context. Regardless of that decision (and return
// value of the nested DoWork() call), DoWork() will be invoked again when the
// nested loop unwinds.
virtual void Run(Delegate* delegate) = 0;
// Quit immediately from the most recently entered run loop. This method may
// only be used on the thread that called Run.
virtual void Quit() = 0;
// Schedule a DoSomeWork callback to happen reasonably soon. Does nothing if
// a DoSomeWork callback is already scheduled. Once this call is made,
// DoSomeWork is guaranteed to be called repeatedly at least until it returns
// a non-immediate NextWorkInfo. This call can be expensive and callers should
// Schedule a DoWork callback to happen reasonably soon. Does nothing if a
// DoWork callback is already scheduled. Once this call is made, DoWork is
// guaranteed to be called repeatedly at least until it returns a
// non-immediate NextWorkInfo. This call can be expensive and callers should
// attempt not to invoke it again before a non-immediate NextWorkInfo was
// returned from DoSomeWork(). Thread-safe (and callers should avoid holding a
// returned from DoWork(). Thread-safe (and callers should avoid holding a
// Lock at all cost while making this call as some platforms' priority
// boosting features have been observed to cause the caller to get descheduled
// : https://crbug.com/890978).
virtual void ScheduleWork() = 0;
// Schedule a DoSomeWork callback to happen at the specified time, cancelling
// any pending callback scheduled by this method. This method may only be used
// on the thread that called Run.
// Schedule a DoWork callback to happen at the specified time, cancelling any
// pending callback scheduled by this method. This method may only be used on
// the thread that called Run.
//
// It isn't necessary to call this during normal execution, as the pump wakes
// up as requested by the return value of DoSomeWork().
// up as requested by the return value of DoWork().
// TODO(crbug.com/885371): Determine if this must be called to ensure that
// delayed tasks run when a message pump outside the control of Run is
// entered.
......
......@@ -152,7 +152,7 @@ void MessagePumpForUI::OnDelayedLooperCallback() {
delayed_scheduled_time_.reset();
Delegate::NextWorkInfo next_work_info = delegate_->DoSomeWork();
Delegate::NextWorkInfo next_work_info = delegate_->DoWork();
if (ShouldQuit())
return;
......@@ -187,7 +187,7 @@ void MessagePumpForUI::OnNonDelayedLooperCallback() {
// We're about to process all the work requested by ScheduleWork().
// MessagePump users are expected to do their best not to invoke
// ScheduleWork() again before DoSomeWork() returns a non-immediate
// ScheduleWork() again before DoWork() returns a non-immediate
// NextWorkInfo below. Hence, capturing the file descriptor's value now and
// resetting its contents to 0 should be okay. The value currently stored
// should be greater than 0 since work having been scheduled is the reason
......@@ -197,7 +197,7 @@ void MessagePumpForUI::OnNonDelayedLooperCallback() {
DPCHECK(ret >= 0);
DCHECK_GT(pre_work_value, 0U);
// Note: We can't skip DoSomeWork() even if
// Note: We can't skip DoWork() even if
// |pre_work_value == kTryNativeTasksBeforeIdleBit| here (i.e. no additional
// ScheduleWork() since yielding to native) as delayed tasks might have come
// in and we need to re-sample |next_work_info|.
......@@ -208,7 +208,7 @@ void MessagePumpForUI::OnNonDelayedLooperCallback() {
if (ShouldQuit())
return;
next_work_info = delegate_->DoSomeWork();
next_work_info = delegate_->DoWork();
} while (next_work_info.is_immediate());
// Do not resignal |non_delayed_fd_| if we're quitting (this pump doesn't
......
......@@ -36,7 +36,7 @@ void MessagePumpDefault::Run(Delegate* delegate) {
mac::ScopedNSAutoreleasePool autorelease_pool;
#endif
Delegate::NextWorkInfo next_work_info = delegate->DoSomeWork();
Delegate::NextWorkInfo next_work_info = delegate->DoWork();
bool has_more_immediate_work = next_work_info.is_immediate();
if (!keep_running_)
break;
......
......@@ -271,7 +271,7 @@ void MessagePumpFuchsia::Run(Delegate* delegate) {
AutoReset<bool> auto_reset_keep_running(&keep_running_, true);
for (;;) {
const Delegate::NextWorkInfo next_work_info = delegate->DoSomeWork();
const Delegate::NextWorkInfo next_work_info = delegate->DoWork();
if (!keep_running_)
break;
......
......@@ -94,8 +94,8 @@ int GetTimeIntervalMilliseconds(TimeTicks next_task_time) {
//
// For the GLib pump we try to follow the Windows UI pump model:
// - Whenever we receive a wakeup event or the timer for delayed work expires,
// we run DoSomeWork. That part will also run in the other event pumps.
// - We also run DoSomeWork, and possibly DoIdleWork, in the main loop,
// we run DoWork. That part will also run in the other event pumps.
// - We also run DoWork, and possibly DoIdleWork, in the main loop,
// around event handling.
struct WorkSource : public GSource {
......@@ -406,7 +406,7 @@ bool MessagePumpGlib::HandleCheck() {
}
void MessagePumpGlib::HandleDispatch() {
state_->next_work_info = state_->delegate->DoSomeWork();
state_->next_work_info = state_->delegate->DoWork();
}
void MessagePumpGlib::Run(Delegate* delegate) {
......@@ -440,7 +440,7 @@ void MessagePumpGlib::Run(Delegate* delegate) {
if (state_->should_quit)
break;
state_->next_work_info = state_->delegate->DoSomeWork();
state_->next_work_info = state_->delegate->DoWork();
more_work_is_plausible |= state_->next_work_info.is_immediate();
if (state_->should_quit)
break;
......
......@@ -152,7 +152,7 @@ void MessagePumpKqueue::Run(Delegate* delegate) {
if (!keep_running_)
break;
Delegate::NextWorkInfo next_work_info = delegate->DoSomeWork();
Delegate::NextWorkInfo next_work_info = delegate->DoWork();
do_more_work |= next_work_info.is_immediate();
if (!keep_running_)
break;
......@@ -197,7 +197,7 @@ void MessagePumpKqueue::ScheduleWork() {
void MessagePumpKqueue::ScheduleDelayedWork(
const TimeTicks& delayed_work_time) {
// Nothing to do. This MessagePump uses DoSomeWork().
// Nothing to do. This MessagePump uses DoWork().
}
bool MessagePumpKqueue::WatchMachReceivePort(
......
......@@ -205,7 +205,7 @@ void MessagePumpLibevent::Run(Delegate* delegate) {
mac::ScopedNSAutoreleasePool autorelease_pool;
#endif
// Do some work and see if the next task is ready right away.
Delegate::NextWorkInfo next_work_info = delegate->DoSomeWork();
Delegate::NextWorkInfo next_work_info = delegate->DoWork();
bool immediate_work_available = next_work_info.is_immediate();
if (!keep_running_)
......
......@@ -496,7 +496,7 @@ bool MessagePumpCFRunLoopBase::RunWork() {
// released promptly even in the absence of UI events.
MessagePumpScopedAutoreleasePool autorelease_pool(this);
Delegate::NextWorkInfo next_work_info = delegate_->DoSomeWork();
Delegate::NextWorkInfo next_work_info = delegate_->DoWork();
if (next_work_info.is_immediate()) {
CFRunLoopSourceSignal(work_source_);
......
......@@ -39,7 +39,7 @@ class MockMessagePumpDelegate : public MessagePump::Delegate {
// MessagePump::Delegate:
void BeforeDoInternalWork() override {}
void BeforeWait() override {}
MOCK_METHOD0(DoSomeWork, MessagePump::Delegate::NextWorkInfo());
MOCK_METHOD0(DoWork, MessagePump::Delegate::NextWorkInfo());
MOCK_METHOD0(DoIdleWork, bool());
private:
......@@ -60,7 +60,7 @@ TEST_P(MessagePumpTest, QuitStopsWork) {
testing::StrictMock<MockMessagePumpDelegate> delegate;
// Not expecting any calls to DoIdleWork after quitting.
EXPECT_CALL(delegate, DoSomeWork).WillOnce(Invoke([this] {
EXPECT_CALL(delegate, DoWork).WillOnce(Invoke([this] {
message_pump_->Quit();
return MessagePump::Delegate::NextWorkInfo{TimeTicks::Max()};
}));
......@@ -75,17 +75,17 @@ TEST_P(MessagePumpTest, QuitStopsWorkWithNestedRunLoop) {
testing::StrictMock<MockMessagePumpDelegate> delegate;
testing::StrictMock<MockMessagePumpDelegate> nested_delegate;
// We first schedule a call to DoSomeWork, which runs a nested run loop. After
// the nested loop exits, we schedule another DoSomeWork which quits the outer
// We first schedule a call to DoWork, which runs a nested run loop. After
// the nested loop exits, we schedule another DoWork which quits the outer
// (original) run loop. The test verifies that there are no extra calls to
// DoSomeWork after the outer loop quits.
EXPECT_CALL(delegate, DoSomeWork).WillOnce(Invoke([&] {
// DoWork after the outer loop quits.
EXPECT_CALL(delegate, DoWork).WillOnce(Invoke([&] {
message_pump_->ScheduleWork();
message_pump_->Run(&nested_delegate);
message_pump_->ScheduleWork();
return MessagePump::Delegate::NextWorkInfo{TimeTicks::Max()};
}));
EXPECT_CALL(nested_delegate, DoSomeWork).WillOnce(Invoke([&] {
EXPECT_CALL(nested_delegate, DoWork).WillOnce(Invoke([&] {
// Quit the nested run loop.
message_pump_->Quit();
return MessagePump::Delegate::NextWorkInfo{TimeTicks::Max()};
......@@ -93,7 +93,7 @@ TEST_P(MessagePumpTest, QuitStopsWorkWithNestedRunLoop) {
// The outer pump may or may not trigger idle work at this point.
EXPECT_CALL(delegate, DoIdleWork()).Times(AnyNumber());
EXPECT_CALL(delegate, DoSomeWork).WillOnce(Invoke([this] {
EXPECT_CALL(delegate, DoWork).WillOnce(Invoke([this] {
message_pump_->Quit();
return MessagePump::Delegate::NextWorkInfo{TimeTicks::Max()};
}));
......@@ -121,7 +121,7 @@ class TimerSlackTestDelegate : public MessagePump::Delegate {
void BeforeDoInternalWork() override {}
void BeforeWait() override {}
MessagePump::Delegate::NextWorkInfo DoSomeWork() override {
MessagePump::Delegate::NextWorkInfo DoWork() override {
switch (action_.load()) {
case NONE:
break;
......@@ -193,7 +193,7 @@ TEST_P(MessagePumpTest, RunWithoutScheduleWorkInvokesDoWork) {
#if defined(OS_IOS)
EXPECT_CALL(delegate, DoIdleWork).Times(AnyNumber());
#endif
EXPECT_CALL(delegate, DoSomeWork).WillOnce(Invoke([this] {
EXPECT_CALL(delegate, DoWork).WillOnce(Invoke([this] {
message_pump_->Quit();
return MessagePump::Delegate::NextWorkInfo{TimeTicks::Max()};
}));
......@@ -205,12 +205,12 @@ TEST_P(MessagePumpTest, NestedRunWithoutScheduleWorkInvokesDoWork) {
#if defined(OS_IOS)
EXPECT_CALL(delegate, DoIdleWork).Times(AnyNumber());
#endif
EXPECT_CALL(delegate, DoSomeWork).WillOnce(Invoke([this] {
EXPECT_CALL(delegate, DoWork).WillOnce(Invoke([this] {
testing::StrictMock<MockMessagePumpDelegate> nested_delegate;
#if defined(OS_IOS)
EXPECT_CALL(nested_delegate, DoIdleWork).Times(AnyNumber());
#endif
EXPECT_CALL(nested_delegate, DoSomeWork).WillOnce(Invoke([this] {
EXPECT_CALL(nested_delegate, DoWork).WillOnce(Invoke([this] {
message_pump_->Quit();
return MessagePump::Delegate::NextWorkInfo{TimeTicks::Max()};
}));
......
......@@ -128,7 +128,7 @@ void MessagePumpForUI::ScheduleDelayedWork(const TimeTicks& delayed_work_time) {
// Since this is always called from |bound_thread_|, there is almost always
// nothing to do as the loop is already running. When the loop becomes idle,
// it will typically WaitForWork() in DoRunLoop() with the timeout provided by
// DoSomeWork(). The only alternative to this is entering a native nested loop
// DoWork(). The only alternative to this is entering a native nested loop
// (e.g. modal dialog) under a ScopedNestableTaskAllower, in which case
// HandleWorkMessage() will be invoked when the system picks up kMsgHaveWork
// and it will ScheduleNativeTimer() if it's out of immediate work. However,
......@@ -214,7 +214,7 @@ void MessagePumpForUI::DoRunLoop() {
if (state_->should_quit)
break;
Delegate::NextWorkInfo next_work_info = state_->delegate->DoSomeWork();
Delegate::NextWorkInfo next_work_info = state_->delegate->DoWork();
in_native_loop_ = false;
more_work_is_plausible |= next_work_info.is_immediate();
if (state_->should_quit)
......@@ -316,7 +316,7 @@ void MessagePumpForUI::HandleWorkMessage() {
// messages that may be in the Windows message queue.
ProcessPumpReplacementMessage();
Delegate::NextWorkInfo next_work_info = state_->delegate->DoSomeWork();
Delegate::NextWorkInfo next_work_info = state_->delegate->DoWork();
if (next_work_info.is_immediate()) {
ScheduleWork();
} else {
......@@ -347,7 +347,7 @@ void MessagePumpForUI::HandleTimerMessage() {
if (!state_)
return;
Delegate::NextWorkInfo next_work_info = state_->delegate->DoSomeWork();
Delegate::NextWorkInfo next_work_info = state_->delegate->DoWork();
if (next_work_info.is_immediate()) {
ScheduleWork();
} else {
......@@ -619,7 +619,7 @@ void MessagePumpForIO::DoRunLoop() {
// had no work, then it is a good time to consider sleeping (waiting) for
// more work.
Delegate::NextWorkInfo next_work_info = state_->delegate->DoSomeWork();
Delegate::NextWorkInfo next_work_info = state_->delegate->DoWork();
bool more_work_is_plausible = next_work_info.is_immediate();
if (state_->should_quit)
break;
......
......@@ -82,7 +82,7 @@ class BASE_EXPORT MessagePumpWin : public MessagePump {
//
// MessagePumpForUI implements a "traditional" Windows message pump. It contains
// a nearly infinite loop that peeks out messages, and then dispatches them.
// Intermixed with those peeks are callouts to DoSomeWork. When there are no
// Intermixed with those peeks are callouts to DoWork. When there are no
// events to be serviced, this pump goes into a wait state. In most cases, this
// message pump handles all processing.
//
......
......@@ -272,9 +272,9 @@ class FixtureWithMockMessagePump : public Fixture {
}
void RunDoWorkOnce() override {
pump_->SetQuitAfterDoSomeWork(true);
pump_->SetQuitAfterDoWork(true);
RunLoop().Run();
pump_->SetQuitAfterDoSomeWork(false);
pump_->SetQuitAfterDoWork(false);
}
SequenceManagerForTest* sequence_manager() const override {
......
......@@ -44,7 +44,7 @@ void MockTimeMessagePump::Run(Delegate* delegate) {
AutoReset<bool> auto_reset_keep_running(&keep_running_, true);
for (;;) {
Delegate::NextWorkInfo info = delegate->DoSomeWork();
Delegate::NextWorkInfo info = delegate->DoWork();
if (!keep_running_ || quit_after_do_some_work_)
break;
......
......@@ -40,10 +40,10 @@ class MockTimeMessagePump : public MessagePump {
// work.
TimeTicks next_wake_up_time() const { return next_wake_up_time_; }
// Quits after the first call to Delegate::DoSomeWork(). Useful
// for tests that want to make sure certain things happen during a DoSomeWork
// Quits after the first call to Delegate::DoWork(). Useful
// for tests that want to make sure certain things happen during a DoWork
// call.
void SetQuitAfterDoSomeWork(bool quit_after_do_some_work) {
void SetQuitAfterDoWork(bool quit_after_do_some_work) {
quit_after_do_some_work_ = quit_after_do_some_work;
}
......@@ -65,7 +65,7 @@ class MockTimeMessagePump : public MessagePump {
private:
// Returns true if the clock was indeed advanced and thus we should attempt
// another iteration of the DoSomeWork-DoIdleWork-loop.
// another iteration of the DoWork-DoIdleWork-loop.
bool MaybeAdvanceTime(TimeTicks target_time);
SimpleTestTickClock* const clock_;
......
......@@ -24,7 +24,7 @@ class MockMessagePumpDelegate : public MessagePump::Delegate {
public:
MOCK_METHOD0(BeforeDoInternalWork, void());
MOCK_METHOD0(BeforeWait, void());
MOCK_METHOD0(DoSomeWork, NextWorkInfo());
MOCK_METHOD0(DoWork, NextWorkInfo());
MOCK_METHOD0(DoIdleWork, bool());
};
......@@ -42,7 +42,7 @@ TEST(MockMessagePumpTest, KeepsRunningIfNotAllowedToAdvanceTime) {
const auto kStartTime = mock_clock.NowTicks();
const auto kFutureTime = kStartTime + TimeDelta::FromSeconds(42);
EXPECT_CALL(delegate, DoSomeWork)
EXPECT_CALL(delegate, DoWork)
.WillOnce(Return(NextWorkInfo(TimeTicks())))
.WillOnce(Return(NextWorkInfo(TimeTicks())))
.WillOnce(Return(NextWorkInfo(kFutureTime)));
......@@ -66,7 +66,7 @@ TEST(MockMessagePumpTest, AdvancesTimeAsAllowed) {
pump.SetAllowTimeToAutoAdvanceUntil(kEndTime);
pump.SetStopWhenMessagePumpIsIdle(true);
EXPECT_CALL(delegate, DoSomeWork).Times(3).WillRepeatedly(Invoke([&]() {
EXPECT_CALL(delegate, DoWork).Times(3).WillRepeatedly(Invoke([&]() {
return NextWorkInfo(mock_clock.NowTicks() + TimeDelta::FromSeconds(1));
}));
EXPECT_CALL(delegate, DoIdleWork).Times(3).WillRepeatedly(Return(false));
......@@ -82,8 +82,8 @@ TEST(MockMessagePumpTest, CanQuitAfterMaybeDoWork) {
StrictMock<MockMessagePumpDelegate> delegate;
MockTimeMessagePump pump(&mock_clock);
pump.SetQuitAfterDoSomeWork(true);
EXPECT_CALL(delegate, DoSomeWork).WillOnce(Return(NextWorkInfo(TimeTicks())));
pump.SetQuitAfterDoWork(true);
EXPECT_CALL(delegate, DoWork).WillOnce(Return(NextWorkInfo(TimeTicks())));
pump.Run(&delegate);
}
......@@ -99,7 +99,7 @@ TEST(MockMessagePumpTest, AdvancesUntilAllowedTime) {
pump.SetAllowTimeToAutoAdvanceUntil(kEndTime);
pump.SetStopWhenMessagePumpIsIdle(true);
EXPECT_CALL(delegate, DoSomeWork)
EXPECT_CALL(delegate, DoWork)
.Times(2)
.WillRepeatedly(Return(NextWorkInfo(kNextDelayedWorkTime)));
EXPECT_CALL(delegate, DoIdleWork).Times(2).WillRepeatedly(Return(false));
......@@ -119,7 +119,7 @@ TEST(MockMessagePumpTest, StoresNextWakeUpTime) {
pump.SetAllowTimeToAutoAdvanceUntil(kEndTime);
pump.SetStopWhenMessagePumpIsIdle(true);
EXPECT_CALL(delegate, DoSomeWork)
EXPECT_CALL(delegate, DoWork)
.WillOnce(Return(NextWorkInfo(kNextDelayedWorkTime)));
EXPECT_CALL(delegate, DoIdleWork).WillOnce(Return(false));
......@@ -150,7 +150,7 @@ TEST(MockMessagePumpTest, NextDelayedWorkTimeInThePastKeepsRunning) {
pump.SetStopWhenMessagePumpIsIdle(true);
EXPECT_CALL(delegate, DoSomeWork)
EXPECT_CALL(delegate, DoWork)
.WillOnce(Return(NextWorkInfo(kNextDelayedWorkTime)))
.WillOnce(Return(NextWorkInfo(kNextDelayedWorkTime)))
.WillOnce(Return(NextWorkInfo(TimeTicks::Max())));
......@@ -170,7 +170,7 @@ TEST(MockMessagePumpTest,
pump.SetStopWhenMessagePumpIsIdle(true);
pump.SetAllowTimeToAutoAdvanceUntil(kAdvanceUntil);
EXPECT_CALL(delegate, DoSomeWork)
EXPECT_CALL(delegate, DoWork)
.WillRepeatedly(Return(NextWorkInfo(TimeTicks::Max())));
EXPECT_CALL(delegate, DoIdleWork).WillRepeatedly(Return(false));
......
......@@ -233,7 +233,7 @@ void ThreadControllerWithMessagePumpImpl::BeforeWait() {
}
MessagePump::Delegate::NextWorkInfo
ThreadControllerWithMessagePumpImpl::DoSomeWork() {
ThreadControllerWithMessagePumpImpl::DoWork() {
// Nested runloops are covered by the parent loop hang watch scope.
// TODO(crbug/1034046): Provide more granular scoping that reuses the parent
// scope deadline.
......@@ -252,7 +252,7 @@ ThreadControllerWithMessagePumpImpl::DoSomeWork() {
: WorkDeduplicator::NextTask::kIsDelayed;
if (work_deduplicator_.DidCheckForMoreWork(next_task) ==
ShouldScheduleWork::kScheduleImmediate) {
// Need to run new work immediately, but due to the contract of DoSomeWork
// Need to run new work immediately, but due to the contract of DoWork
// we only need to return a null TimeTicks to ensure that happens.
return MessagePump::Delegate::NextWorkInfo();
}
......
......@@ -86,7 +86,7 @@ class BASE_EXPORT ThreadControllerWithMessagePumpImpl
// MessagePump::Delegate implementation.
void BeforeDoInternalWork() override;
void BeforeWait() override;
MessagePump::Delegate::NextWorkInfo DoSomeWork() override;
MessagePump::Delegate::NextWorkInfo DoWork() override;
bool DoIdleWork() override;
// RunLoop::Delegate implementation.
......
......@@ -113,7 +113,7 @@ class MessagePumpForUIStub : public base::MessagePumpForUI {
break;
}
Delegate::NextWorkInfo next_work_info = g_state->delegate->DoSomeWork();
Delegate::NextWorkInfo next_work_info = g_state->delegate->DoWork();
more_work_is_plausible = next_work_info.is_immediate();
if (g_state->should_quit)
break;
......
......@@ -35,10 +35,10 @@ namespace base {
//
// void FooBar(){
// HangWatchScope scope(base::TimeDelta::FromSeconds(5));
// DoSomeWork();
// DoWork();
// }
//
// If DoSomeWork() takes more than 5s to run and the HangWatcher
// If DoWork() takes more than 5s to run and the HangWatcher
// inspects the thread state before Foobar returns a hang will be
// reported.
//
......
......@@ -297,7 +297,7 @@ int GpuMain(const MainFunctionParams& parameters) {
main_thread_task_executor =
std::make_unique<base::SingleThreadTaskExecutor>(
base::MessagePumpType::NS_RUNLOOP);
// As part of the migration to DoSomeWork(), this policy is required to keep
// As part of the migration to DoWork(), this policy is required to keep
// previous behavior and avoid regressions.
// TODO(crbug.com/1041853): Consider updating the policy.
main_thread_task_executor->SetWorkBatchSize(2);
......
......@@ -42,7 +42,7 @@ namespace content {
// kFooServiceIdleTimeout,
// base::BindRepeating(
// /* Something to reset |foo_service|, killing the process. */));
// foo_service->DoSomeWork();
// foo_service->DoWork();
//
class CONTENT_EXPORT ServiceProcessHost {
public:
......
......@@ -60,7 +60,7 @@ void NestedMessagePumpAndroid::Run(Delegate* delegate) {
if (state_->should_quit)
break;
Delegate::NextWorkInfo next_work_info = delegate->DoSomeWork();
Delegate::NextWorkInfo next_work_info = delegate->DoWork();
bool has_more_immediate_work = next_work_info.is_immediate();
if (state_->should_quit)
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment