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

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

Issue 1017673003: Simplify FakeGpuProcess* video accelerator tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DispatchToGpuPlatformSupportTask & DispatchToGpuPlatformSupportHostTask static Created 5 years, 9 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 1fa265c6b35fd822c457ad43a5ee9dc4687b25f9..fe88647a8a3d2086d4f7a0eef829e9bbd72a866f 100644
--- a/ui/ozone/public/ozone_gpu_test_helper.cc
+++ b/ui/ozone/public/ozone_gpu_test_helper.cc
@@ -21,11 +21,18 @@ const int kGpuProcessHostId = 1;
} // namespace
+static void DispatchToGpuPlatformSupportHostTask(IPC::Message* msg) {
+ ui::OzonePlatform::GetInstance()
+ ->GetGpuPlatformSupportHost()
+ ->OnMessageReceived(*msg);
+ delete msg;
+}
+
class FakeGpuProcess : public IPC::Sender {
public:
FakeGpuProcess(
const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner)
- : ui_task_runner_(ui_task_runner), weak_factory_(this) {}
+ : ui_task_runner_(ui_task_runner) {}
~FakeGpuProcess() override {}
void Init() {
@@ -43,35 +50,30 @@ class FakeGpuProcess : public IPC::Sender {
bool Send(IPC::Message* msg) override {
ui_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&FakeGpuProcess::DispatchToGpuPlatformSupportHostTask,
- weak_factory_.GetWeakPtr(), msg));
+ FROM_HERE, base::Bind(&DispatchToGpuPlatformSupportHostTask, msg));
return true;
}
private:
- void DispatchToGpuPlatformSupportHostTask(IPC::Message* msg) {
- ui::OzonePlatform::GetInstance()
- ->GetGpuPlatformSupportHost()
- ->OnMessageReceived(*msg);
- delete msg;
- }
-
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
- base::WeakPtrFactory<FakeGpuProcess> weak_factory_;
};
+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), weak_factory_(this) {}
+ : gpu_task_runner_(gpu_task_runner) {}
~FakeGpuProcessHost() {}
void Init() {
base::Callback<void(IPC::Message*)> sender =
- base::Bind(&FakeGpuProcessHost::DispatchToGpuPlatformSupportTask,
- weak_factory_.GetWeakPtr());
+ base::Bind(&DispatchToGpuPlatformSupportTask);
ui::OzonePlatform::GetInstance()
->GetGpuPlatformSupportHost()
@@ -79,15 +81,7 @@ class FakeGpuProcessHost {
}
private:
- void DispatchToGpuPlatformSupportTask(IPC::Message* msg) {
- ui::OzonePlatform::GetInstance()
- ->GetGpuPlatformSupport()
- ->OnMessageReceived(*msg);
- delete msg;
- }
-
scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner_;
- base::WeakPtrFactory<FakeGpuProcessHost> weak_factory_;
};
OzoneGpuTestHelper::OzoneGpuTestHelper() {
« 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