Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e3691941 authored by Chris Manton's avatar Chris Manton
Browse files

Remove protobuf options from module

Bug: 157647700
Test: atest --host bluetooth_test_gd
Tag: #gd-refactor
Change-Id: Ib7efbccb42175dfc4c46183d0ad9888b2776b7bf
parent efdf4190
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
cc_defaults {
    name: "gd_defaults",
    include_dirs: ["external/protobuf/src"],
    target: {
        android: {
            test_config_template: "AndroidTestTemplate.xml",
@@ -114,18 +113,12 @@ cc_defaults {
            srcs: [
                ":BluetoothOsSources_linux_generic",
            ],
            shared_libs: [
                "libprotobuf-cpp-full",
            ],
        },
        host: {
            srcs: [
                ":BluetoothHalSources_hci_rootcanal",
                ":BluetoothOsSources_host",
            ],
            shared_libs: [
                "libprotobuf-cpp-full",
            ],
        },
        android: {
            srcs: [
@@ -304,7 +297,6 @@ cc_test {
    shared_libs: [
        "libchrome",
        "libcrypto",
        "libprotobuf-cpp-full",
    ],
    sanitize: {
        address: true,
@@ -352,7 +344,6 @@ cc_defaults {
    ],
    shared_libs: [
        "libcrypto",
        "libprotobuf-cpp-full",
    ],
    cflags: [
        "-DFUZZ_TARGET",
+0 −22
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@
 */

#include "module.h"
#include "bluetooth/dumpmod.pb.h"

using ::bluetooth::os::Handler;
using ::bluetooth::os::Thread;
@@ -27,10 +26,6 @@ constexpr std::chrono::milliseconds kModuleStopTimeout = std::chrono::millisecon
ModuleFactory::ModuleFactory(std::function<Module*()> ctor) : ctor_(ctor) {
}

std::unique_ptr<google::protobuf::Message> Module::DumpState() const {
  return nullptr;
}

std::string Module::ToString() const {
  return "Module";
}
@@ -126,21 +121,4 @@ os::Handler* ModuleRegistry::GetModuleHandler(const ModuleFactory* module) const
  return nullptr;
}

void ModuleDumper::DumpState() const {
  Dumpmod dumpmod;

  for (auto it = module_registry_.start_order_.rbegin(); it != module_registry_.start_order_.rend(); it++) {
    auto instance = module_registry_.started_modules_.find(*it);
    ASSERT(instance != module_registry_.started_modules_.end());
    std::unique_ptr<google::protobuf::Message> message = instance->second->DumpState();
    if (message == nullptr) {
      continue;
    }
    ModuleDumpState dump_state;
    dump_state.set_name(instance->second->ToString());
    dump_state.mutable_data()->PackFrom(*message);
    dumpmod.mutable_module_dump_states()->insert({dump_state.name(), dump_state});
  }
}

}  // namespace bluetooth
+1 −6
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

#pragma once

#include <google/protobuf/message.h>
#include <functional>
#include <future>
#include <map>
@@ -86,9 +85,6 @@ class Module {
  // Release all resources, you're about to be deleted
  virtual void Stop() = 0;

  // Get relevant state data from the module
  virtual std::unique_ptr<google::protobuf::Message> DumpState() const;

  virtual std::string ToString() const;

  ::bluetooth::os::Handler* GetHandler() const;
@@ -158,10 +154,9 @@ class ModuleRegistry {
class ModuleDumper {
 public:
  ModuleDumper(ModuleRegistry& module_registry) : module_registry_(module_registry) {}
  void DumpState() const;

 private:
  ModuleRegistry& module_registry_;
  [[maybe_unused]] ModuleRegistry& module_registry_;
};

class TestModuleRegistry : public ModuleRegistry {