| OLD | NEW |
| 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 "content/common/gpu/media/video_decode_factory_ozone.h" |
| 8 #include "ui/base/cursor/ozone/cursor_factory_ozone.h" | 9 #include "ui/base/cursor/ozone/cursor_factory_ozone.h" |
| 9 #include "ui/events/ozone/event_factory_ozone.h" | 10 #include "ui/events/ozone/event_factory_ozone.h" |
| 10 #include "ui/gfx/ozone/surface_factory_ozone.h" | 11 #include "ui/gfx/ozone/surface_factory_ozone.h" |
| 11 #include "ui/ozone/ime/input_method_context_factory_ozone.h" | 12 #include "ui/ozone/ime/input_method_context_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 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 36 return kOzonePlatforms[0].name; | 37 return kOzonePlatforms[0].name; |
| 37 return CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 38 return CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 38 switches::kOzonePlatform); | 39 switches::kOzonePlatform); |
| 39 } | 40 } |
| 40 | 41 |
| 41 } // namespace | 42 } // namespace |
| 42 | 43 |
| 43 OzonePlatform::OzonePlatform() {} | 44 OzonePlatform::OzonePlatform() {} |
| 44 | 45 |
| 45 OzonePlatform::~OzonePlatform() { | 46 OzonePlatform::~OzonePlatform() { |
| 47 content::VideoDecodeFactoryOzone::SetInstance(NULL); |
| 46 gfx::SurfaceFactoryOzone::SetInstance(NULL); | 48 gfx::SurfaceFactoryOzone::SetInstance(NULL); |
| 47 ui::EventFactoryOzone::SetInstance(NULL); | 49 ui::EventFactoryOzone::SetInstance(NULL); |
| 48 ui::CursorFactoryOzone::SetInstance(NULL); | 50 ui::CursorFactoryOzone::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. |
| 65 content::VideoDecodeFactoryOzone::SetInstance( |
| 66 instance_->GetVideoDecodeFactoryOzone()); |
| 63 gfx::SurfaceFactoryOzone::SetInstance(instance_->GetSurfaceFactoryOzone()); | 67 gfx::SurfaceFactoryOzone::SetInstance(instance_->GetSurfaceFactoryOzone()); |
| 64 ui::EventFactoryOzone::SetInstance(instance_->GetEventFactoryOzone()); | 68 ui::EventFactoryOzone::SetInstance(instance_->GetEventFactoryOzone()); |
| 65 ui::InputMethodContextFactoryOzone::SetInstance( | 69 ui::InputMethodContextFactoryOzone::SetInstance( |
| 66 instance_->GetInputMethodContextFactoryOzone()); | 70 instance_->GetInputMethodContextFactoryOzone()); |
| 67 ui::CursorFactoryOzone::SetInstance(instance_->GetCursorFactoryOzone()); | 71 ui::CursorFactoryOzone::SetInstance(instance_->GetCursorFactoryOzone()); |
| 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 |
| OLD | NEW |