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

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

Issue 2586183002: Refactor ArcSessionRunner part 2. (Closed)
Patch Set: Rebase Created 3 years, 12 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
« no previous file with comments | « components/arc/arc_bridge_service.cc ('k') | components/arc/arc_session_runner.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/task_runner.h" 11 #include "base/task_runner.h"
12 #include "components/arc/arc_bridge_service.h" 12 #include "components/arc/arc_bridge_service.h"
13 #include "components/arc/arc_session.h"
13 #include "components/arc/arc_session_runner.h" 14 #include "components/arc/arc_session_runner.h"
14 #include "components/arc/intent_helper/arc_intent_helper_observer.h" 15 #include "components/arc/intent_helper/arc_intent_helper_observer.h"
15 16
16 namespace arc { 17 namespace arc {
17 namespace { 18 namespace {
18 19
19 // Weak pointer. This class is owned by arc::ArcServiceLauncher. 20 // Weak pointer. This class is owned by arc::ArcServiceLauncher.
20 ArcServiceManager* g_arc_service_manager = nullptr; 21 ArcServiceManager* g_arc_service_manager = nullptr;
21 22
22 // This pointer is owned by ArcServiceManager. 23 // This pointer is owned by ArcServiceManager.
(...skipping 26 matching lines...) Expand all
49 50
50 ArcServiceManager::ArcServiceManager( 51 ArcServiceManager::ArcServiceManager(
51 scoped_refptr<base::TaskRunner> blocking_task_runner) 52 scoped_refptr<base::TaskRunner> blocking_task_runner)
52 : blocking_task_runner_(blocking_task_runner), 53 : blocking_task_runner_(blocking_task_runner),
53 intent_helper_observer_(base::MakeUnique<IntentHelperObserverImpl>(this)), 54 intent_helper_observer_(base::MakeUnique<IntentHelperObserverImpl>(this)),
54 icon_loader_(new ActivityIconLoader()), 55 icon_loader_(new ActivityIconLoader()),
55 activity_resolver_(new LocalActivityResolver()) { 56 activity_resolver_(new LocalActivityResolver()) {
56 DCHECK(!g_arc_service_manager); 57 DCHECK(!g_arc_service_manager);
57 g_arc_service_manager = this; 58 g_arc_service_manager = this;
58 59
60 arc_bridge_service_ = base::MakeUnique<ArcBridgeService>();
59 if (g_arc_session_runner_for_testing) { 61 if (g_arc_session_runner_for_testing) {
60 arc_bridge_service_.reset(g_arc_session_runner_for_testing); 62 arc_bridge_service_->InitializeArcSessionRunner(
63 base::WrapUnique(g_arc_session_runner_for_testing));
61 g_arc_session_runner_for_testing = nullptr; 64 g_arc_session_runner_for_testing = nullptr;
62 } else { 65 } else {
63 arc_bridge_service_ = 66 arc_bridge_service_->InitializeArcSessionRunner(
64 base::MakeUnique<ArcSessionRunner>(blocking_task_runner); 67 base::MakeUnique<ArcSessionRunner>(base::Bind(&ArcSession::Create,
68 arc_bridge_service_.get(),
69 blocking_task_runner)));
65 } 70 }
66 } 71 }
67 72
68 ArcServiceManager::~ArcServiceManager() { 73 ArcServiceManager::~ArcServiceManager() {
69 DCHECK(thread_checker_.CalledOnValidThread()); 74 DCHECK(thread_checker_.CalledOnValidThread());
70 DCHECK(g_arc_service_manager == this); 75 DCHECK(g_arc_service_manager == this);
71 g_arc_service_manager = nullptr; 76 g_arc_service_manager = nullptr;
72 if (g_arc_session_runner_for_testing) 77 if (g_arc_session_runner_for_testing)
73 delete g_arc_session_runner_for_testing; 78 delete g_arc_session_runner_for_testing;
74 } 79 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 121
117 // static 122 // static
118 void ArcServiceManager::SetArcSessionRunnerForTesting( 123 void ArcServiceManager::SetArcSessionRunnerForTesting(
119 std::unique_ptr<ArcSessionRunner> arc_session_runner) { 124 std::unique_ptr<ArcSessionRunner> arc_session_runner) {
120 if (g_arc_session_runner_for_testing) 125 if (g_arc_session_runner_for_testing)
121 delete g_arc_session_runner_for_testing; 126 delete g_arc_session_runner_for_testing;
122 g_arc_session_runner_for_testing = arc_session_runner.release(); 127 g_arc_session_runner_for_testing = arc_session_runner.release();
123 } 128 }
124 129
125 } // namespace arc 130 } // namespace arc
OLDNEW
« no previous file with comments | « components/arc/arc_bridge_service.cc ('k') | components/arc/arc_session_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698