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

Side by Side Diff: components/arc/arc_service_manager.cc

Issue 2557513004: Remove explicit singletonness of ArcBridgeService part 3. (Closed)
Patch Set: Address comments. Created 4 years 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 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 <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/sequenced_task_runner.h" 10 #include "base/sequenced_task_runner.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 DCHECK(thread_checker_.CalledOnValidThread()); 44 DCHECK(thread_checker_.CalledOnValidThread());
45 DCHECK(g_arc_service_manager == this); 45 DCHECK(g_arc_service_manager == this);
46 g_arc_service_manager = nullptr; 46 g_arc_service_manager = nullptr;
47 if (g_arc_bridge_service_for_testing) { 47 if (g_arc_bridge_service_for_testing) {
48 delete g_arc_bridge_service_for_testing; 48 delete g_arc_bridge_service_for_testing;
49 } 49 }
50 } 50 }
51 51
52 // static 52 // static
53 ArcServiceManager* ArcServiceManager::Get() { 53 ArcServiceManager* ArcServiceManager::Get() {
54 DCHECK(g_arc_service_manager); 54 if (!g_arc_service_manager)
55 return nullptr;
55 DCHECK(g_arc_service_manager->thread_checker_.CalledOnValidThread()); 56 DCHECK(g_arc_service_manager->thread_checker_.CalledOnValidThread());
56 return g_arc_service_manager; 57 return g_arc_service_manager;
57 } 58 }
58 59
59 // static 60 // static
60 bool ArcServiceManager::IsInitialized() { 61 bool ArcServiceManager::IsInitialized() {
61 if (!g_arc_service_manager) 62 if (!g_arc_service_manager)
62 return false; 63 return false;
63 DCHECK(g_arc_service_manager->thread_checker_.CalledOnValidThread()); 64 DCHECK(g_arc_service_manager->thread_checker_.CalledOnValidThread());
64 return true; 65 return true;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 101
101 // static 102 // static
102 void ArcServiceManager::SetArcBridgeServiceForTesting( 103 void ArcServiceManager::SetArcBridgeServiceForTesting(
103 std::unique_ptr<ArcBridgeService> arc_bridge_service) { 104 std::unique_ptr<ArcBridgeService> arc_bridge_service) {
104 if (g_arc_bridge_service_for_testing) 105 if (g_arc_bridge_service_for_testing)
105 delete g_arc_bridge_service_for_testing; 106 delete g_arc_bridge_service_for_testing;
106 g_arc_bridge_service_for_testing = arc_bridge_service.release(); 107 g_arc_bridge_service_for_testing = arc_bridge_service.release();
107 } 108 }
108 109
109 } // namespace arc 110 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/arc_app_dialog_view_browsertest.cc ('k') | components/arc/intent_helper/arc_intent_helper_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698