| 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_io_task_runner_, sender); | 87 ->OnGpuProcessLaunched(kGpuProcessHostId, gpu_task_runner_, |
| 88 } | 88 gpu_io_task_runner_, sender); |
| 89 | |
| 90 void InitOnUI() { | |
| 91 ui::OzonePlatform::GetInstance() | |
| 92 ->GetGpuPlatformSupportHost() | |
| 93 ->OnChannelEstablished(); | |
| 94 } | 89 } |
| 95 | 90 |
| 96 private: | 91 private: |
| 97 scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner_; | 92 scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner_; |
| 98 scoped_refptr<base::SingleThreadTaskRunner> gpu_io_task_runner_; | 93 scoped_refptr<base::SingleThreadTaskRunner> gpu_io_task_runner_; |
| 99 }; | 94 }; |
| 100 | 95 |
| 101 OzoneGpuTestHelper::OzoneGpuTestHelper() { | 96 OzoneGpuTestHelper::OzoneGpuTestHelper() { |
| 102 } | 97 } |
| 103 | 98 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 117 FROM_HERE, base::Bind(&FakeGpuProcess::InitOnIO, | 112 FROM_HERE, base::Bind(&FakeGpuProcess::InitOnIO, |
| 118 base::Unretained(fake_gpu_process_.get()))); | 113 base::Unretained(fake_gpu_process_.get()))); |
| 119 | 114 |
| 120 fake_gpu_process_host_.reset(new FakeGpuProcessHost( | 115 fake_gpu_process_host_.reset(new FakeGpuProcessHost( |
| 121 gpu_task_runner, io_helper_thread_->task_runner())); | 116 gpu_task_runner, io_helper_thread_->task_runner())); |
| 122 io_helper_thread_->task_runner()->PostTask( | 117 io_helper_thread_->task_runner()->PostTask( |
| 123 FROM_HERE, base::Bind(&FakeGpuProcessHost::InitOnIO, | 118 FROM_HERE, base::Bind(&FakeGpuProcessHost::InitOnIO, |
| 124 base::Unretained(fake_gpu_process_host_.get()))); | 119 base::Unretained(fake_gpu_process_host_.get()))); |
| 125 io_helper_thread_->FlushForTesting(); | 120 io_helper_thread_->FlushForTesting(); |
| 126 | 121 |
| 127 fake_gpu_process_host_->InitOnUI(); | |
| 128 return true; | 122 return true; |
| 129 } | 123 } |
| 130 | 124 |
| 131 } // namespace ui | 125 } // namespace ui |
| OLD | NEW |