| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/ozone/public/ozone_gpu_test_helper.h" | 5 #include "ui/ozone/public/ozone_gpu_test_helper.h" |
| 6 | 6 |
| 7 #include "base/threading/thread.h" | 7 #include "base/threading/thread.h" |
| 8 #include "base/threading/thread_task_runner_handle.h" | 8 #include "base/threading/thread_task_runner_handle.h" |
| 9 #include "ipc/ipc_listener.h" | 9 #include "ipc/ipc_listener.h" |
| 10 #include "ipc/ipc_message.h" | 10 #include "ipc/ipc_message.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 : gpu_task_runner_(gpu_task_runner), | 77 : gpu_task_runner_(gpu_task_runner), |
| 78 gpu_io_task_runner_(gpu_io_task_runner) {} | 78 gpu_io_task_runner_(gpu_io_task_runner) {} |
| 79 ~FakeGpuProcessHost() {} | 79 ~FakeGpuProcessHost() {} |
| 80 | 80 |
| 81 void InitOnIO() { | 81 void InitOnIO() { |
| 82 base::Callback<void(IPC::Message*)> sender = | 82 base::Callback<void(IPC::Message*)> sender = |
| 83 base::Bind(&DispatchToGpuPlatformSupportTaskOnIO); | 83 base::Bind(&DispatchToGpuPlatformSupportTaskOnIO); |
| 84 | 84 |
| 85 ui::OzonePlatform::GetInstance() | 85 ui::OzonePlatform::GetInstance() |
| 86 ->GetGpuPlatformSupportHost() | 86 ->GetGpuPlatformSupportHost() |
| 87 ->OnGpuProcessLaunched(kGpuProcessHostId, gpu_task_runner_, | 87 ->OnGpuProcessLaunched(kGpuProcessHostId, gpu_io_task_runner_, sender); |
| 88 gpu_io_task_runner_, sender); | 88 } |
| 89 |
| 90 void InitOnUI() { |
| 91 ui::OzonePlatform::GetInstance() |
| 92 ->GetGpuPlatformSupportHost() |
| 93 ->OnChannelEstablished(); |
| 89 } | 94 } |
| 90 | 95 |
| 91 private: | 96 private: |
| 92 scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner_; | 97 scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner_; |
| 93 scoped_refptr<base::SingleThreadTaskRunner> gpu_io_task_runner_; | 98 scoped_refptr<base::SingleThreadTaskRunner> gpu_io_task_runner_; |
| 94 }; | 99 }; |
| 95 | 100 |
| 96 OzoneGpuTestHelper::OzoneGpuTestHelper() { | 101 OzoneGpuTestHelper::OzoneGpuTestHelper() { |
| 97 } | 102 } |
| 98 | 103 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 112 FROM_HERE, base::Bind(&FakeGpuProcess::InitOnIO, | 117 FROM_HERE, base::Bind(&FakeGpuProcess::InitOnIO, |
| 113 base::Unretained(fake_gpu_process_.get()))); | 118 base::Unretained(fake_gpu_process_.get()))); |
| 114 | 119 |
| 115 fake_gpu_process_host_.reset(new FakeGpuProcessHost( | 120 fake_gpu_process_host_.reset(new FakeGpuProcessHost( |
| 116 gpu_task_runner, io_helper_thread_->task_runner())); | 121 gpu_task_runner, io_helper_thread_->task_runner())); |
| 117 io_helper_thread_->task_runner()->PostTask( | 122 io_helper_thread_->task_runner()->PostTask( |
| 118 FROM_HERE, base::Bind(&FakeGpuProcessHost::InitOnIO, | 123 FROM_HERE, base::Bind(&FakeGpuProcessHost::InitOnIO, |
| 119 base::Unretained(fake_gpu_process_host_.get()))); | 124 base::Unretained(fake_gpu_process_host_.get()))); |
| 120 io_helper_thread_->FlushForTesting(); | 125 io_helper_thread_->FlushForTesting(); |
| 121 | 126 |
| 127 fake_gpu_process_host_->InitOnUI(); |
| 122 return true; | 128 return true; |
| 123 } | 129 } |
| 124 | 130 |
| 125 } // namespace ui | 131 } // namespace ui |
| OLD | NEW |