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.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 implementation of GpuPlatformSupport. | |
| 17 class OZONE_GPU_EXPORT StubGpuPlatformSupport : public GpuPlatformSupport { | |
| 18 public: | |
| 19 // GpuPlatformSupport: | |
| 20 virtual void OnChannelEstablished(IPC::Sender* sender, | |
| 21 int32 route_id) OVERRIDE {} | |
| 22 bool OnMessageReceived(const IPC::Message&) OVERRIDE { return false; } | |
| 23 }; | |
| 24 | |
| 25 } // namespace | |
| 26 | |
| 27 // static | |
| 28 GpuPlatformSupport* GpuPlatformSupport::Initialize() { | |
| 29 TRACE_EVENT0("ozone", "GpuPlatformSupport::Initialize"); | |
| 30 | |
| 31 CHECK(!instance_); | |
|
piman
2014/06/16 23:53:14
DCHECK instead
| |
| 32 scoped_ptr<GpuPlatformSupport> gpu_platform_support = | |
| 33 PlatformObject<GpuPlatformSupport>::Create(); | |
| 34 instance_ = gpu_platform_support.release(); | |
| 35 return instance_; | |
| 36 } | |
| 37 | |
| 38 // static | |
| 39 GpuPlatformSupport* GpuPlatformSupport::GetInstance() { | |
| 40 return instance_; | |
| 41 } | |
| 42 | |
| 43 // static | |
| 44 GpuPlatformSupport* GpuPlatformSupport::instance_; | |
| 45 | |
| 46 GpuPlatformSupport* CreateStubGpuPlatformSupport() { | |
| 47 return new StubGpuPlatformSupport; | |
| 48 } | |
| 49 | |
| 50 // TODO(spang): Stubs for internal platforms | |
| 51 OZONE_GPU_EXPORT GpuPlatformSupport* CreateGpuPlatformSupportCaca() { | |
| 52 return new StubGpuPlatformSupport; | |
| 53 } | |
| 54 OZONE_GPU_EXPORT GpuPlatformSupport* CreateGpuPlatformSupportDri() { | |
| 55 return new StubGpuPlatformSupport; | |
| 56 } | |
| 57 OZONE_GPU_EXPORT GpuPlatformSupport* CreateGpuPlatformSupportEgltest() { | |
| 58 return new StubGpuPlatformSupport; | |
| 59 } | |
| 60 OZONE_GPU_EXPORT GpuPlatformSupport* CreateGpuPlatformSupportGbm() { | |
| 61 return new StubGpuPlatformSupport; | |
| 62 } | |
| 63 OZONE_GPU_EXPORT GpuPlatformSupport* CreateGpuPlatformSupportTest() { | |
| 64 return new StubGpuPlatformSupport; | |
| 65 } | |
| 66 | |
| 67 } // namespace ui | |
| OLD | NEW |