| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/arc/arc_service_manager.h" | 5 #include "components/arc/arc_service_manager.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/sequenced_task_runner.h" | 8 #include "base/sequenced_task_runner.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "components/arc/arc_bridge_bootstrap.h" | 10 #include "components/arc/arc_bridge_bootstrap.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 ArcServiceManager* g_arc_service_manager = nullptr; | 34 ArcServiceManager* g_arc_service_manager = nullptr; |
| 35 | 35 |
| 36 // This pointer is owned by ArcServiceManager. | 36 // This pointer is owned by ArcServiceManager. |
| 37 ArcBridgeService* g_arc_bridge_service_for_testing = nullptr; | 37 ArcBridgeService* g_arc_bridge_service_for_testing = nullptr; |
| 38 | 38 |
| 39 } // namespace | 39 } // namespace |
| 40 | 40 |
| 41 ArcServiceManager::ArcServiceManager( | 41 ArcServiceManager::ArcServiceManager( |
| 42 scoped_refptr<base::TaskRunner> blocking_task_runner) | 42 scoped_refptr<base::TaskRunner> blocking_task_runner) |
| 43 : blocking_task_runner_(blocking_task_runner), | 43 : blocking_task_runner_(blocking_task_runner), |
| 44 icon_loader_(new ActivityIconLoader) { | 44 icon_loader_(new ActivityIconLoader), |
| 45 activity_resolver_(new LocalActivityResolver) { |
| 45 DCHECK(!g_arc_service_manager); | 46 DCHECK(!g_arc_service_manager); |
| 46 g_arc_service_manager = this; | 47 g_arc_service_manager = this; |
| 47 | 48 |
| 48 if (g_arc_bridge_service_for_testing) { | 49 if (g_arc_bridge_service_for_testing) { |
| 49 arc_bridge_service_.reset(g_arc_bridge_service_for_testing); | 50 arc_bridge_service_.reset(g_arc_bridge_service_for_testing); |
| 50 g_arc_bridge_service_for_testing = nullptr; | 51 g_arc_bridge_service_for_testing = nullptr; |
| 51 } else { | 52 } else { |
| 52 arc_bridge_service_.reset(new ArcBridgeServiceImpl( | 53 arc_bridge_service_.reset(new ArcBridgeServiceImpl( |
| 53 ArcBridgeBootstrap::Create())); | 54 ArcBridgeBootstrap::Create())); |
| 54 } | 55 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 if (on_ash_started_called_) | 112 if (on_ash_started_called_) |
| 112 return; | 113 return; |
| 113 | 114 |
| 114 on_ash_started_called_ = true; | 115 on_ash_started_called_ = true; |
| 115 AddService( | 116 AddService( |
| 116 base::WrapUnique(new ArcWindowManagerBridge(arc_bridge_service()))); | 117 base::WrapUnique(new ArcWindowManagerBridge(arc_bridge_service()))); |
| 117 } | 118 } |
| 118 | 119 |
| 119 void ArcServiceManager::Shutdown() { | 120 void ArcServiceManager::Shutdown() { |
| 120 icon_loader_ = nullptr; | 121 icon_loader_ = nullptr; |
| 122 activity_resolver_ = nullptr; |
| 121 services_.clear(); | 123 services_.clear(); |
| 122 } | 124 } |
| 123 | 125 |
| 124 //static | 126 //static |
| 125 void ArcServiceManager::SetArcBridgeServiceForTesting( | 127 void ArcServiceManager::SetArcBridgeServiceForTesting( |
| 126 std::unique_ptr<ArcBridgeService> arc_bridge_service) { | 128 std::unique_ptr<ArcBridgeService> arc_bridge_service) { |
| 127 if (g_arc_bridge_service_for_testing) { | 129 if (g_arc_bridge_service_for_testing) { |
| 128 delete g_arc_bridge_service_for_testing; | 130 delete g_arc_bridge_service_for_testing; |
| 129 } | 131 } |
| 130 g_arc_bridge_service_for_testing = arc_bridge_service.release(); | 132 g_arc_bridge_service_for_testing = arc_bridge_service.release(); |
| 131 } | 133 } |
| 132 | 134 |
| 133 } // namespace arc | 135 } // namespace arc |
| OLD | NEW |