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