Chromium Code Reviews| Index: components/policy/core/common/policy_map.h |
| diff --git a/components/policy/core/common/policy_map.h b/components/policy/core/common/policy_map.h |
| index 9960531f64e1dea99dbb3baaaf922c44de7632e1..5b527adb867f7dace8ff37e9a3e30a7371bbd88f 100644 |
| --- a/components/policy/core/common/policy_map.h |
| +++ b/components/policy/core/common/policy_map.h |
| @@ -28,19 +28,20 @@ class POLICY_EXPORT PolicyMap { |
| struct POLICY_EXPORT Entry { |
| PolicyLevel level; |
| PolicyScope scope; |
| - base::Value* value; |
| - ExternalDataFetcher* external_data_fetcher; |
| + std::unique_ptr<base::Value> value; |
| + std::unique_ptr<ExternalDataFetcher> external_data_fetcher; |
|
dcheng
2016/05/03 06:46:18
These pointers logically own the values, so they o
|
| // For debugging and displaying only. Set by provider delivering the policy. |
| PolicySource source; |
| Entry(); |
| + ~Entry(); |
| - // Deletes all members owned by |this|. |
| - void DeleteOwnedMembers(); |
| + Entry(Entry&&); |
| + Entry& operator=(Entry&&); |
| // Returns a copy of |this|. |
| - std::unique_ptr<Entry> DeepCopy() const; |
| + Entry DeepCopy() const; |
|
dcheng
2016/05/03 06:46:18
Since Entry is now movable, we may as well take ad
|
| // Returns true if |this| has higher priority than |other|. |
| bool has_higher_priority_than(const Entry& other) const; |
| @@ -64,14 +65,14 @@ class POLICY_EXPORT PolicyMap { |
| // This is equivalent to Get(policy)->value, when it doesn't return NULL. |
| const base::Value* GetValue(const std::string& policy) const; |
| - // Takes ownership of |value| and |external_data_fetcher|. Overwrites any |
| - // existing information stored in the map for the key |policy|. |
| + // Overwrites any existing information stored in the map for the key |policy|. |
| void Set(const std::string& policy, |
| PolicyLevel level, |
| PolicyScope scope, |
| PolicySource source, |
| - base::Value* value, |
| - ExternalDataFetcher* external_data_fetcher); |
| + std::unique_ptr<base::Value> value, |
| + std::unique_ptr<ExternalDataFetcher> external_data_fetcher); |
| + void Set(const std::string& policy, Entry entry); |
| // Erase the given |policy|, if it exists in this map. |
| void Erase(const std::string& policy); |