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/gpu/gpu_platform_support_host.h" |
| 6 |
| 7 #include "base/debug/trace_event.h" |
| 8 #include "base/logging.h" |
| 9 #include "ui/ozone/gpu/ozone_gpu_export.h" |
| 10 #include "ui/ozone/platform_object.h" |
| 11 |
| 12 namespace ui { |
| 13 |
| 14 namespace { |
| 15 |
| 16 // No-op implementations of GpuPlatformSupportHost. |
| 17 class OZONE_GPU_EXPORT StubGpuPlatformSupportHost |
| 18 : public GpuPlatformSupportHost { |
| 19 public: |
| 20 // GpuPlatformSupportHost: |
| 21 virtual void OnChannelEstablished(int host_id, IPC::Sender* sender) OVERRIDE { |
| 22 } |
| 23 virtual void OnChannelDestroyed(int host_id) OVERRIDE {} |
| 24 virtual bool OnMessageReceived(const IPC::Message&) OVERRIDE { return false; } |
| 25 }; |
| 26 |
| 27 } // namespace |
| 28 |
| 29 // static |
| 30 GpuPlatformSupportHost* GpuPlatformSupportHost::Initialize() { |
| 31 TRACE_EVENT0("ozone", "GpuPlatformSupportHost::Initialize"); |
| 32 |
| 33 DCHECK(!instance_); |
| 34 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host = |
| 35 PlatformObject<GpuPlatformSupportHost>::Create(); |
| 36 instance_ = gpu_platform_support_host.release(); |
| 37 return instance_; |
| 38 } |
| 39 |
| 40 // static |
| 41 GpuPlatformSupportHost* GpuPlatformSupportHost::GetInstance() { |
| 42 return instance_; |
| 43 } |
| 44 |
| 45 // static |
| 46 GpuPlatformSupportHost* GpuPlatformSupportHost::instance_; |
| 47 |
| 48 GpuPlatformSupportHost* CreateStubGpuPlatformSupportHost() { |
| 49 return new StubGpuPlatformSupportHost; |
| 50 } |
| 51 |
| 52 // TODO(spang): Stubs for internal platforms |
| 53 OZONE_GPU_EXPORT GpuPlatformSupportHost* CreateGpuPlatformSupportHostCaca() { |
| 54 return new StubGpuPlatformSupportHost; |
| 55 } |
| 56 OZONE_GPU_EXPORT GpuPlatformSupportHost* CreateGpuPlatformSupportHostDri() { |
| 57 return new StubGpuPlatformSupportHost; |
| 58 } |
| 59 OZONE_GPU_EXPORT GpuPlatformSupportHost* CreateGpuPlatformSupportHostEgltest() { |
| 60 return new StubGpuPlatformSupportHost; |
| 61 } |
| 62 OZONE_GPU_EXPORT GpuPlatformSupportHost* CreateGpuPlatformSupportHostGbm() { |
| 63 return new StubGpuPlatformSupportHost; |
| 64 } |
| 65 OZONE_GPU_EXPORT GpuPlatformSupportHost* CreateGpuPlatformSupportHostTest() { |
| 66 return new StubGpuPlatformSupportHost; |
| 67 } |
| 68 |
| 69 } // namespace ui |
OLD | NEW |