Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Unified Diff: components/policy/core/common/cloud/component_cloud_policy_service.cc

Issue 2600783002: Remove base::ScopedPtrHashMap from components/policy/. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/policy/core/common/policy_namespace.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/policy/core/common/cloud/component_cloud_policy_service.cc
diff --git a/components/policy/core/common/cloud/component_cloud_policy_service.cc b/components/policy/core/common/cloud/component_cloud_policy_service.cc
index efad6410e0142a9dffb7c90ef77b6bc18dfa4f40..b99c0eeb003252c70fe4813c4c882ef0b10ec960 100644
--- a/components/policy/core/common/cloud/component_cloud_policy_service.cc
+++ b/components/policy/core/common/cloud/component_cloud_policy_service.cc
@@ -6,11 +6,11 @@
#include <stddef.h>
+#include <unordered_map>
#include <utility>
#include "base/bind.h"
#include "base/bind_helpers.h"
-#include "base/containers/scoped_ptr_hash_map.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/macros.h"
@@ -31,9 +31,10 @@
namespace em = enterprise_management;
-typedef base::ScopedPtrHashMap<policy::PolicyNamespace,
- std::unique_ptr<em::PolicyFetchResponse>>
- ScopedResponseMap;
+using ScopedResponseMap =
+ std::unordered_map<policy::PolicyNamespace,
+ std::unique_ptr<em::PolicyFetchResponse>,
+ policy::PolicyNamespaceHash>;
namespace policy {
@@ -42,7 +43,7 @@ namespace {
bool NotInResponseMap(const ScopedResponseMap& map,
PolicyDomain domain,
const std::string& component_id) {
- return !map.contains(PolicyNamespace(domain, component_id));
+ return map.find(PolicyNamespace(domain, component_id)) == map.end();
}
bool NotInSchemaMap(const scoped_refptr<SchemaMap> schema_map,
@@ -260,7 +261,7 @@ void ComponentCloudPolicyService::Backend::UpdateWithMostRecentPolicies() {
base::Bind(&NotInResponseMap, base::ConstRef(*most_recent_policies_),
POLICY_DOMAIN_SIGNIN_EXTENSIONS));
- for (ScopedResponseMap::iterator it = most_recent_policies_->begin();
+ for (auto it = most_recent_policies_->begin();
it != most_recent_policies_->end(); ++it) {
updater_->UpdateExternalPolicy(
it->first, base::MakeUnique<em::PolicyFetchResponse>(*it->second));
@@ -470,7 +471,8 @@ void ComponentCloudPolicyService::OnPolicyFetched(CloudPolicyClient* client) {
// Pass a complete list of all the currently managed extensions to the
// backend. The cache will purge the storage for any extensions that are not
// in this list.
- std::unique_ptr<ScopedResponseMap> valid_responses(new ScopedResponseMap());
+ std::unique_ptr<ScopedResponseMap> valid_responses =
+ base::MakeUnique<ScopedResponseMap>();
const CloudPolicyClient::ResponseMap& responses =
core_->client()->responses();
@@ -480,8 +482,8 @@ void ComponentCloudPolicyService::OnPolicyFetched(CloudPolicyClient* client) {
!current_schema_map_->GetSchema(ns)) {
continue;
}
- valid_responses->set(
- ns, base::MakeUnique<em::PolicyFetchResponse>(*it->second));
+ (*valid_responses)[ns] =
+ base::MakeUnique<em::PolicyFetchResponse>(*it->second);
}
backend_task_runner_->PostTask(
« no previous file with comments | « no previous file | components/policy/core/common/policy_namespace.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698