PM: Move the getters/variables on provider base classes to abstract methods.
Also make all DoInit() overrides in subclasses private, not protected
and ensure that all the abstract Provider interface classes has
virtual destructors.
Additionally, remove inlining of virtual methods in derived classes
since it won't matter much in our application. This is because we'll
call these methods only indirectly e.g. through a vtable dispatch via
a method call on the interface class.
BUG=chromium:364763
TEST=Unit tests pass.
Change-Id: I7f6a10d9c0b01c4f5c035125755ef132738e72aa
Reviewed-on: https://chromium-review.googlesource.com/196656
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
diff --git a/policy_manager/system_provider.h b/policy_manager/system_provider.h
index b7f93c0..d319b8c 100644
--- a/policy_manager/system_provider.h
+++ b/policy_manager/system_provider.h
@@ -16,33 +16,20 @@
// reported by crossystem, the kernel boot command line and the partition table.
class SystemProvider : public Provider {
public:
+ virtual ~SystemProvider() {}
+
// Returns true if the boot mode is normal or if it's unable to
// determine the boot mode. Returns false if the boot mode is
// developer.
- Variable<bool>* var_is_normal_boot_mode() const {
- return var_is_normal_boot_mode_.get();
- }
+ virtual Variable<bool>* var_is_normal_boot_mode() = 0;
// Returns whether this is an official Chrome OS build.
- Variable<bool>* var_is_official_build() const {
- return var_is_official_build_.get();
- }
+ virtual Variable<bool>* var_is_official_build() = 0;
protected:
SystemProvider() {}
- void set_var_is_normal_boot_mode(Variable<bool>* var_is_normal_boot_mode) {
- var_is_normal_boot_mode_.reset(var_is_normal_boot_mode);
- }
-
- void set_var_is_official_build(Variable<bool>* var_is_official_build) {
- var_is_official_build_.reset(var_is_official_build);
- }
-
private:
- scoped_ptr<Variable<bool>> var_is_normal_boot_mode_;
- scoped_ptr<Variable<bool>> var_is_official_build_;
-
DISALLOW_COPY_AND_ASSIGN(SystemProvider);
};