Delete unused downloads page asset.
[chromium-blink-merge.git] / media / ozone / media_ozone_platform.cc
blobcda13962820c4221e5302cd5aa6e9ff46e52b232
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.
5 #include "media/ozone/media_ozone_platform.h"
7 #include "base/logging.h"
8 #include "base/trace_event/trace_event.h"
9 #include "ui/ozone/platform_object.h"
10 #include "ui/ozone/platform_selection.h"
12 namespace media {
14 namespace {
16 class MediaOzonePlatformStub : public MediaOzonePlatform {
17 public:
18 MediaOzonePlatformStub() {}
20 ~MediaOzonePlatformStub() override {}
22 private:
23 DISALLOW_COPY_AND_ASSIGN(MediaOzonePlatformStub);
26 } // namespace
28 // The following statics are just convenient stubs, declared by the
29 // generate_constructor_list.py script. They should be removed once the
30 // internal Ozone platforms decide to actually implement their media specifics.
31 MediaOzonePlatform* CreateMediaOzonePlatformCaca() {
32 return new MediaOzonePlatformStub;
35 MediaOzonePlatform* CreateMediaOzonePlatformCast() {
36 return new MediaOzonePlatformStub;
39 MediaOzonePlatform* CreateMediaOzonePlatformDri() {
40 return new MediaOzonePlatformStub;
43 MediaOzonePlatform* CreateMediaOzonePlatformDrm() {
44 return new MediaOzonePlatformStub;
47 MediaOzonePlatform* CreateMediaOzonePlatformEgltest() {
48 return new MediaOzonePlatformStub;
51 MediaOzonePlatform* CreateMediaOzonePlatformGbm() {
52 return new MediaOzonePlatformStub;
55 MediaOzonePlatform* CreateMediaOzonePlatformTest() {
56 return new MediaOzonePlatformStub;
59 MediaOzonePlatform::MediaOzonePlatform() {
60 CHECK(!instance_) << "There should only be a single MediaOzonePlatform.";
61 instance_ = this;
64 MediaOzonePlatform::~MediaOzonePlatform() {
65 CHECK_EQ(instance_, this);
66 instance_ = NULL;
69 // static
70 MediaOzonePlatform* MediaOzonePlatform::GetInstance() {
71 if (!instance_)
72 CreateInstance();
73 return instance_;
76 VideoDecodeAccelerator* MediaOzonePlatform::CreateVideoDecodeAccelerator(
77 const base::Callback<bool(void)>& make_context_current) {
78 NOTIMPLEMENTED();
79 return NULL;
82 // static
83 void MediaOzonePlatform::CreateInstance() {
84 if (instance_)
85 return;
87 TRACE_EVENT1("ozone",
88 "MediaOzonePlatform::Initialize",
89 "platform",
90 ui::GetOzonePlatformName());
91 scoped_ptr<MediaOzonePlatform> platform =
92 ui::PlatformObject<MediaOzonePlatform>::Create();
94 // TODO(spang): Currently need to leak this object.
95 CHECK_EQ(instance_, platform.release());
98 // static
99 MediaOzonePlatform* MediaOzonePlatform::instance_;
101 } // namespace media