summaryrefslogtreecommitdiff
path: root/system/gd/module.cc
diff options
context:
space:
mode:
Diffstat (limited to 'system/gd/module.cc')
-rw-r--r--system/gd/module.cc25
1 files changed, 11 insertions, 14 deletions
diff --git a/system/gd/module.cc b/system/gd/module.cc
index ed8575babe..1545f596e2 100644
--- a/system/gd/module.cc
+++ b/system/gd/module.cc
@@ -28,17 +28,14 @@ namespace bluetooth {
constexpr std::chrono::milliseconds kModuleStopTimeout = std::chrono::milliseconds(2000);
-ModuleFactory::ModuleFactory(std::function<Module*()> ctor) : ctor_(ctor) {
-}
+ModuleFactory::ModuleFactory(std::function<Module*()> ctor) : ctor_(ctor) {}
Handler* Module::GetHandler() const {
log::assert_that(handler_ != nullptr, "Can't get handler when it's not started");
return handler_;
}
-const ModuleRegistry* Module::GetModuleRegistry() const {
- return registry_;
-}
+const ModuleRegistry* Module::GetModuleRegistry() const { return registry_; }
Module* Module::GetDependency(const ModuleFactory* module) const {
for (auto& dependency : dependencies_.list_) {
@@ -51,7 +48,7 @@ Module* Module::GetDependency(const ModuleFactory* module) const {
}
bluetooth::DumpsysDataFinisher EmptyDumpsysDataFinisher =
- [](bluetooth::DumpsysDataBuilder* /* dumpsys_data_builder */) {};
+ [](bluetooth::DumpsysDataBuilder* /* dumpsys_data_builder */) {};
DumpsysDataFinisher Module::GetDumpsysData(flatbuffers::FlatBufferBuilder* /* builder */) const {
return EmptyDumpsysDataFinisher;
@@ -59,9 +56,8 @@ DumpsysDataFinisher Module::GetDumpsysData(flatbuffers::FlatBufferBuilder* /* bu
Module* ModuleRegistry::Get(const ModuleFactory* module) const {
auto instance = started_modules_.find(module);
- log::assert_that(
- instance != started_modules_.end(),
- "Request for module not started up, maybe not in Start(ModuleList)?");
+ log::assert_that(instance != started_modules_.end(),
+ "Request for module not started up, maybe not in Start(ModuleList)?");
return instance->second;
}
@@ -105,11 +101,12 @@ Module* ModuleRegistry::Start(const ModuleFactory* module, Thread* thread) {
}
void ModuleRegistry::StopAll() {
- // Since modules were brought up in dependency order, it is safe to tear down by going in reverse order.
+ // Since modules were brought up in dependency order, it is safe to tear down by going in reverse
+ // order.
for (auto it = start_order_.rbegin(); it != start_order_.rend(); it++) {
auto instance = started_modules_.find(*it);
- log::assert_that(
- instance != started_modules_.end(), "assert failed: instance != started_modules_.end()");
+ log::assert_that(instance != started_modules_.end(),
+ "assert failed: instance != started_modules_.end()");
last_instance_ = "stopping " + instance->second->ToString();
// Clear the handler before stopping the module to allow it to shut down gracefully.
@@ -121,8 +118,8 @@ void ModuleRegistry::StopAll() {
}
for (auto it = start_order_.rbegin(); it != start_order_.rend(); it++) {
auto instance = started_modules_.find(*it);
- log::assert_that(
- instance != started_modules_.end(), "assert failed: instance != started_modules_.end()");
+ log::assert_that(instance != started_modules_.end(),
+ "assert failed: instance != started_modules_.end()");
delete instance->second->handler_;
delete instance->second;
started_modules_.erase(instance);