| Index: ui/ozone/public/ozone_gpu_test_helper.cc
|
| diff --git a/ui/ozone/public/ozone_gpu_test_helper.cc b/ui/ozone/public/ozone_gpu_test_helper.cc
|
| index 8490a322c2f638e931060326296115412ef864c6..fe5a17b31cdb9775f7337863131e9ac4c3f14c02 100644
|
| --- a/ui/ozone/public/ozone_gpu_test_helper.cc
|
| +++ b/ui/ozone/public/ozone_gpu_test_helper.cc
|
| @@ -19,15 +19,36 @@ namespace {
|
|
|
| const int kGpuProcessHostId = 1;
|
|
|
| -} // namespace
|
| -
|
| -static void DispatchToGpuPlatformSupportHostTask(IPC::Message* msg) {
|
| +void DispatchToGpuPlatformSupportHostTask(IPC::Message* msg) {
|
| ui::OzonePlatform::GetInstance()
|
| ->GetGpuPlatformSupportHost()
|
| ->OnMessageReceived(*msg);
|
| delete msg;
|
| }
|
|
|
| +void DispatchToGpuPlatformSupportTask(IPC::Message* msg) {
|
| + ui::OzonePlatform::GetInstance()->GetGpuPlatformSupport()->OnMessageReceived(
|
| + *msg);
|
| + delete msg;
|
| +}
|
| +
|
| +void DispatchToGpuPlatformSupportTaskOnIO(
|
| + const scoped_refptr<base::SingleThreadTaskRunner>& gpu_task_runner,
|
| + IPC::Message* msg) {
|
| + IPC::MessageFilter* filter = ui::OzonePlatform::GetInstance()
|
| + ->GetGpuPlatformSupport()
|
| + ->GetMessageFilter();
|
| + if (filter && filter->OnMessageReceived(*msg)) {
|
| + delete msg;
|
| + return;
|
| + }
|
| +
|
| + gpu_task_runner->PostTask(FROM_HERE,
|
| + base::Bind(DispatchToGpuPlatformSupportTask, msg));
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| class FakeGpuProcess : public IPC::Sender {
|
| public:
|
| FakeGpuProcess(
|
| @@ -60,30 +81,27 @@ class FakeGpuProcess : public IPC::Sender {
|
| scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
|
| };
|
|
|
| -static void DispatchToGpuPlatformSupportTask(IPC::Message* msg) {
|
| - ui::OzonePlatform::GetInstance()->GetGpuPlatformSupport()->OnMessageReceived(
|
| - *msg);
|
| - delete msg;
|
| -}
|
| -
|
| class FakeGpuProcessHost {
|
| public:
|
| FakeGpuProcessHost(
|
| - const scoped_refptr<base::SingleThreadTaskRunner>& gpu_task_runner)
|
| - : gpu_task_runner_(gpu_task_runner) {}
|
| + const scoped_refptr<base::SingleThreadTaskRunner>& gpu_task_runner,
|
| + const scoped_refptr<base::SingleThreadTaskRunner>& gpu_io_task_runner)
|
| + : gpu_task_runner_(gpu_task_runner),
|
| + gpu_io_task_runner_(gpu_io_task_runner) {}
|
| ~FakeGpuProcessHost() {}
|
|
|
| void Init() {
|
| base::Callback<void(IPC::Message*)> sender =
|
| - base::Bind(&DispatchToGpuPlatformSupportTask);
|
| + base::Bind(&DispatchToGpuPlatformSupportTaskOnIO, gpu_task_runner_);
|
|
|
| ui::OzonePlatform::GetInstance()
|
| ->GetGpuPlatformSupportHost()
|
| - ->OnChannelEstablished(kGpuProcessHostId, gpu_task_runner_, sender);
|
| + ->OnChannelEstablished(kGpuProcessHostId, gpu_io_task_runner_, sender);
|
| }
|
|
|
| private:
|
| scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner_;
|
| + scoped_refptr<base::SingleThreadTaskRunner> gpu_io_task_runner_;
|
| };
|
|
|
| OzoneGpuTestHelper::OzoneGpuTestHelper() {
|
| @@ -106,7 +124,8 @@ bool OzoneGpuTestHelper::Initialize(
|
| base::Unretained(fake_gpu_process_.get())));
|
| fake_gpu_process_->Init();
|
|
|
| - fake_gpu_process_host_.reset(new FakeGpuProcessHost(gpu_task_runner));
|
| + fake_gpu_process_host_.reset(new FakeGpuProcessHost(
|
| + gpu_task_runner, io_helper_thread_->task_runner()));
|
| fake_gpu_process_host_->Init();
|
|
|
| return true;
|
|
|