Commit 9b86ccca authored by Carlos Caballero's avatar Carlos Caballero Committed by Commit Bot

Use ScopedTaskEnvironment instead of MessageLoop in /gpu/command_buffer

MessageLoop will go away, eventually.

ScopedTaskEnvironment will per default start a ThreadPool, which should
be fine in most of the cases. If you belive your test needs to make sure
that no ThreadPool runs let me know and I will update the patch.

BUG=891670
This CL was uploaded by git cl split.

R=piman@chromium.org

Change-Id: I5c322f7c0139d2afa0da7741840e58049940a8b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1649577
Auto-Submit: Carlos Caballero <carlscab@google.com>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Commit-Queue: Antoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#667169}
parent 05cd1c34
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/bind_helpers.h" #include "base/bind_helpers.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/test/scoped_task_environment.h"
#include "gpu/command_buffer/client/cmd_buffer_helper.h" #include "gpu/command_buffer/client/cmd_buffer_helper.h"
#include "gpu/command_buffer/client/command_buffer_direct_locked.h" #include "gpu/command_buffer/client/command_buffer_direct_locked.h"
#include "gpu/command_buffer/service/mocks.h" #include "gpu/command_buffer/service/mocks.h"
...@@ -202,7 +202,7 @@ class CommandBufferHelperTest : public testing::Test { ...@@ -202,7 +202,7 @@ class CommandBufferHelperTest : public testing::Test {
std::vector<std::unique_ptr<CommandBufferEntry[]>> test_command_args_; std::vector<std::unique_ptr<CommandBufferEntry[]>> test_command_args_;
unsigned int test_command_next_id_; unsigned int test_command_next_id_;
Sequence sequence_; Sequence sequence_;
base::MessageLoop message_loop_; base::test::ScopedTaskEnvironment scoped_task_environment_;
}; };
// Checks immediate_entry_count_ changes based on RingBuffer state. // Checks immediate_entry_count_ changes based on RingBuffer state.
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/bind_helpers.h" #include "base/bind_helpers.h"
#include "base/memory/aligned_memory.h" #include "base/memory/aligned_memory.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/test/scoped_task_environment.h"
#include "gpu/command_buffer/client/cmd_buffer_helper.h" #include "gpu/command_buffer/client/cmd_buffer_helper.h"
#include "gpu/command_buffer/client/fenced_allocator.h" #include "gpu/command_buffer/client/fenced_allocator.h"
#include "gpu/command_buffer/service/command_buffer_direct.h" #include "gpu/command_buffer/service/command_buffer_direct.h"
...@@ -58,7 +58,7 @@ class BaseFencedAllocatorTest : public testing::Test { ...@@ -58,7 +58,7 @@ class BaseFencedAllocatorTest : public testing::Test {
std::unique_ptr<CommandBufferDirect> command_buffer_; std::unique_ptr<CommandBufferDirect> command_buffer_;
std::unique_ptr<AsyncAPIMock> api_mock_; std::unique_ptr<AsyncAPIMock> api_mock_;
std::unique_ptr<CommandBufferHelper> helper_; std::unique_ptr<CommandBufferHelper> helper_;
base::MessageLoop message_loop_; base::test::ScopedTaskEnvironment scoped_task_environment_;
}; };
#ifndef _MSC_VER #ifndef _MSC_VER
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
#include <memory> #include <memory>
#include "base/bind.h" #include "base/bind.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/test/scoped_task_environment.h"
#include "gpu/command_buffer/client/cmd_buffer_helper.h" #include "gpu/command_buffer/client/cmd_buffer_helper.h"
#include "gpu/command_buffer/client/command_buffer_direct_locked.h" #include "gpu/command_buffer/client/command_buffer_direct_locked.h"
#include "gpu/command_buffer/service/mocks.h" #include "gpu/command_buffer/service/mocks.h"
...@@ -55,7 +55,7 @@ class MappedMemoryTestBase : public testing::Test { ...@@ -55,7 +55,7 @@ class MappedMemoryTestBase : public testing::Test {
std::unique_ptr<CommandBufferDirectLocked> command_buffer_; std::unique_ptr<CommandBufferDirectLocked> command_buffer_;
std::unique_ptr<AsyncAPIMock> api_mock_; std::unique_ptr<AsyncAPIMock> api_mock_;
std::unique_ptr<CommandBufferHelper> helper_; std::unique_ptr<CommandBufferHelper> helper_;
base::MessageLoop message_loop_; base::test::ScopedTaskEnvironment scoped_task_environment_;
}; };
#ifndef _MSC_VER #ifndef _MSC_VER
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/bind_helpers.h" #include "base/bind_helpers.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/test/scoped_task_environment.h"
#include "gpu/command_buffer/client/cmd_buffer_helper.h" #include "gpu/command_buffer/client/cmd_buffer_helper.h"
#include "gpu/command_buffer/service/command_buffer_direct.h" #include "gpu/command_buffer/service/command_buffer_direct.h"
#include "gpu/command_buffer/service/mocks.h" #include "gpu/command_buffer/service/mocks.h"
...@@ -85,7 +85,7 @@ class BaseRingBufferTest : public testing::Test { ...@@ -85,7 +85,7 @@ class BaseRingBufferTest : public testing::Test {
std::unique_ptr<int8_t[]> buffer_; std::unique_ptr<int8_t[]> buffer_;
int8_t* buffer_start_; int8_t* buffer_start_;
base::MessageLoop message_loop_; base::test::ScopedTaskEnvironment scoped_task_environment_;
}; };
#ifndef _MSC_VER #ifndef _MSC_VER
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include <array> #include <array>
#include <memory> #include <memory>
#include "base/message_loop/message_loop.h" #include "base/test/scoped_task_environment.h"
#include "gpu/command_buffer/client/client_test_helper.h" #include "gpu/command_buffer/client/client_test_helper.h"
#include "gpu/command_buffer/common/gles2_cmd_format.h" #include "gpu/command_buffer/common/gles2_cmd_format.h"
#include "gpu/command_buffer/common/gles2_cmd_utils.h" #include "gpu/command_buffer/common/gles2_cmd_utils.h"
...@@ -813,7 +813,7 @@ class GLES2DecoderTestBase : public ::testing::TestWithParam<bool>, ...@@ -813,7 +813,7 @@ class GLES2DecoderTestBase : public ::testing::TestWithParam<bool>,
SharedImageManager shared_image_manager_; SharedImageManager shared_image_manager_;
scoped_refptr<ContextGroup> group_; scoped_refptr<ContextGroup> group_;
MockGLStates gl_states_; MockGLStates gl_states_;
base::MessageLoop message_loop_; base::test::ScopedTaskEnvironment scoped_task_environment_;
MockCopyTextureResourceManager* copy_texture_manager_; // not owned MockCopyTextureResourceManager* copy_texture_manager_; // not owned
MockCopyTexImageResourceManager* copy_tex_image_blitter_; // not owned MockCopyTexImageResourceManager* copy_tex_image_blitter_; // not owned
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <memory> #include <memory>
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop.h" #include "base/test/scoped_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/gl/gl_mock.h" #include "ui/gl/gl_mock.h"
...@@ -42,7 +42,7 @@ class GpuServiceTest : public testing::Test { ...@@ -42,7 +42,7 @@ class GpuServiceTest : public testing::Test {
bool ran_teardown_; bool ran_teardown_;
scoped_refptr<gl::GLContextStub> context_; scoped_refptr<gl::GLContextStub> context_;
scoped_refptr<gl::GLSurfaceStub> surface_; scoped_refptr<gl::GLSurfaceStub> surface_;
base::MessageLoop message_loop_; base::test::ScopedTaskEnvironment scoped_task_environment_;
}; };
} // namespace gles2 } // namespace gles2
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "base/message_loop/message_loop.h" #include "base/test/scoped_task_environment.h"
#include "components/viz/common/resources/resource_format.h" #include "components/viz/common/resources/resource_format.h"
#include "gpu/command_buffer/client/client_test_helper.h" #include "gpu/command_buffer/client/client_test_helper.h"
#include "gpu/command_buffer/common/raster_cmd_format.h" #include "gpu/command_buffer/common/raster_cmd_format.h"
...@@ -246,7 +246,7 @@ class RasterDecoderTestBase : public ::testing::TestWithParam<bool>, ...@@ -246,7 +246,7 @@ class RasterDecoderTestBase : public ::testing::TestWithParam<bool>,
MemoryTypeTracker memory_tracker_; MemoryTypeTracker memory_tracker_;
std::vector<std::unique_ptr<SharedImageRepresentationFactoryRef>> std::vector<std::unique_ptr<SharedImageRepresentationFactoryRef>>
shared_images_; shared_images_;
base::MessageLoop message_loop_; base::test::ScopedTaskEnvironment scoped_task_environment_;
gles2::MockCopyTextureResourceManager* copy_texture_manager_; // not owned gles2::MockCopyTextureResourceManager* copy_texture_manager_; // not owned
GLuint next_fake_texture_client_id_ = 271828; GLuint next_fake_texture_client_id_ = 271828;
}; };
......
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