Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Unified Diff: ui/ozone/public/ozone_gpu_test_helper.cc

Issue 1308993007: [Ozone] Update GPUTestHelper to properly use the message filter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698