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

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

Issue 2655233007: Get rid of RefCounted for ActivityIconLoader. (Closed)
Patch Set: address comments Created 3 years, 10 months 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 "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/task_runner.h" 9 #include "base/task_runner.h"
10 #include "components/arc/arc_bridge_service.h" 10 #include "components/arc/arc_bridge_service.h"
11 #include "components/arc/arc_session.h" 11 #include "components/arc/arc_session.h"
12 #include "components/arc/arc_session_runner.h" 12 #include "components/arc/arc_session_runner.h"
13 #include "components/arc/intent_helper/arc_intent_helper_observer.h" 13 #include "components/arc/intent_helper/arc_intent_helper_observer.h"
14 14
15 namespace arc { 15 namespace arc {
16 namespace { 16 namespace {
17 17
18 // Weak pointer. This class is owned by arc::ArcServiceLauncher. 18 // Weak pointer. This class is owned by arc::ArcServiceLauncher.
19 ArcServiceManager* g_arc_service_manager = nullptr; 19 ArcServiceManager* g_arc_service_manager = nullptr;
20 20
21 } // namespace 21 } // namespace
22 22
23 ArcServiceManager::ArcServiceManager( 23 ArcServiceManager::ArcServiceManager(
24 scoped_refptr<base::TaskRunner> blocking_task_runner) 24 scoped_refptr<base::TaskRunner> blocking_task_runner)
25 : blocking_task_runner_(blocking_task_runner), 25 : blocking_task_runner_(blocking_task_runner),
26 arc_bridge_service_(base::MakeUnique<ArcBridgeService>()), 26 arc_bridge_service_(base::MakeUnique<ArcBridgeService>()),
27 icon_loader_(new ActivityIconLoader()),
28 activity_resolver_(new LocalActivityResolver()) { 27 activity_resolver_(new LocalActivityResolver()) {
29 DCHECK(!g_arc_service_manager); 28 DCHECK(!g_arc_service_manager);
30 g_arc_service_manager = this; 29 g_arc_service_manager = this;
31 } 30 }
32 31
33 ArcServiceManager::~ArcServiceManager() { 32 ArcServiceManager::~ArcServiceManager() {
34 DCHECK(thread_checker_.CalledOnValidThread()); 33 DCHECK(thread_checker_.CalledOnValidThread());
35 DCHECK_EQ(g_arc_service_manager, this); 34 DCHECK_EQ(g_arc_service_manager, this);
36 g_arc_service_manager = nullptr; 35 g_arc_service_manager = nullptr;
37 } 36 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 auto service = services_.find(name); 71 auto service = services_.find(name);
73 if (service == services_.end()) { 72 if (service == services_.end()) {
74 LOG(ERROR) << "Named service " << name << " not found"; 73 LOG(ERROR) << "Named service " << name << " not found";
75 return nullptr; 74 return nullptr;
76 } 75 }
77 return service->second.get(); 76 return service->second.get();
78 } 77 }
79 78
80 void ArcServiceManager::Shutdown() { 79 void ArcServiceManager::Shutdown() {
81 DCHECK(thread_checker_.CalledOnValidThread()); 80 DCHECK(thread_checker_.CalledOnValidThread());
82 icon_loader_ = nullptr;
83 activity_resolver_ = nullptr; 81 activity_resolver_ = nullptr;
84 services_.clear(); 82 services_.clear();
85 } 83 }
86 84
87 } // namespace arc 85 } // namespace arc
OLDNEW
« no previous file with comments | « components/arc/arc_service_manager.h ('k') | components/arc/intent_helper/activity_icon_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698