Skip to content

Commit

Permalink
Revert "Remove references to MessagePump::Type"
Browse files Browse the repository at this point in the history
This reverts commit bfca9d6.

Reason for revert:

Findit (https://goo.gl/kROfz5) identified CL at revision 682731 as the
culprit for failures in the build cycles as shown on:
https://analysis.chromium.org/waterfall/culprit?key=ag9zfmZpbmRpdC1mb3ItbWVyRAsSDVdmU3VzcGVjdGVkQ0wiMWNocm9taXVtL2JmY2E5ZDY3NWM1MjQ4NDNiOGJiNmEwZDAxNGUyOWQ0ZDY4NTkwNTYM

Sample Failed Build: https://ci.chromium.org/buildbot/chromium/win-archive-rel/3468

Sample Failed Step: compile

Original change's description:
> Remove references to MessagePump::Type
> 
> It is going away soon, replace with the real thing: MessagePumpType
> 
> Had to fix a lot of includes (MessagePumpType is defined in message_pump_type.h).
> 
> This is a mechanical change that will be reviewed according to
> https://chromium.googlesource.com/chromium/src/+/master/docs/code_reviews.md#mechanical-changes
> 
> Bug: 891670
> TBR=gab@chromium.org
> 
> Change-Id: I1c85fce3cc11f7a283153ccaf2596e6e92a638d7
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1726058
> Commit-Queue: Carlos Caballero <carlscab@google.com>
> Reviewed-by: Gabriel Charette <gab@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#682731}


Change-Id: Idf6e0f69a07267d3a322c700882d2b3f65dcf021
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 891670
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1729553
Cr-Commit-Position: refs/heads/master@{#682762}
  • Loading branch information
Findit committed Jul 31, 2019
1 parent 82e42bf commit b0504e9
Show file tree
Hide file tree
Showing 107 changed files with 198 additions and 262 deletions.
4 changes: 2 additions & 2 deletions android_webview/browser/aw_browser_main_parts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/i18n/rtl.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_current.h"
#include "base/message_loop/message_pump_type.h"
#include "base/path_service.h"
#include "components/crash/content/browser/child_exit_observer_android.h"
#include "components/heap_profiling/supervisor.h"
Expand Down Expand Up @@ -76,7 +76,7 @@ int AwBrowserMainParts::PreEarlyInitialization() {
DCHECK(!main_task_executor_.get());
if (!base::MessageLoopCurrent::IsSet()) {
main_task_executor_ = std::make_unique<base::SingleThreadTaskExecutor>(
base::MessagePumpType::UI);
base::MessagePump::Type::UI);
}

browser_process_ = std::make_unique<AwBrowserProcess>(
Expand Down
5 changes: 2 additions & 3 deletions base/android/java_handler_thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "base/base_jni_headers/JavaHandlerThread_jni.h"
#include "base/bind.h"
#include "base/message_loop/message_pump.h"
#include "base/message_loop/message_pump_type.h"
#include "base/run_loop.h"
#include "base/synchronization/waitable_event.h"
#include "base/task/sequence_manager/sequence_manager_impl.h"
Expand Down Expand Up @@ -147,13 +146,13 @@ void JavaHandlerThread::QuitThreadSafely() {
JavaHandlerThread::TaskEnvironment::TaskEnvironment()
: sequence_manager(sequence_manager::CreateUnboundSequenceManager(
sequence_manager::SequenceManager::Settings::Builder()
.SetMessagePumpType(base::MessagePumpType::JAVA)
.SetMessagePumpType(base::MessagePump::Type::JAVA)
.Build())),
default_task_queue(sequence_manager->CreateTaskQueue(
sequence_manager::TaskQueue::Spec("default_tq"))) {
// TYPE_JAVA to get the Android java style message loop.
std::unique_ptr<MessagePump> message_pump =
MessagePump::Create(base::MessagePumpType::JAVA);
MessagePump::Create(base::MessagePump::Type::JAVA);
pump = static_cast<MessagePumpForUI*>(message_pump.get());

// We must set SetTaskRunner before binding because the Android UI pump
Expand Down
2 changes: 1 addition & 1 deletion base/message_loop/message_loop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void MessageLoop::SetTaskRunner(

MessageLoopForUI::MessageLoopForUI(MessagePumpType type) : MessageLoop(type) {
#if defined(OS_ANDROID)
DCHECK(type == MessagePumpType::UI || type == MessagePumpType::JAVA);
DCHECK(type == MessagePumpType::UI || type == MessagePump::Type::JAVA);
#else
DCHECK_EQ(type, MessagePumpType::UI);
#endif
Expand Down
4 changes: 2 additions & 2 deletions base/message_loop/message_loop.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class BASE_EXPORT MessageLoop {

// Normally, it is not necessary to instantiate a MessageLoop. Instead, it
// is typical to make use of the current thread's MessageLoop instance.
explicit MessageLoop(MessagePumpType type = MessagePumpType::DEFAULT);
explicit MessageLoop(MessagePumpType type = MessagePump::Type::DEFAULT);
// Creates a MessageLoop with the supplied MessagePump, which must be
// non-null.
explicit MessageLoop(std::unique_ptr<MessagePump> custom_pump);
Expand Down Expand Up @@ -231,7 +231,7 @@ class BASE_EXPORT MessageLoop {
//
class BASE_EXPORT MessageLoopForUI : public MessageLoop {
public:
explicit MessageLoopForUI(MessagePumpType type = MessagePumpType::UI);
explicit MessageLoopForUI(MessagePumpType type = MessagePump::Type::UI);

#if defined(OS_IOS)
// On iOS, the main message loop cannot be Run(). Instead call Attach(),
Expand Down
3 changes: 3 additions & 0 deletions base/message_loop/message_pump.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ class TimeTicks;

class BASE_EXPORT MessagePump {
public:
// DEPRECATED: Use MessagePumpType instead.
using Type = MessagePumpType;

using MessagePumpFactory = std::unique_ptr<MessagePump>();
// Uses the given base::MessagePumpFactory to override the default MessagePump
// implementation for 'Type::UI'. May only be called once.
Expand Down
2 changes: 1 addition & 1 deletion base/task/sequence_manager/sequence_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ SequenceManager::Settings::Builder::~Builder() = default;

SequenceManager::Settings::Builder&
SequenceManager::Settings::Builder::SetMessagePumpType(
MessagePumpType message_loop_type_val) {
MessagePump::Type message_loop_type_val) {
settings_.message_loop_type = message_loop_type_val;
return *this;
}
Expand Down
11 changes: 4 additions & 7 deletions base/task/sequence_manager/sequence_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,14 @@
#include <utility>

#include "base/macros.h"
#include "base/message_loop/message_pump_type.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/timer_slack.h"
#include "base/single_thread_task_runner.h"
#include "base/task/sequence_manager/task_queue_impl.h"
#include "base/task/sequence_manager/task_time_observer.h"
#include "base/time/default_tick_clock.h"

namespace base {

class MessagePump;

namespace sequence_manager {

class TimeDomain;
Expand Down Expand Up @@ -83,7 +80,7 @@ class BASE_EXPORT SequenceManager {
// so we are making Settings move-only in preparation.
Settings(Settings&& move_from) noexcept;

MessagePumpType message_loop_type = MessagePumpType::DEFAULT;
MessagePump::Type message_loop_type = MessagePump::Type::DEFAULT;
bool randomised_sampling_enabled = false;
const TickClock* clock = DefaultTickClock::GetInstance();

Expand Down Expand Up @@ -248,8 +245,8 @@ class BASE_EXPORT SequenceManager::Settings::Builder {
Builder();
~Builder();

// Sets the MessagePumpType which is used to create a MessagePump.
Builder& SetMessagePumpType(MessagePumpType message_loop_type);
// Sets the MessagePump::Type which is used to create a MessagePump.
Builder& SetMessagePumpType(MessagePump::Type message_loop_type);

Builder& SetRandomisedSamplingEnabled(bool randomised_sampling_enabled);

Expand Down
8 changes: 4 additions & 4 deletions base/task/sequence_manager/sequence_manager_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ void SequenceManagerImpl::BindToMessagePump(std::unique_ptr<MessagePump> pump) {

// On Android attach to the native loop when there is one.
#if defined(OS_ANDROID)
if (settings_.message_loop_type == MessagePumpType::UI ||
settings_.message_loop_type == MessagePumpType::JAVA) {
if (settings_.message_loop_type == MessagePump::Type::UI ||
settings_.message_loop_type == MessagePump::Type::JAVA) {
controller_->AttachToMessagePump();
}
#endif
Expand Down Expand Up @@ -1035,7 +1035,7 @@ bool SequenceManagerImpl::HasTasks() {
return false;
}

MessagePumpType SequenceManagerImpl::GetType() const {
MessagePump::Type SequenceManagerImpl::GetType() const {
return settings_.message_loop_type;
}

Expand Down Expand Up @@ -1109,7 +1109,7 @@ MessagePump* SequenceManagerImpl::GetMessagePump() const {
return controller_->GetBoundMessagePump();
}

bool SequenceManagerImpl::IsType(MessagePumpType type) const {
bool SequenceManagerImpl::IsType(MessagePump::Type type) const {
return settings_.message_loop_type == type;
}

Expand Down
5 changes: 2 additions & 3 deletions base/task/sequence_manager/sequence_manager_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_pump_type.h"
#include "base/pending_task.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
Expand Down Expand Up @@ -144,7 +143,7 @@ class BASE_EXPORT SequenceManagerImpl
scoped_refptr<SingleThreadTaskRunner> GetTaskRunner();
bool IsBoundToCurrentThread() const;
MessagePump* GetMessagePump() const;
bool IsType(MessagePumpType type) const;
bool IsType(MessagePump::Type type) const;
void SetAddQueueTimeToTasks(bool enable);
void SetTaskExecutionAllowed(bool allowed);
bool IsTaskExecutionAllowed() const;
Expand All @@ -155,7 +154,7 @@ class BASE_EXPORT SequenceManagerImpl
void BindToCurrentThread(std::unique_ptr<MessagePump> pump);
void DeletePendingTasks();
bool HasTasks();
MessagePumpType GetType() const;
MessagePump::Type GetType() const;

// Requests that a task to process work is scheduled.
void ScheduleWork();
Expand Down
7 changes: 3 additions & 4 deletions base/task/sequence_manager/sequence_manager_impl_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_current.h"
#include "base/message_loop/message_pump_default.h"
#include "base/message_loop/message_pump_type.h"
#include "base/optional.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
Expand Down Expand Up @@ -181,7 +180,7 @@ class FixtureWithMockTaskRunner final : public Fixture {
ThreadTaskRunnerHandle::Get(),
mock_tick_clock(),
SequenceManager::Settings::Builder()
.SetMessagePumpType(MessagePumpType::DEFAULT)
.SetMessagePumpType(MessagePump::Type::DEFAULT)
.SetRandomisedSamplingEnabled(false)
.SetTickClock(mock_tick_clock())
.SetAntiStarvationLogicForPrioritiesDisabled(
Expand Down Expand Up @@ -256,7 +255,7 @@ class FixtureWithMockMessagePump : public Fixture {
pump_ = pump.get();
auto settings =
SequenceManager::Settings::Builder()
.SetMessagePumpType(MessagePumpType::DEFAULT)
.SetMessagePumpType(MessagePump::Type::DEFAULT)
.SetRandomisedSamplingEnabled(false)
.SetTickClock(mock_tick_clock())
.SetAntiStarvationLogicForPrioritiesDisabled(
Expand Down Expand Up @@ -345,7 +344,7 @@ class FixtureWithMessageLoop : public Fixture {

sequence_manager_ = SequenceManagerForTest::CreateOnCurrentThread(
SequenceManager::Settings::Builder()
.SetMessagePumpType(MessagePumpType::DEFAULT)
.SetMessagePumpType(MessagePump::Type::DEFAULT)
.SetRandomisedSamplingEnabled(false)
.SetTickClock(mock_tick_clock())
.SetAntiStarvationLogicForPrioritiesDisabled(
Expand Down
11 changes: 5 additions & 6 deletions base/task/sequence_manager/sequence_manager_perftest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_pump_default.h"
#include "base/message_loop/message_pump_type.h"
#include "base/run_loop.h"
#include "base/sequence_checker.h"
#include "base/single_thread_task_runner.h"
Expand Down Expand Up @@ -168,7 +167,7 @@ class SequenceManagerWithMessagePumpPerfTestDelegate
public:
SequenceManagerWithMessagePumpPerfTestDelegate(
const char* name,
MessagePumpType type,
MessagePump::Type type,
bool randomised_sampling_enabled = false)
: name_(name) {
auto settings =
Expand Down Expand Up @@ -584,20 +583,20 @@ class SequenceManagerPerfTest : public testing::TestWithParam<PerfTestType> {
case PerfTestType::kUseSequenceManagerWithMessagePump:
return std::make_unique<SequenceManagerWithMessagePumpPerfTestDelegate>(
" SequenceManager with MessagePumpDefault ",
MessagePumpType::DEFAULT);
MessagePump::Type::DEFAULT);

case PerfTestType::kUseSequenceManagerWithUIMessagePump:
return std::make_unique<SequenceManagerWithMessagePumpPerfTestDelegate>(
" SequenceManager with MessagePumpForUI ", MessagePumpType::UI);
" SequenceManager with MessagePumpForUI ", MessagePump::Type::UI);

case PerfTestType::kUseSequenceManagerWithIOMessagePump:
return std::make_unique<SequenceManagerWithMessagePumpPerfTestDelegate>(
" SequenceManager with MessagePumpForIO ", MessagePumpType::IO);
" SequenceManager with MessagePumpForIO ", MessagePump::Type::IO);

case PerfTestType::kUseSequenceManagerWithMessagePumpAndRandomSampling:
return std::make_unique<SequenceManagerWithMessagePumpPerfTestDelegate>(
" SequenceManager with MessagePumpDefault and random sampling ",
MessagePumpType::DEFAULT, true);
MessagePump::Type::DEFAULT, true);

case PerfTestType::kUseSingleThreadInThreadPool:
return std::make_unique<SingleThreadInThreadPoolPerfTestDelegate>();
Expand Down
8 changes: 3 additions & 5 deletions base/task/sequence_manager/task_queue_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

#include "base/task/sequence_manager/task_queue.h"

#include "base/message_loop/message_pump.h"
#include "base/message_loop/message_pump_type.h"
#include "base/task/sequence_manager/sequence_manager.h"
#include "base/task/sequence_manager/test/sequence_manager_for_test.h"
#include "testing/gtest/include/gtest/gtest.h"
Expand All @@ -19,7 +17,7 @@ namespace {

TEST(TaskQueueTest, TaskQueueVoters) {
auto sequence_manager = CreateSequenceManagerOnCurrentThreadWithPump(
MessagePump::Create(MessagePumpType::DEFAULT));
MessagePump::Create(MessagePump::Type::DEFAULT));

auto queue = sequence_manager->CreateTaskQueue(TaskQueue::Spec("test"));

Expand Down Expand Up @@ -68,7 +66,7 @@ TEST(TaskQueueTest, TaskQueueVoters) {

TEST(TaskQueueTest, ShutdownQueueBeforeEnabledVoterDeleted) {
auto sequence_manager = CreateSequenceManagerOnCurrentThreadWithPump(
MessagePump::Create(MessagePumpType::DEFAULT));
MessagePump::Create(MessagePump::Type::DEFAULT));
auto queue = sequence_manager->CreateTaskQueue(TaskQueue::Spec("test"));

std::unique_ptr<TaskQueue::QueueEnabledVoter> voter =
Expand All @@ -83,7 +81,7 @@ TEST(TaskQueueTest, ShutdownQueueBeforeEnabledVoterDeleted) {

TEST(TaskQueueTest, ShutdownQueueBeforeDisabledVoterDeleted) {
auto sequence_manager = CreateSequenceManagerOnCurrentThreadWithPump(
MessagePump::Create(MessagePumpType::DEFAULT));
MessagePump::Create(MessagePump::Type::DEFAULT));
auto queue = sequence_manager->CreateTaskQueue(TaskQueue::Spec("test"));

std::unique_ptr<TaskQueue::QueueEnabledVoter> voter =
Expand Down
4 changes: 1 addition & 3 deletions base/task/sequence_manager/time_domain_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/message_loop/message_pump.h"
#include "base/message_loop/message_pump_type.h"
#include "base/task/sequence_manager/sequence_manager_impl.h"
#include "base/task/sequence_manager/task_queue_impl.h"
#include "base/task/sequence_manager/work_queue.h"
Expand Down Expand Up @@ -394,7 +392,7 @@ TEST_F(TimeDomainTest, HighResolutionWakeUps) {
}

TEST_F(TimeDomainTest, SetNextWakeUpForQueueInThePast) {
constexpr auto kType = MessagePumpType::DEFAULT;
constexpr auto kType = MessagePump::Type::DEFAULT;
constexpr auto kDelay = TimeDelta::FromMilliseconds(20);
SimpleTestTickClock clock;
auto sequence_manager = sequence_manager::CreateUnboundSequenceManager(
Expand Down
5 changes: 3 additions & 2 deletions base/task/single_thread_task_executor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

#include "base/task/single_thread_task_executor.h"

#include "base/message_loop/message_pump.h"
#include "base/task/sequence_manager/sequence_manager.h"
#include "base/task/sequence_manager/sequence_manager_impl.h"
#include "build/build_config.h"

namespace base {

SingleThreadTaskExecutor::SingleThreadTaskExecutor(MessagePumpType type)
SingleThreadTaskExecutor::SingleThreadTaskExecutor(MessagePump::Type type)
: sequence_manager_(sequence_manager::CreateUnboundSequenceManager(
sequence_manager::SequenceManager::Settings::Builder()
.SetMessagePumpType(type)
Expand All @@ -22,7 +23,7 @@ SingleThreadTaskExecutor::SingleThreadTaskExecutor(MessagePumpType type)
sequence_manager_->BindToMessagePump(MessagePump::Create(type));

#if defined(OS_IOS)
if (type == MessagePumpType::UI) {
if (type == MessagePump::Type::UI) {
static_cast<sequence_manager::internal::SequenceManagerImpl*>(
sequence_manager_.get())
->AttachToMessagePump();
Expand Down
12 changes: 4 additions & 8 deletions base/task/single_thread_task_executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@
#ifndef BASE_TASK_SINGLE_THREAD_TASK_EXECUTOR_H_
#define BASE_TASK_SINGLE_THREAD_TASK_EXECUTOR_H_

#include <memory>

#include "base/base_export.h"
#include "base/memory/scoped_refptr.h"
#include "base/message_loop/message_pump_type.h"
#include "base/single_thread_task_runner.h"
#include "base/message_loop/message_loop.h"

namespace base {

Expand All @@ -25,7 +21,7 @@ class TaskQueue;
class BASE_EXPORT SingleThreadTaskExecutor {
public:
explicit SingleThreadTaskExecutor(
MessagePumpType type = MessagePumpType::DEFAULT);
MessagePump::Type type = MessagePump::Type::DEFAULT);

// Shuts down the SingleThreadTaskExecutor, after this no tasks can be
// executed and the base::TaskExecutor APIs are non-functional but won't crash
Expand All @@ -34,12 +30,12 @@ class BASE_EXPORT SingleThreadTaskExecutor {

scoped_refptr<SingleThreadTaskRunner> task_runner() const;

MessagePumpType type() const { return type_; }
MessagePump::Type type() const { return type_; }

private:
std::unique_ptr<sequence_manager::SequenceManager> sequence_manager_;
scoped_refptr<sequence_manager::TaskQueue> default_task_queue_;
MessagePumpType type_;
MessagePump::Type type_;

DISALLOW_COPY_AND_ASSIGN(SingleThreadTaskExecutor);
};
Expand Down
Loading

0 comments on commit b0504e9

Please sign in to comment.