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/real_random_provider.h b/policy_manager/real_random_provider.h
index 75c8f6e..7dd8fab 100644
--- a/policy_manager/real_random_provider.h
+++ b/policy_manager/real_random_provider.h
@@ -14,11 +14,14 @@
public:
RealRandomProvider() {}
- protected:
- // Initializes all the variables.
- virtual bool DoInit(void);
+ virtual Variable<uint64_t>* var_seed() override { return var_seed_.get(); }
private:
+ virtual bool DoInit(void) override;
+
+ // The seed() scoped variable.
+ scoped_ptr<Variable<uint64_t>> var_seed_;
+
DISALLOW_COPY_AND_ASSIGN(RealRandomProvider);
};