Commit 07ef9ade authored by avi's avatar avi Committed by Commit bot

Remove base::ScopedPtrHashMap from media/.

BUG=579229
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2600603002
Cr-Commit-Position: refs/heads/master@{#440820}
parent 2571b29e
......@@ -20,7 +20,7 @@ CdmPromiseAdapter::~CdmPromiseAdapter() {
uint32_t CdmPromiseAdapter::SavePromise(std::unique_ptr<CdmPromise> promise) {
DCHECK(thread_checker_.CalledOnValidThread());
uint32_t promise_id = next_promise_id_++;
promises_.add(promise_id, std::move(promise));
promises_[promise_id] = std::move(promise);
return promise_id;
}
......@@ -71,7 +71,9 @@ std::unique_ptr<CdmPromise> CdmPromiseAdapter::TakePromise(
PromiseMap::iterator it = promises_.find(promise_id);
if (it == promises_.end())
return nullptr;
return promises_.take_and_erase(it);
std::unique_ptr<CdmPromise> result = std::move(it->second);
promises_.erase(it);
return result;
}
// Explicit instantiation of function templates.
......
......@@ -8,8 +8,8 @@
#include <stdint.h>
#include <memory>
#include <unordered_map>
#include "base/containers/scoped_ptr_hash_map.h"
#include "base/macros.h"
#include "base/threading/thread_checker.h"
#include "media/base/cdm_promise.h"
......@@ -44,9 +44,8 @@ class MEDIA_EXPORT CdmPromiseAdapter {
void Clear();
private:
// A map between promise IDs and CdmPromises. It owns the CdmPromises.
typedef base::ScopedPtrHashMap<uint32_t, std::unique_ptr<CdmPromise>>
PromiseMap;
// A map between promise IDs and CdmPromises.
using PromiseMap = std::unordered_map<uint32_t, std::unique_ptr<CdmPromise>>;
// Finds, takes the ownership of and returns the promise for |promise_id|.
// Returns null if no promise can be found.
......
......@@ -173,12 +173,10 @@ WebEncryptedMediaClientImpl::Reporter* WebEncryptedMediaClientImpl::GetReporter(
// Return a per-frame singleton so that UMA reports will be once-per-frame.
std::string uma_name = GetKeySystemNameForUMA(key_system_ascii);
Reporter* reporter = reporters_.get(uma_name);
if (!reporter) {
reporter = new Reporter(uma_name);
reporters_.add(uma_name, base::WrapUnique(reporter));
}
return reporter;
std::unique_ptr<Reporter>& reporter = reporters_[uma_name];
if (!reporter)
reporter = base::MakeUnique<Reporter>(uma_name);
return reporter.get();
}
} // namespace media
......@@ -7,9 +7,9 @@
#include <memory>
#include <string>
#include <unordered_map>
#include "base/callback.h"
#include "base/containers/scoped_ptr_hash_map.h"
#include "base/memory/weak_ptr.h"
#include "media/blink/key_system_config_selector.h"
#include "media/blink/media_blink_export.h"
......@@ -73,7 +73,7 @@ class MEDIA_BLINK_EXPORT WebEncryptedMediaClientImpl
Reporter* GetReporter(const blink::WebString& key_system);
// Reporter singletons.
base::ScopedPtrHashMap<std::string, std::unique_ptr<Reporter>> reporters_;
std::unordered_map<std::string, std::unique_ptr<Reporter>> reporters_;
base::Callback<bool(void)> are_secure_codecs_supported_cb_;
CdmFactory* cdm_factory_;
......
......@@ -561,7 +561,7 @@ bool AesDecryptor::AddDecryptionKey(const std::string& session_id,
std::unique_ptr<SessionIdDecryptionKeyMap> inner_map(
new SessionIdDecryptionKeyMap());
inner_map->Insert(session_id, std::move(decryption_key));
key_map_.add(key_id, std::move(inner_map));
key_map_[key_id] = std::move(inner_map);
return true;
}
......
......@@ -10,9 +10,9 @@
#include <memory>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
#include "base/containers/scoped_ptr_hash_map.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/synchronization/lock.h"
......@@ -113,9 +113,9 @@ class MEDIA_EXPORT AesDecryptor : public ContentDecryptionModule,
class SessionIdDecryptionKeyMap;
// Key ID <-> SessionIdDecryptionKeyMap map.
typedef base::ScopedPtrHashMap<std::string,
std::unique_ptr<SessionIdDecryptionKeyMap>>
KeyIdToSessionKeysMap;
using KeyIdToSessionKeysMap =
std::unordered_map<std::string,
std::unique_ptr<SessionIdDecryptionKeyMap>>;
~AesDecryptor() override;
......
......@@ -29,7 +29,7 @@ void MediaGpuChannelManager::AddChannel(int32_t client_id) {
std::unique_ptr<MediaGpuChannel> media_gpu_channel(
new MediaGpuChannel(gpu_channel));
gpu_channel->SetUnhandledMessageListener(media_gpu_channel.get());
media_gpu_channels_.set(client_id, std::move(media_gpu_channel));
media_gpu_channels_[client_id] = std::move(media_gpu_channel);
}
void MediaGpuChannelManager::RemoveChannel(int32_t client_id) {
......
......@@ -8,8 +8,8 @@
#include <stdint.h>
#include <memory>
#include <unordered_map>
#include "base/containers/scoped_ptr_hash_map.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "ipc/ipc_listener.h"
......@@ -36,7 +36,7 @@ class MediaGpuChannelManager
private:
gpu::GpuChannelManager* const channel_manager_;
base::ScopedPtrHashMap<int32_t, std::unique_ptr<MediaGpuChannel>>
std::unordered_map<int32_t, std::unique_ptr<MediaGpuChannel>>
media_gpu_channels_;
DISALLOW_COPY_AND_ASSIGN(MediaGpuChannelManager);
};
......
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