diff options
author | tiago.vignatti <tiago.vignatti@intel.com> | 2015-03-18 14:40:29 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-18 21:40:55 +0000 |
commit | 72b1eacd439fcb0bcf45ae7de2d8a9f578804ac6 (patch) | |
tree | 3a914ed5bb09f909eac62971f08e6847f28f34d2 /ui/ozone | |
parent | e13a9d574fb9c9a4d0f36351e0e91e89b4e17928 (diff) | |
download | chromium_src-72b1eacd439fcb0bcf45ae7de2d8a9f578804ac6.zip chromium_src-72b1eacd439fcb0bcf45ae7de2d8a9f578804ac6.tar.gz chromium_src-72b1eacd439fcb0bcf45ae7de2d8a9f578804ac6.tar.bz2 |
Simplify FakeGpuProcess* video accelerator tests
Make DispatchToGpuPlatformSupportTask and DispatchToGpuPlatformSupportHostTask
statics, removing the weak ptrs (and failing DCHECKS in that code) altogether.
BUG=447798
Review URL: https://codereview.chromium.org/1017673003
Cr-Commit-Position: refs/heads/master@{#321212}
Diffstat (limited to 'ui/ozone')
-rw-r--r-- | ui/ozone/public/ozone_gpu_test_helper.cc | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/ui/ozone/public/ozone_gpu_test_helper.cc b/ui/ozone/public/ozone_gpu_test_helper.cc index 1fa265c..fe88647 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() { |