| 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 "ui/events/device_data_manager.h" |
| 8 #include "ui/ozone/ozone_platform.h" | 9 #include "ui/ozone/ozone_platform.h" |
| 9 #include "ui/ozone/ozone_switches.h" | 10 #include "ui/ozone/ozone_switches.h" |
| 10 #include "ui/ozone/platform_object.h" | 11 #include "ui/ozone/platform_object.h" |
| 11 #include "ui/ozone/platform_selection.h" | 12 #include "ui/ozone/platform_selection.h" |
| 12 | 13 |
| 13 namespace ui { | 14 namespace ui { |
| 14 | 15 |
| 15 namespace { | 16 namespace { |
| 16 | 17 |
| 17 bool g_platform_initialized_ui = false; | 18 bool g_platform_initialized_ui = false; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 29 OzonePlatform::~OzonePlatform() { | 30 OzonePlatform::~OzonePlatform() { |
| 30 CHECK_EQ(instance_, this); | 31 CHECK_EQ(instance_, this); |
| 31 instance_ = NULL; | 32 instance_ = NULL; |
| 32 } | 33 } |
| 33 | 34 |
| 34 // static | 35 // static |
| 35 void OzonePlatform::InitializeForUI() { | 36 void OzonePlatform::InitializeForUI() { |
| 36 CreateInstance(); | 37 CreateInstance(); |
| 37 if (g_platform_initialized_ui) | 38 if (g_platform_initialized_ui) |
| 38 return; | 39 return; |
| 40 // Object keeps track of its lifetime. |
| 41 new DeviceDataManager(); |
| 39 g_platform_initialized_ui = true; | 42 g_platform_initialized_ui = true; |
| 40 instance_->InitializeUI(); | 43 instance_->InitializeUI(); |
| 41 } | 44 } |
| 42 | 45 |
| 43 // static | 46 // static |
| 44 void OzonePlatform::InitializeForGPU() { | 47 void OzonePlatform::InitializeForGPU() { |
| 45 CreateInstance(); | 48 CreateInstance(); |
| 46 if (g_platform_initialized_gpu) | 49 if (g_platform_initialized_gpu) |
| 47 return; | 50 return; |
| 48 g_platform_initialized_gpu = true; | 51 g_platform_initialized_gpu = true; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 67 | 70 |
| 68 // TODO(spang): Currently need to leak this object. | 71 // TODO(spang): Currently need to leak this object. |
| 69 CHECK_EQ(instance_, platform.release()); | 72 CHECK_EQ(instance_, platform.release()); |
| 70 } | 73 } |
| 71 } | 74 } |
| 72 | 75 |
| 73 // static | 76 // static |
| 74 OzonePlatform* OzonePlatform::instance_; | 77 OzonePlatform* OzonePlatform::instance_; |
| 75 | 78 |
| 76 } // namespace ui | 79 } // namespace ui |
| OLD | NEW |