Index: media/ozone/media_ozone_platform.cc |
diff --git a/media/ozone/media_ozone_platform.cc b/media/ozone/media_ozone_platform.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4bf26c78db43ab17b9a5e15b76d7ce93ae183d66 |
--- /dev/null |
+++ b/media/ozone/media_ozone_platform.cc |
@@ -0,0 +1,92 @@ |
+// 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 "media/ozone/media_ozone_platform.h" |
+ |
+#include "base/debug/trace_event.h" |
+#include "base/logging.h" |
+#include "ui/ozone/platform_object.h" |
+#include "ui/ozone/platform_selection.h" |
+ |
+namespace media { |
+ |
+namespace { |
+ |
+class MediaOzonePlatformStub : public MediaOzonePlatform { |
+ public: |
+ MediaOzonePlatformStub() {} |
+ |
+ virtual ~MediaOzonePlatformStub() {} |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(MediaOzonePlatformStub); |
+}; |
+ |
+} // namespace |
+ |
+// the following are just convenient stubs and need to be removed once the |
+// internal platforms decide to actually implement their media specifics |
xhwang
2014/06/09 23:53:34
nit: Punctuation, Spelling and Grammar: http://goo
vignatti (out of this project)
2014/06/10 14:50:29
Done.
|
+ |
+MediaOzonePlatform* CreateMediaOzonePlatformCaca() { |
+ return new MediaOzonePlatformStub; |
+} |
+ |
+MediaOzonePlatform* CreateMediaOzonePlatformDri() { |
+ return new MediaOzonePlatformStub; |
+} |
+ |
+MediaOzonePlatform* CreateMediaOzonePlatformEgltest() { |
+ return new MediaOzonePlatformStub; |
+} |
+ |
+MediaOzonePlatform* CreateMediaOzonePlatformGbm() { |
+ return new MediaOzonePlatformStub; |
+} |
+ |
+MediaOzonePlatform* CreateMediaOzonePlatformTest() { |
+ return new MediaOzonePlatformStub; |
+} |
xhwang
2014/06/09 23:53:34
Are these declared by generate_constructor_list.py
vignatti (out of this project)
2014/06/10 14:50:29
Yes, these are used in this CL and declared by gen
|
+ |
+MediaOzonePlatform::MediaOzonePlatform() { |
+ CHECK(!instance_) << "There should only be a single MediaOzonePlatform."; |
+ instance_ = this; |
+} |
+ |
+MediaOzonePlatform::~MediaOzonePlatform() { |
+ CHECK_EQ(instance_, this); |
+ instance_ = NULL; |
+} |
+ |
+// static |
+MediaOzonePlatform* MediaOzonePlatform::GetInstance() { |
+ if (!instance_) |
+ CreateInstance(); |
+ return instance_; |
+} |
+ |
+VideoDecodeAccelerator* MediaOzonePlatform::CreateVideoDecodeAccelerator( |
+ const base::Callback<bool(void)>& make_context_current) { |
+ NOTIMPLEMENTED(); |
+ return NULL; |
+} |
+ |
+// static |
+void MediaOzonePlatform::CreateInstance() { |
+ if (!instance_) { |
xhwang
2014/06/09 23:53:34
nit: We like to return early:
if (instance_)
re
vignatti (out of this project)
2014/06/10 14:50:29
Done.
|
+ TRACE_EVENT1("ozone", |
+ "MediaOzonePlatform::Initialize", |
+ "platform", |
+ ui::GetOzonePlatformName()); |
+ scoped_ptr<MediaOzonePlatform> platform = |
+ ui::PlatformObject<MediaOzonePlatform>::Create(); |
xhwang
2014/06/09 23:53:34
Is it possible to use base/lazy_instance.h for |in
vignatti (out of this project)
2014/06/10 14:50:29
I think we could but we preferred the other style
spang
2014/06/10 15:24:23
No, lazy instance can NOT be used when you do not
|
+ |
+ // TODO(spang): Currently need to leak this object. |
xhwang
2014/06/09 23:53:34
Is there a bug tracking this?
vignatti (out of this project)
2014/06/10 14:50:29
no, sorry.
spang
2014/06/10 15:37:40
crbug.com/380884
|
+ CHECK_EQ(instance_, platform.release()); |
+ } |
+} |
+ |
+// static |
+MediaOzonePlatform* MediaOzonePlatform::instance_; |
+ |
+} // namespace media |