Chromium Code Reviews| Index: ui/ozone/gpu/gpu_platform_support.cc |
| diff --git a/ui/ozone/gpu/gpu_platform_support.cc b/ui/ozone/gpu/gpu_platform_support.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..142a396cdf6c50aace729ac31f31eda6c0bf4273 |
| --- /dev/null |
| +++ b/ui/ozone/gpu/gpu_platform_support.cc |
| @@ -0,0 +1,67 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "ui/ozone/gpu/gpu_platform_support.h" |
| + |
| +#include "base/debug/trace_event.h" |
| +#include "base/logging.h" |
| +#include "ui/ozone/gpu/ozone_gpu_export.h" |
| +#include "ui/ozone/platform_object.h" |
| + |
| +namespace ui { |
| + |
| +namespace { |
| + |
| +// No-op implementation of GpuPlatformSupport. |
| +class OZONE_GPU_EXPORT StubGpuPlatformSupport : public GpuPlatformSupport { |
| + public: |
| + // GpuPlatformSupport: |
| + virtual void OnChannelEstablished(IPC::Sender* sender, |
| + int32 route_id) OVERRIDE {} |
| + bool OnMessageReceived(const IPC::Message&) OVERRIDE { return false; } |
| +}; |
| + |
| +} // namespace |
| + |
| +// static |
| +GpuPlatformSupport* GpuPlatformSupport::Initialize() { |
| + TRACE_EVENT0("ozone", "GpuPlatformSupport::Initialize"); |
| + |
| + CHECK(!instance_); |
|
piman
2014/06/16 23:53:14
DCHECK instead
|
| + scoped_ptr<GpuPlatformSupport> gpu_platform_support = |
| + PlatformObject<GpuPlatformSupport>::Create(); |
| + instance_ = gpu_platform_support.release(); |
| + return instance_; |
| +} |
| + |
| +// static |
| +GpuPlatformSupport* GpuPlatformSupport::GetInstance() { |
| + return instance_; |
| +} |
| + |
| +// static |
| +GpuPlatformSupport* GpuPlatformSupport::instance_; |
| + |
| +GpuPlatformSupport* CreateStubGpuPlatformSupport() { |
| + return new StubGpuPlatformSupport; |
| +} |
| + |
| +// TODO(spang): Stubs for internal platforms |
| +OZONE_GPU_EXPORT GpuPlatformSupport* CreateGpuPlatformSupportCaca() { |
| + return new StubGpuPlatformSupport; |
| +} |
| +OZONE_GPU_EXPORT GpuPlatformSupport* CreateGpuPlatformSupportDri() { |
| + return new StubGpuPlatformSupport; |
| +} |
| +OZONE_GPU_EXPORT GpuPlatformSupport* CreateGpuPlatformSupportEgltest() { |
| + return new StubGpuPlatformSupport; |
| +} |
| +OZONE_GPU_EXPORT GpuPlatformSupport* CreateGpuPlatformSupportGbm() { |
| + return new StubGpuPlatformSupport; |
| +} |
| +OZONE_GPU_EXPORT GpuPlatformSupport* CreateGpuPlatformSupportTest() { |
| + return new StubGpuPlatformSupport; |
| +} |
| + |
| +} // namespace ui |