| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
| 8 #include "ui/events/devices/device_data_manager.h" | 8 #include "ui/events/devices/device_data_manager.h" |
| 9 #include "ui/ozone/platform_object.h" | 9 #include "ui/ozone/platform_object.h" |
| 10 #include "ui/ozone/platform_selection.h" | 10 #include "ui/ozone/platform_selection.h" |
| 11 #include "ui/ozone/public/ozone_client.h" |
| 11 #include "ui/ozone/public/ozone_platform.h" | 12 #include "ui/ozone/public/ozone_platform.h" |
| 12 #include "ui/ozone/public/ozone_switches.h" | 13 #include "ui/ozone/public/ozone_switches.h" |
| 13 | 14 |
| 14 namespace ui { | 15 namespace ui { |
| 15 | 16 |
| 16 namespace { | 17 namespace { |
| 17 | 18 |
| 18 bool g_platform_initialized_ui = false; | 19 bool g_platform_initialized_ui = false; |
| 19 bool g_platform_initialized_gpu = false; | 20 bool g_platform_initialized_gpu = false; |
| 20 | 21 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 35 // static | 36 // static |
| 36 void OzonePlatform::InitializeForUI() { | 37 void OzonePlatform::InitializeForUI() { |
| 37 CreateInstance(); | 38 CreateInstance(); |
| 38 if (g_platform_initialized_ui) | 39 if (g_platform_initialized_ui) |
| 39 return; | 40 return; |
| 40 g_platform_initialized_ui = true; | 41 g_platform_initialized_ui = true; |
| 41 instance_->InitializeUI(); | 42 instance_->InitializeUI(); |
| 42 // This is deliberately created after initializing so that the platform can | 43 // This is deliberately created after initializing so that the platform can |
| 43 // create its own version of DDM. | 44 // create its own version of DDM. |
| 44 DeviceDataManager::CreateInstance(); | 45 DeviceDataManager::CreateInstance(); |
| 46 |
| 47 OzoneClient::InitializeForUI(); |
| 45 } | 48 } |
| 46 | 49 |
| 47 // static | 50 // static |
| 48 void OzonePlatform::InitializeForGPU() { | 51 void OzonePlatform::InitializeForGPU() { |
| 49 CreateInstance(); | 52 CreateInstance(); |
| 50 if (g_platform_initialized_gpu) | 53 if (g_platform_initialized_gpu) |
| 51 return; | 54 return; |
| 52 g_platform_initialized_gpu = true; | 55 g_platform_initialized_gpu = true; |
| 53 instance_->InitializeGPU(); | 56 instance_->InitializeGPU(); |
| 54 } | 57 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 72 // TODO(spang): Currently need to leak this object. | 75 // TODO(spang): Currently need to leak this object. |
| 73 OzonePlatform* pl = platform.release(); | 76 OzonePlatform* pl = platform.release(); |
| 74 DCHECK_EQ(instance_, pl); | 77 DCHECK_EQ(instance_, pl); |
| 75 } | 78 } |
| 76 } | 79 } |
| 77 | 80 |
| 78 // static | 81 // static |
| 79 OzonePlatform* OzonePlatform::instance_; | 82 OzonePlatform* OzonePlatform::instance_; |
| 80 | 83 |
| 81 } // namespace ui | 84 } // namespace ui |
| OLD | NEW |