Index: media/ozone/ozone_platform.cc |
diff --git a/media/ozone/ozone_platform.cc b/media/ozone/ozone_platform.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b6c51b3529851d0ccd5c17af6e59feab3f5e5ee7 |
--- /dev/null |
+++ b/media/ozone/ozone_platform.cc |
@@ -0,0 +1,61 @@ |
+// 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/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 { |
+ |
+// the following are just convenient stubs and need to be removed once the |
+// internal platforms decide to actually implement their media specifics |
+OzonePlatformMedia* CreateOzonePlatformMediaDri() { return NULL; } |
spang
2014/06/09 19:17:32
You are dereferencing this NULL elsewhere.
For no
vignatti (out of this project)
2014/06/09 20:30:27
Done.
|
+OzonePlatformMedia* CreateOzonePlatformMediaEgltest() { return NULL; } |
+OzonePlatformMedia* CreateOzonePlatformMediaTest() { return NULL; } |
+ |
+OzonePlatformMedia::OzonePlatformMedia() { |
+ CHECK(!instance_) << "There should only be a single OzonePlatformMedia."; |
+ instance_ = this; |
+} |
+ |
+OzonePlatformMedia::~OzonePlatformMedia() { |
+ CHECK_EQ(instance_, this); |
+ instance_ = NULL; |
+} |
+ |
+// static |
+OzonePlatformMedia* OzonePlatformMedia::GetInstance() { |
+ if (!instance_) |
+ CreateInstance(); |
+ return instance_; |
+} |
+ |
+VideoDecodeAccelerator* OzonePlatformMedia::CreateVideoDecodeFactoryOzone( |
+ const base::Callback<bool(void)>& make_context_current) { |
+ NOTIMPLEMENTED(); |
+ return NULL; |
+} |
+ |
+// static |
+void OzonePlatformMedia::CreateInstance() { |
+ if (!instance_) { |
+ TRACE_EVENT1("ozone", |
+ "OzonePlatformMedia::Initialize", |
+ "platform", |
+ ui::GetOzonePlatformName()); |
+ scoped_ptr<OzonePlatformMedia> platform = |
+ ui::PlatformObject<OzonePlatformMedia>::Create(); |
+ |
+ // TODO(spang): Currently need to leak this object. |
+ CHECK_EQ(instance_, platform.release()); |
+ } |
+} |
+ |
+// static |
+OzonePlatformMedia* OzonePlatformMedia::instance_; |
+ |
+} // namespace media |