OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #include "ui/ozone/public/ui_thread_gpu.h" |
| 6 |
| 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" |
| 13 |
| 14 namespace ui { |
| 15 |
| 16 class UiThreadGpuForwardingSender : public IPC::Sender { |
| 17 public: |
| 18 explicit UiThreadGpuForwardingSender(IPC::Listener* listener) |
| 19 : listener_(listener) {} |
| 20 virtual ~UiThreadGpuForwardingSender() {} |
| 21 |
| 22 // IPC::Sender: |
| 23 virtual bool Send(IPC::Message* msg) OVERRIDE { |
| 24 listener_->OnMessageReceived(*msg); |
| 25 delete msg; |
| 26 return true; |
| 27 } |
| 28 |
| 29 private: |
| 30 IPC::Listener* listener_; |
| 31 }; |
| 32 |
| 33 UiThreadGpu::UiThreadGpu() { |
| 34 } |
| 35 |
| 36 UiThreadGpu::~UiThreadGpu() { |
| 37 } |
| 38 |
| 39 bool UiThreadGpu::Initialize() { |
| 40 OzonePlatform* platform = ui::OzonePlatform::GetInstance(); |
| 41 |
| 42 ui_sender_.reset( |
| 43 new UiThreadGpuForwardingSender(platform->GetGpuPlatformSupportHost())); |
| 44 gpu_sender_.reset( |
| 45 new UiThreadGpuForwardingSender(platform->GetGpuPlatformSupport())); |
| 46 |
| 47 const int kHostId = 1; |
| 48 platform->GetGpuPlatformSupportHost()->OnChannelEstablished( |
| 49 kHostId, gpu_sender_.get()); |
| 50 platform->GetGpuPlatformSupport()->OnChannelEstablished(ui_sender_.get()); |
| 51 |
| 52 return true; |
| 53 } |
| 54 |
| 55 } // namespace ui |
OLD | NEW |