Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: ui/ozone/ozone_platform.cc

Issue 269673005: media: Add MediaOzonePlatform support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix up dependency cycle Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/debug/trace_event.h" 6 #include "base/debug/trace_event.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/base/cursor/ozone/cursor_factory_ozone.h" 8 #include "ui/base/cursor/ozone/cursor_factory_ozone.h"
9 #include "ui/events/ozone/event_factory_ozone.h" 9 #include "ui/events/ozone/event_factory_ozone.h"
10 #include "ui/gfx/ozone/surface_factory_ozone.h" 10 #include "ui/gfx/ozone/surface_factory_ozone.h"
11 #include "ui/ozone/ime/input_method_context_factory_ozone.h" 11 #include "ui/ozone/ime/input_method_context_factory_ozone.h"
12 #include "ui/ozone/media/video_decode_factory_ozone.h"
12 #include "ui/ozone/ozone_platform.h" 13 #include "ui/ozone/ozone_platform.h"
13 #include "ui/ozone/ozone_platform_list.h" 14 #include "ui/ozone/ozone_platform_list.h"
14 #include "ui/ozone/ozone_switches.h" 15 #include "ui/ozone/ozone_switches.h"
15 16
16 namespace ui { 17 namespace ui {
17 18
18 namespace { 19 namespace {
19 20
20 // Helper to construct an OzonePlatform by name using the platform list. 21 // Helper to construct an OzonePlatform by name using the platform list.
21 OzonePlatform* CreatePlatform(const std::string& platform_name) { 22 OzonePlatform* CreatePlatform(const std::string& platform_name) {
(...skipping 17 matching lines...) Expand all
39 } 40 }
40 41
41 } // namespace 42 } // namespace
42 43
43 OzonePlatform::OzonePlatform() {} 44 OzonePlatform::OzonePlatform() {}
44 45
45 OzonePlatform::~OzonePlatform() { 46 OzonePlatform::~OzonePlatform() {
46 gfx::SurfaceFactoryOzone::SetInstance(NULL); 47 gfx::SurfaceFactoryOzone::SetInstance(NULL);
47 ui::EventFactoryOzone::SetInstance(NULL); 48 ui::EventFactoryOzone::SetInstance(NULL);
48 ui::CursorFactoryOzone::SetInstance(NULL); 49 ui::CursorFactoryOzone::SetInstance(NULL);
50 ui::VideoDecodeFactoryOzone::SetInstance(NULL);
49 } 51 }
50 52
51 // static 53 // static
52 void OzonePlatform::Initialize() { 54 void OzonePlatform::Initialize() {
53 if (instance_) 55 if (instance_)
54 return; 56 return;
55 57
56 std::string platform = GetPlatformName(); 58 std::string platform = GetPlatformName();
57 59
58 TRACE_EVENT1("ozone", "OzonePlatform::Initialize", "platform", platform); 60 TRACE_EVENT1("ozone", "OzonePlatform::Initialize", "platform", platform);
59 61
60 instance_ = CreatePlatform(platform); 62 instance_ = CreatePlatform(platform);
61 63
62 // Inject ozone interfaces. 64 // Inject ozone interfaces.
63 gfx::SurfaceFactoryOzone::SetInstance(instance_->GetSurfaceFactoryOzone()); 65 gfx::SurfaceFactoryOzone::SetInstance(instance_->GetSurfaceFactoryOzone());
64 ui::EventFactoryOzone::SetInstance(instance_->GetEventFactoryOzone()); 66 ui::EventFactoryOzone::SetInstance(instance_->GetEventFactoryOzone());
65 ui::InputMethodContextFactoryOzone::SetInstance( 67 ui::InputMethodContextFactoryOzone::SetInstance(
66 instance_->GetInputMethodContextFactoryOzone()); 68 instance_->GetInputMethodContextFactoryOzone());
67 ui::CursorFactoryOzone::SetInstance(instance_->GetCursorFactoryOzone()); 69 ui::CursorFactoryOzone::SetInstance(instance_->GetCursorFactoryOzone());
70 ui::VideoDecodeFactoryOzone::SetInstance(
71 instance_->GetVideoDecodeFactoryOzone());
68 } 72 }
69 73
70 // static 74 // static
71 OzonePlatform* OzonePlatform::GetInstance() { 75 OzonePlatform* OzonePlatform::GetInstance() {
72 CHECK(instance_) << "OzonePlatform is not initialized"; 76 CHECK(instance_) << "OzonePlatform is not initialized";
73 return instance_; 77 return instance_;
74 } 78 }
75 79
76 // static 80 // static
77 OzonePlatform* OzonePlatform::instance_; 81 OzonePlatform* OzonePlatform::instance_;
78 82
79 } // namespace ui 83 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698