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

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: 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..71a2fab454967a02a23be911c287ee735ce85718 100644
--- a/ui/ozone/public/ozone_gpu_test_helper.cc
+++ b/ui/ozone/public/ozone_gpu_test_helper.cc
@@ -4,6 +4,7 @@
#include "ui/ozone/public/ozone_gpu_test_helper.h"
+#include "base/synchronization/waitable_event.h"
#include "base/thread_task_runner_handle.h"
#include "ipc/ipc_listener.h"
#include "ipc/ipc_message.h"
@@ -66,7 +67,13 @@ class FakeGpuProcessHost {
FakeGpuProcessHost(
const scoped_refptr<base::SingleThreadTaskRunner>& gpu_task_runner)
: gpu_task_runner_(gpu_task_runner), weak_factory_(this) {}
- ~FakeGpuProcessHost() {}
+ ~FakeGpuProcessHost() {
+ base::WaitableEvent done(false, false);
+ gpu_task_runner_->PostTask(FROM_HERE,
+ base::Bind(&FakeGpuProcessHost::Destroy,
+ weak_factory_.GetWeakPtr(), &done));
+ done.Wait();
+ }
void Init() {
base::Callback<void(IPC::Message*)> sender =
@@ -79,6 +86,12 @@ class FakeGpuProcessHost {
}
private:
+ void Destroy(base::WaitableEvent* done) {
+ DCHECK(gpu_task_runner_->BelongsToCurrentThread());
+ this->weak_factory_.InvalidateWeakPtrs();
+ done->Signal();
+ }
+
void DispatchToGpuPlatformSupportTask(IPC::Message* msg) {
ui::OzonePlatform::GetInstance()
->GetGpuPlatformSupport()
« 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