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 "media/ozone/media_ozone_platform.h" | |
6 | |
7 #include "base/debug/trace_event.h" | |
8 #include "base/logging.h" | |
9 #include "ui/ozone/platform_object.h" | |
10 #include "ui/ozone/platform_selection.h" | |
11 | |
12 namespace media { | |
13 | |
14 namespace { | |
15 | |
16 class MediaOzonePlatformStub : public MediaOzonePlatform { | |
17 public: | |
18 MediaOzonePlatformStub() {} | |
19 | |
20 virtual ~MediaOzonePlatformStub() {} | |
21 | |
22 private: | |
23 DISALLOW_COPY_AND_ASSIGN(MediaOzonePlatformStub); | |
24 }; | |
25 | |
26 } // namespace | |
27 | |
28 // the following are just convenient stubs and need to be removed once the | |
29 // internal platforms decide to actually implement their media specifics | |
30 MediaOzonePlatform* CreateMediaOzonePlatformDri() { | |
31 return new MediaOzonePlatformStub; | |
32 } | |
33 | |
34 MediaOzonePlatform* CreateMediaOzonePlatformEgltest() { | |
35 return new MediaOzonePlatformStub; | |
36 } | |
37 | |
38 MediaOzonePlatform* CreateMediaOzonePlatformTest() { | |
39 return new MediaOzonePlatformStub; | |
40 } | |
spang
2014/06/09 20:53:57
Two more that are off by default:
Gbm
Caca
| |
41 | |
42 MediaOzonePlatform::MediaOzonePlatform() { | |
43 CHECK(!instance_) << "There should only be a single MediaOzonePlatform."; | |
44 instance_ = this; | |
45 } | |
46 | |
47 MediaOzonePlatform::~MediaOzonePlatform() { | |
48 CHECK_EQ(instance_, this); | |
49 instance_ = NULL; | |
50 } | |
51 | |
52 // static | |
53 MediaOzonePlatform* MediaOzonePlatform::GetInstance() { | |
54 if (!instance_) | |
55 CreateInstance(); | |
56 return instance_; | |
57 } | |
58 | |
59 VideoDecodeAccelerator* MediaOzonePlatform::CreateVideoDecodeAccelerator( | |
60 const base::Callback<bool(void)>& make_context_current) { | |
61 NOTIMPLEMENTED(); | |
62 return NULL; | |
63 } | |
64 | |
65 // static | |
66 void MediaOzonePlatform::CreateInstance() { | |
67 if (!instance_) { | |
68 TRACE_EVENT1("ozone", | |
69 "MediaOzonePlatform::Initialize", | |
70 "platform", | |
71 ui::GetOzonePlatformName()); | |
72 scoped_ptr<MediaOzonePlatform> platform = | |
73 ui::PlatformObject<MediaOzonePlatform>::Create(); | |
74 | |
75 // TODO(spang): Currently need to leak this object. | |
76 CHECK_EQ(instance_, platform.release()); | |
77 } | |
78 } | |
79 | |
80 // static | |
81 MediaOzonePlatform* MediaOzonePlatform::instance_; | |
82 | |
83 } // namespace media | |
OLD | NEW |