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

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

Issue 936703002: Fix UiThreadGpu initialization for video accelerator tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename Created 5 years, 10 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 | « ui/ozone/public/ui_thread_gpu.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/public/ui_thread_gpu.cc
diff --git a/ui/ozone/public/ui_thread_gpu.cc b/ui/ozone/public/ui_thread_gpu.cc
deleted file mode 100644
index aeb08b137e037d417dde5a6a7159b0717048fdb3..0000000000000000000000000000000000000000
--- a/ui/ozone/public/ui_thread_gpu.cc
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/ozone/public/ui_thread_gpu.h"
-
-#include "base/thread_task_runner_handle.h"
-#include "ipc/ipc_listener.h"
-#include "ipc/ipc_message.h"
-#include "ipc/ipc_sender.h"
-#include "ipc/message_filter.h"
-#include "ui/ozone/public/gpu_platform_support.h"
-#include "ui/ozone/public/gpu_platform_support_host.h"
-#include "ui/ozone/public/ozone_platform.h"
-
-namespace ui {
-
-namespace {
-
-const int kGpuProcessHostId = 1;
-
-} // namespace
-
-class FakeGpuProcess : public IPC::Sender {
- public:
- FakeGpuProcess() : weak_factory_(this) {}
- ~FakeGpuProcess() override {}
-
- void Init() {
- task_runner_ = base::ThreadTaskRunnerHandle::Get();
-
- ui::OzonePlatform::GetInstance()
- ->GetGpuPlatformSupport()
- ->OnChannelEstablished(this);
- }
-
- void InitOnIO() {
- ui::OzonePlatform::GetInstance()
- ->GetGpuPlatformSupport()
- ->GetMessageFilter()
- ->OnFilterAdded(this);
- }
-
- bool Send(IPC::Message* msg) override {
- DCHECK(task_runner_->BelongsToCurrentThread());
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&FakeGpuProcess::DispatchToGpuPlatformSupportHostTask,
- weak_factory_.GetWeakPtr(), msg));
- return true;
- }
-
- private:
- void DispatchToGpuPlatformSupportHostTask(IPC::Message* msg) {
- ui::OzonePlatform::GetInstance()
- ->GetGpuPlatformSupportHost()
- ->OnMessageReceived(*msg);
- delete msg;
- }
-
- scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
- base::WeakPtrFactory<FakeGpuProcess> weak_factory_;
-};
-
-class FakeGpuProcessHost {
- public:
- FakeGpuProcessHost() : weak_factory_(this) {}
- ~FakeGpuProcessHost() {}
-
- void Init() {
- task_runner_ = base::ThreadTaskRunnerHandle::Get();
-
- base::Callback<void(IPC::Message*)> sender =
- base::Bind(&FakeGpuProcessHost::DispatchToGpuPlatformSupportTask,
- weak_factory_.GetWeakPtr());
-
- ui::OzonePlatform::GetInstance()
- ->GetGpuPlatformSupportHost()
- ->OnChannelEstablished(kGpuProcessHostId, task_runner_, sender);
- }
-
- private:
- void DispatchToGpuPlatformSupportTask(IPC::Message* msg) {
- DCHECK(task_runner_->BelongsToCurrentThread());
- ui::OzonePlatform::GetInstance()
- ->GetGpuPlatformSupport()
- ->OnMessageReceived(*msg);
- delete msg;
- }
-
- scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
- base::WeakPtrFactory<FakeGpuProcessHost> weak_factory_;
-};
-
-UiThreadGpu::UiThreadGpu() {
-}
-
-UiThreadGpu::~UiThreadGpu() {
-}
-
-bool UiThreadGpu::Initialize() {
- io_helper_thread_.reset(new base::Thread("IOHelperThread"));
- if (!io_helper_thread_->StartWithOptions(
- base::Thread::Options(base::MessageLoop::TYPE_IO, 0)))
- return false;
-
- fake_gpu_process_.reset(new FakeGpuProcess);
- io_helper_thread_->task_runner()->PostTask(
- FROM_HERE, base::Bind(&FakeGpuProcess::InitOnIO,
- base::Unretained(fake_gpu_process_.get())));
- fake_gpu_process_->Init();
-
- fake_gpu_process_host_.reset(new FakeGpuProcessHost);
- fake_gpu_process_host_->Init();
-
- return true;
-}
-
-} // namespace ui
« no previous file with comments | « ui/ozone/public/ui_thread_gpu.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698