Revert "[Hotword] Implement IsHotwordHardwareAvailable() using device types."
[chromium-blink-merge.git] / ui / ozone / public / ui_thread_gpu.cc
blobb788bd5c1c5e78018d6feb31243cd8800ef8ba5b
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/ozone/public/ui_thread_gpu.h"
7 #include "ipc/ipc_listener.h"
8 #include "ipc/ipc_message.h"
9 #include "ipc/ipc_sender.h"
10 #include "ui/ozone/public/gpu_platform_support.h"
11 #include "ui/ozone/public/gpu_platform_support_host.h"
12 #include "ui/ozone/public/ozone_platform.h"
14 namespace ui {
16 class UiThreadGpuForwardingSender : public IPC::Sender {
17 public:
18 explicit UiThreadGpuForwardingSender(IPC::Listener* listener)
19 : listener_(listener) {}
20 ~UiThreadGpuForwardingSender() override {}
22 // IPC::Sender:
23 bool Send(IPC::Message* msg) override {
24 listener_->OnMessageReceived(*msg);
25 delete msg;
26 return true;
29 private:
30 IPC::Listener* listener_;
33 UiThreadGpu::UiThreadGpu() {
36 UiThreadGpu::~UiThreadGpu() {
39 bool UiThreadGpu::Initialize() {
40 OzonePlatform* platform = ui::OzonePlatform::GetInstance();
42 ui_sender_.reset(
43 new UiThreadGpuForwardingSender(platform->GetGpuPlatformSupportHost()));
44 gpu_sender_.reset(
45 new UiThreadGpuForwardingSender(platform->GetGpuPlatformSupport()));
47 const int kHostId = 1;
48 platform->GetGpuPlatformSupportHost()->OnChannelEstablished(
49 kHostId, gpu_sender_.get());
50 platform->GetGpuPlatformSupport()->OnChannelEstablished(ui_sender_.get());
52 return true;
55 } // namespace ui