Commit 187d0e4e authored by Sungguk Lim's avatar Sungguk Lim Committed by Commit Bot

Remove linked_ptr from component/syncs/base

Use std::unique_ptr instead of deprecated linked_ptr

Bug: 556939
Change-Id: Ifb89741b5815b388961a67aebf6d1f7cf07d7b7d
Reviewed-on: https://chromium-review.googlesource.com/1040325Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Commit-Queue: Sungguk Lim <limasdf@gmail.com>
Cr-Commit-Position: refs/heads/master@{#556019}
parent df445ea6
......@@ -35,9 +35,9 @@ Cryptographer::Cryptographer(const Cryptographer& other)
it != other.nigoris_.end(); ++it) {
std::string user_key, encryption_key, mac_key;
it->second->ExportKeys(&user_key, &encryption_key, &mac_key);
linked_ptr<Nigori> nigori_copy(new Nigori());
auto nigori_copy = std::make_unique<Nigori>();
nigori_copy->InitByImport(user_key, encryption_key, mac_key);
nigoris_.insert(std::make_pair(it->first, nigori_copy));
nigoris_.emplace(it->first, std::move(nigori_copy));
}
if (other.pending_keys_) {
......@@ -144,11 +144,10 @@ bool Cryptographer::GetKeys(sync_pb::EncryptedData* encrypted) const {
// Create a bag of all the Nigori parameters we know about.
sync_pb::NigoriKeyBag bag;
for (NigoriMap::const_iterator it = nigoris_.begin(); it != nigoris_.end();
++it) {
const Nigori& nigori = *it->second;
for (const auto& key_name_and_nigori : nigoris_) {
const Nigori& nigori = *key_name_and_nigori.second;
sync_pb::NigoriKey* key = bag.add_key();
key->set_name(it->first);
key->set_name(key_name_and_nigori.first);
nigori.ExportKeys(key->mutable_user_key(), key->mutable_encryption_key(),
key->mutable_mac_key());
}
......@@ -196,7 +195,7 @@ bool Cryptographer::AddKeyImpl(std::unique_ptr<Nigori> initialized_nigori,
return false;
}
nigoris_[name] = make_linked_ptr(initialized_nigori.release());
nigoris_[name] = std::move(initialized_nigori);
// Check if the key we just added can decrypt the pending keys and add them
// too if so.
......@@ -310,7 +309,7 @@ void Cryptographer::InstallKeyBag(const sync_pb::NigoriKeyBag& bag) {
NOTREACHED();
continue;
}
nigoris_[key.name()] = make_linked_ptr(new_nigori.release());
nigoris_[key.name()] = std::move(new_nigori);
}
}
}
......
......@@ -10,7 +10,6 @@
#include <string>
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
#include "components/sync/base/nigori.h"
#include "components/sync/protocol/encryption.pb.h"
......@@ -185,7 +184,7 @@ class Cryptographer {
bool ImportNigoriKey(const std::string& serialized_nigori_key);
private:
using NigoriMap = std::map<std::string, linked_ptr<const Nigori>>;
using NigoriMap = std::map<std::string, std::unique_ptr<const Nigori>>;
// Helper method to instantiate Nigori instances for each set of key
// parameters in |bag|.
......
......@@ -8,6 +8,7 @@
#include <memory>
#include "base/logging.h"
#include "base/macros.h"
#include "components/sync/base/cryptographer.h"
#include "components/sync/protocol/password_specifics.pb.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment