blob: 7927b550681710cd9060543d52790ad83fc670da (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/arc/arc_service_manager.h"
#include "base/sequenced_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "components/arc/arc_bridge_bootstrap.h"
#include "components/arc/arc_bridge_service_impl.h"
namespace arc {
namespace {
// Weak pointer. This class is owned by ChromeBrowserMainPartsChromeos.
ArcServiceManager* g_arc_service_manager = nullptr;
} // namespace
ArcServiceManager::ArcServiceManager()
: arc_bridge_service_(
new ArcBridgeServiceImpl(ArcBridgeBootstrap::Create())) {
DCHECK(!g_arc_service_manager);
g_arc_service_manager = this;
}
ArcServiceManager::~ArcServiceManager() {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(g_arc_service_manager == this);
g_arc_service_manager = nullptr;
}
// static
ArcServiceManager* ArcServiceManager::Get() {
DCHECK(g_arc_service_manager);
DCHECK(g_arc_service_manager->thread_checker_.CalledOnValidThread());
return g_arc_service_manager;
}
ArcBridgeService* ArcServiceManager::arc_bridge_service() {
DCHECK(thread_checker_.CalledOnValidThread());
return arc_bridge_service_.get();
}
} // namespace arc
|