Chromium Code Reviews| 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, | |
| 22 int32 route_id, | |
| 23 IPC::Sender* sender) OVERRIDE {} | |
| 24 virtual void OnHostDestroyed(int host_id) OVERRIDE {} | |
| 25 virtual bool OnMessageReceived(const IPC::Message&) OVERRIDE { return false; } | |
| 26 }; | |
| 27 | |
| 28 } // namespace | |
| 29 | |
| 30 // static | |
| 31 GpuPlatformSupportHost* GpuPlatformSupportHost::Initialize() { | |
| 32 TRACE_EVENT0("ozone", "GpuPlatformSupportHost::Initialize"); | |
| 33 | |
| 34 CHECK(!instance_); | |
|
piman
2014/06/16 23:53:14
DCHECK instead.
| |
| 35 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host = | |
| 36 PlatformObject<GpuPlatformSupportHost>::Create(); | |
| 37 instance_ = gpu_platform_support_host.release(); | |
| 38 return instance_; | |
| 39 } | |
| 40 | |
| 41 // static | |
| 42 GpuPlatformSupportHost* GpuPlatformSupportHost::GetInstance() { | |
| 43 return instance_; | |
| 44 } | |
| 45 | |
| 46 // static | |
| 47 GpuPlatformSupportHost* GpuPlatformSupportHost::instance_; | |
| 48 | |
| 49 GpuPlatformSupportHost* CreateStubGpuPlatformSupportHost() { | |
| 50 return new StubGpuPlatformSupportHost; | |
| 51 } | |
| 52 | |
| 53 // TODO(spang): Stubs for internal platforms | |
| 54 OZONE_GPU_EXPORT GpuPlatformSupportHost* CreateGpuPlatformSupportHostCaca() { | |
| 55 return new StubGpuPlatformSupportHost; | |
| 56 } | |
| 57 OZONE_GPU_EXPORT GpuPlatformSupportHost* CreateGpuPlatformSupportHostDri() { | |
| 58 return new StubGpuPlatformSupportHost; | |
| 59 } | |
| 60 OZONE_GPU_EXPORT GpuPlatformSupportHost* CreateGpuPlatformSupportHostEgltest() { | |
| 61 return new StubGpuPlatformSupportHost; | |
| 62 } | |
| 63 OZONE_GPU_EXPORT GpuPlatformSupportHost* CreateGpuPlatformSupportHostGbm() { | |
| 64 return new StubGpuPlatformSupportHost; | |
| 65 } | |
| 66 OZONE_GPU_EXPORT GpuPlatformSupportHost* CreateGpuPlatformSupportHostTest() { | |
| 67 return new StubGpuPlatformSupportHost; | |
| 68 } | |
| 69 | |
| 70 } // namespace ui | |
| OLD | NEW |