Commit cc88db2f authored by avi's avatar avi Committed by Commit bot

Remove stl_util's deletion functions from storage/.

BUG=555865

Review-Url: https://codereview.chromium.org/2389583002
Cr-Commit-Position: refs/heads/master@{#423007}
parent c75c0849
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/callback_helpers.h" #include "base/callback_helpers.h"
#include "base/sequenced_task_runner.h" #include "base/sequenced_task_runner.h"
#include "base/stl_util.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "net/base/io_buffer.h" #include "net/base/io_buffer.h"
...@@ -76,7 +75,6 @@ BlobReader::BlobReader( ...@@ -76,7 +75,6 @@ BlobReader::BlobReader(
} }
BlobReader::~BlobReader() { BlobReader::~BlobReader() {
base::STLDeleteValues(&index_to_reader_);
} }
BlobReader::Status BlobReader::CalculateSize( BlobReader::Status BlobReader::CalculateSize(
...@@ -620,13 +618,13 @@ FileStreamReader* BlobReader::GetOrCreateFileReaderAtIndex(size_t index) { ...@@ -620,13 +618,13 @@ FileStreamReader* BlobReader::GetOrCreateFileReaderAtIndex(size_t index) {
auto it = index_to_reader_.find(index); auto it = index_to_reader_.find(index);
if (it != index_to_reader_.end()) { if (it != index_to_reader_.end()) {
DCHECK(it->second); DCHECK(it->second);
return it->second; return it->second.get();
} }
std::unique_ptr<FileStreamReader> reader = CreateFileStreamReader(item, 0); std::unique_ptr<FileStreamReader> reader = CreateFileStreamReader(item, 0);
FileStreamReader* ret_value = reader.get(); FileStreamReader* ret_value = reader.get();
if (!ret_value) if (!ret_value)
return nullptr; return nullptr;
index_to_reader_[index] = reader.release(); index_to_reader_[index] = std::move(reader);
return ret_value; return ret_value;
} }
...@@ -662,19 +660,10 @@ std::unique_ptr<FileStreamReader> BlobReader::CreateFileStreamReader( ...@@ -662,19 +660,10 @@ std::unique_ptr<FileStreamReader> BlobReader::CreateFileStreamReader(
void BlobReader::SetFileReaderAtIndex( void BlobReader::SetFileReaderAtIndex(
size_t index, size_t index,
std::unique_ptr<FileStreamReader> reader) { std::unique_ptr<FileStreamReader> reader) {
auto found = index_to_reader_.find(current_item_index_); if (reader)
if (found != index_to_reader_.end()) { index_to_reader_[index] = std::move(reader);
if (found->second) { else
delete found->second; index_to_reader_.erase(index);
}
if (!reader.get()) {
index_to_reader_.erase(found);
return;
}
found->second = reader.release();
} else if (reader.get()) {
index_to_reader_[current_item_index_] = reader.release();
}
} }
} // namespace storage } // namespace storage
...@@ -214,7 +214,7 @@ class STORAGE_EXPORT BlobReader { ...@@ -214,7 +214,7 @@ class STORAGE_EXPORT BlobReader {
uint64_t total_size_ = 0; uint64_t total_size_ = 0;
uint64_t remaining_bytes_ = 0; uint64_t remaining_bytes_ = 0;
size_t pending_get_file_info_count_ = 0; size_t pending_get_file_info_count_ = 0;
std::map<size_t, FileStreamReader*> index_to_reader_; std::map<size_t, std::unique_ptr<FileStreamReader>> index_to_reader_;
size_t current_item_index_ = 0; size_t current_item_index_ = 0;
uint64_t current_item_offset_ = 0; uint64_t current_item_offset_ = 0;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "net/base/io_buffer.h" #include "net/base/io_buffer.h"
#include "net/base/net_errors.h" #include "net/base/net_errors.h"
#include "storage/browser/blob/shareable_file_reference.h" #include "storage/browser/blob/shareable_file_reference.h"
...@@ -754,7 +755,6 @@ CopyOrMoveOperationDelegate::CopyOrMoveOperationDelegate( ...@@ -754,7 +755,6 @@ CopyOrMoveOperationDelegate::CopyOrMoveOperationDelegate(
} }
CopyOrMoveOperationDelegate::~CopyOrMoveOperationDelegate() { CopyOrMoveOperationDelegate::~CopyOrMoveOperationDelegate() {
base::STLDeleteElements(&running_copy_set_);
} }
void CopyOrMoveOperationDelegate::Run() { void CopyOrMoveOperationDelegate::Run() {
...@@ -795,13 +795,13 @@ void CopyOrMoveOperationDelegate::ProcessFile( ...@@ -795,13 +795,13 @@ void CopyOrMoveOperationDelegate::ProcessFile(
} }
FileSystemURL dest_url = CreateDestURL(src_url); FileSystemURL dest_url = CreateDestURL(src_url);
CopyOrMoveImpl* impl = NULL; std::unique_ptr<CopyOrMoveImpl> impl;
if (same_file_system_ && if (same_file_system_ &&
(file_system_context() (file_system_context()
->GetFileSystemBackend(src_url.type()) ->GetFileSystemBackend(src_url.type())
->HasInplaceCopyImplementation(src_url.type()) || ->HasInplaceCopyImplementation(src_url.type()) ||
operation_type_ == OPERATION_MOVE)) { operation_type_ == OPERATION_MOVE)) {
impl = new CopyOrMoveOnSameFileSystemImpl( impl = base::MakeUnique<CopyOrMoveOnSameFileSystemImpl>(
operation_runner(), operation_type_, src_url, dest_url, option_, operation_runner(), operation_type_, src_url, dest_url, option_,
base::Bind(&CopyOrMoveOperationDelegate::OnCopyFileProgress, base::Bind(&CopyOrMoveOperationDelegate::OnCopyFileProgress,
weak_factory_.GetWeakPtr(), src_url)); weak_factory_.GetWeakPtr(), src_url));
...@@ -827,7 +827,7 @@ void CopyOrMoveOperationDelegate::ProcessFile( ...@@ -827,7 +827,7 @@ void CopyOrMoveOperationDelegate::ProcessFile(
std::unique_ptr<FileStreamWriter> writer = std::unique_ptr<FileStreamWriter> writer =
file_system_context()->CreateFileStreamWriter(dest_url, 0); file_system_context()->CreateFileStreamWriter(dest_url, 0);
if (reader && writer) { if (reader && writer) {
impl = new StreamCopyOrMoveImpl( impl = base::MakeUnique<StreamCopyOrMoveImpl>(
operation_runner(), file_system_context(), operation_type_, src_url, operation_runner(), file_system_context(), operation_type_, src_url,
dest_url, option_, std::move(reader), std::move(writer), dest_url, option_, std::move(reader), std::move(writer),
base::Bind(&CopyOrMoveOperationDelegate::OnCopyFileProgress, base::Bind(&CopyOrMoveOperationDelegate::OnCopyFileProgress,
...@@ -836,7 +836,7 @@ void CopyOrMoveOperationDelegate::ProcessFile( ...@@ -836,7 +836,7 @@ void CopyOrMoveOperationDelegate::ProcessFile(
} }
if (!impl) { if (!impl) {
impl = new SnapshotCopyOrMoveImpl( impl = base::MakeUnique<SnapshotCopyOrMoveImpl>(
operation_runner(), operation_type_, src_url, dest_url, option_, operation_runner(), operation_type_, src_url, dest_url, option_,
validator_factory, validator_factory,
base::Bind(&CopyOrMoveOperationDelegate::OnCopyFileProgress, base::Bind(&CopyOrMoveOperationDelegate::OnCopyFileProgress,
...@@ -845,10 +845,12 @@ void CopyOrMoveOperationDelegate::ProcessFile( ...@@ -845,10 +845,12 @@ void CopyOrMoveOperationDelegate::ProcessFile(
} }
// Register the running task. // Register the running task.
running_copy_set_.insert(impl);
impl->Run(base::Bind( CopyOrMoveImpl* impl_ptr = impl.get();
&CopyOrMoveOperationDelegate::DidCopyOrMoveFile, running_copy_set_[impl_ptr] = std::move(impl);
weak_factory_.GetWeakPtr(), src_url, dest_url, callback, impl)); impl_ptr->Run(base::Bind(&CopyOrMoveOperationDelegate::DidCopyOrMoveFile,
weak_factory_.GetWeakPtr(), src_url, dest_url,
callback, impl_ptr));
} }
void CopyOrMoveOperationDelegate::ProcessDirectory( void CopyOrMoveOperationDelegate::ProcessDirectory(
...@@ -893,9 +895,8 @@ void CopyOrMoveOperationDelegate::PostProcessDirectory( ...@@ -893,9 +895,8 @@ void CopyOrMoveOperationDelegate::PostProcessDirectory(
void CopyOrMoveOperationDelegate::OnCancel() { void CopyOrMoveOperationDelegate::OnCancel() {
// Request to cancel all running Copy/Move file. // Request to cancel all running Copy/Move file.
for (std::set<CopyOrMoveImpl*>::iterator iter = running_copy_set_.begin(); for (auto& job : running_copy_set_)
iter != running_copy_set_.end(); ++iter) job.first->Cancel();
(*iter)->Cancel();
} }
void CopyOrMoveOperationDelegate::DidCopyOrMoveFile( void CopyOrMoveOperationDelegate::DidCopyOrMoveFile(
...@@ -905,7 +906,6 @@ void CopyOrMoveOperationDelegate::DidCopyOrMoveFile( ...@@ -905,7 +906,6 @@ void CopyOrMoveOperationDelegate::DidCopyOrMoveFile(
CopyOrMoveImpl* impl, CopyOrMoveImpl* impl,
base::File::Error error) { base::File::Error error) {
running_copy_set_.erase(impl); running_copy_set_.erase(impl);
delete impl;
if (!progress_callback_.is_null() && error != base::File::FILE_OK && if (!progress_callback_.is_null() && error != base::File::FILE_OK &&
error != base::File::FILE_ERROR_NOT_A_FILE) error != base::File::FILE_ERROR_NOT_A_FILE)
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
#include <stdint.h> #include <stdint.h>
#include <map>
#include <memory> #include <memory>
#include <set>
#include <stack> #include <stack>
#include "base/macros.h" #include "base/macros.h"
...@@ -156,7 +156,7 @@ class CopyOrMoveOperationDelegate ...@@ -156,7 +156,7 @@ class CopyOrMoveOperationDelegate
CopyProgressCallback progress_callback_; CopyProgressCallback progress_callback_;
StatusCallback callback_; StatusCallback callback_;
std::set<CopyOrMoveImpl*> running_copy_set_; std::map<CopyOrMoveImpl*, std::unique_ptr<CopyOrMoveImpl>> running_copy_set_;
base::WeakPtrFactory<CopyOrMoveOperationDelegate> weak_factory_; base::WeakPtrFactory<CopyOrMoveOperationDelegate> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(CopyOrMoveOperationDelegate); DISALLOW_COPY_AND_ASSIGN(CopyOrMoveOperationDelegate);
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "base/memory/ptr_util.h"
#include "base/pickle.h" #include "base/pickle.h"
#include "base/stl_util.h" #include "base/stl_util.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
...@@ -161,7 +162,7 @@ bool FileSystemUsageCache::Delete(const base::FilePath& usage_file_path) { ...@@ -161,7 +162,7 @@ bool FileSystemUsageCache::Delete(const base::FilePath& usage_file_path) {
void FileSystemUsageCache::CloseCacheFiles() { void FileSystemUsageCache::CloseCacheFiles() {
TRACE_EVENT0("FileSystem", "UsageCache::CloseCacheFiles"); TRACE_EVENT0("FileSystem", "UsageCache::CloseCacheFiles");
DCHECK(CalledOnValidThread()); DCHECK(CalledOnValidThread());
base::STLDeleteValues(&cache_files_); cache_files_.clear();
timer_.reset(); timer_.reset();
} }
...@@ -228,24 +229,22 @@ base::File* FileSystemUsageCache::GetFile(const base::FilePath& file_path) { ...@@ -228,24 +229,22 @@ base::File* FileSystemUsageCache::GetFile(const base::FilePath& file_path) {
CloseCacheFiles(); CloseCacheFiles();
ScheduleCloseTimer(); ScheduleCloseTimer();
base::File* new_file = NULL; auto& entry = cache_files_[file_path];
std::pair<CacheFiles::iterator, bool> inserted = if (entry)
cache_files_.insert(std::make_pair(file_path, new_file)); return entry.get();
if (!inserted.second)
return inserted.first->second; // Because there are no null entries in cache_files_, the [] inserted a blank
// pointer, so let's populate the cache.
new_file = new base::File(file_path, entry = base::MakeUnique<base::File>(file_path, base::File::FLAG_OPEN_ALWAYS |
base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_READ |
base::File::FLAG_READ | base::File::FLAG_WRITE);
base::File::FLAG_WRITE);
if (!new_file->IsValid()) { if (!entry->IsValid()) {
cache_files_.erase(inserted.first); cache_files_.erase(file_path);
delete new_file; return nullptr;
return NULL;
} }
inserted.first->second = new_file; return entry.get();
return new_file;
} }
bool FileSystemUsageCache::ReadBytes(const base::FilePath& file_path, bool FileSystemUsageCache::ReadBytes(const base::FilePath& file_path,
......
...@@ -63,8 +63,6 @@ class STORAGE_EXPORT FileSystemUsageCache { ...@@ -63,8 +63,6 @@ class STORAGE_EXPORT FileSystemUsageCache {
static const int kUsageFileHeaderSize; static const int kUsageFileHeaderSize;
private: private:
typedef std::map<base::FilePath, base::File*> CacheFiles;
// Read the size, validity and the "dirty" entry described in the .usage file. // Read the size, validity and the "dirty" entry described in the .usage file.
// Returns less than zero if no .usage file is available. // Returns less than zero if no .usage file is available.
bool Read(const base::FilePath& usage_file_path, bool Read(const base::FilePath& usage_file_path,
...@@ -93,7 +91,7 @@ class STORAGE_EXPORT FileSystemUsageCache { ...@@ -93,7 +91,7 @@ class STORAGE_EXPORT FileSystemUsageCache {
bool CalledOnValidThread(); bool CalledOnValidThread();
std::unique_ptr<TimedTaskHelper> timer_; std::unique_ptr<TimedTaskHelper> timer_;
CacheFiles cache_files_; std::map<base::FilePath, std::unique_ptr<base::File>> cache_files_;
scoped_refptr<base::SequencedTaskRunner> task_runner_; scoped_refptr<base::SequencedTaskRunner> task_runner_;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <algorithm> #include <algorithm>
#include "base/stl_util.h" #include "base/memory/ptr_util.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "net/base/url_util.h" #include "net/base/url_util.h"
#include "storage/browser/quota/quota_manager.h" #include "storage/browser/quota/quota_manager.h"
...@@ -247,7 +247,6 @@ StorageTypeObservers::StorageTypeObservers(QuotaManager* quota_manager) ...@@ -247,7 +247,6 @@ StorageTypeObservers::StorageTypeObservers(QuotaManager* quota_manager)
} }
StorageTypeObservers::~StorageTypeObservers() { StorageTypeObservers::~StorageTypeObservers() {
base::STLDeleteValues(&host_observers_map_);
} }
void StorageTypeObservers::AddObserver( void StorageTypeObservers::AddObserver(
...@@ -256,25 +255,22 @@ void StorageTypeObservers::AddObserver( ...@@ -256,25 +255,22 @@ void StorageTypeObservers::AddObserver(
if (host.empty()) if (host.empty())
return; return;
HostStorageObservers* host_observers = NULL; auto& host_observers = host_observers_map_[host];
HostObserversMap::iterator it = host_observers_map_.find(host); if (!host_observers) {
if (it == host_observers_map_.end()) { // Because there are no null entries in host_observers_map_, the [] inserted
host_observers = new HostStorageObservers(quota_manager_); // a blank pointer, so let's populate it.
host_observers_map_[host] = host_observers; host_observers = base::MakeUnique<HostStorageObservers>(quota_manager_);
} else {
host_observers = it->second;
} }
host_observers->AddObserver(observer, params); host_observers->AddObserver(observer, params);
} }
void StorageTypeObservers::RemoveObserver(StorageObserver* observer) { void StorageTypeObservers::RemoveObserver(StorageObserver* observer) {
for (HostObserversMap::iterator it = host_observers_map_.begin(); for (auto it = host_observers_map_.begin();
it != host_observers_map_.end(); ) { it != host_observers_map_.end();) {
it->second->RemoveObserver(observer); it->second->RemoveObserver(observer);
if (!it->second->ContainsObservers()) { if (!it->second->ContainsObservers()) {
delete it->second; it = host_observers_map_.erase(it);
host_observers_map_.erase(it++);
} else { } else {
++it; ++it;
} }
...@@ -284,31 +280,29 @@ void StorageTypeObservers::RemoveObserver(StorageObserver* observer) { ...@@ -284,31 +280,29 @@ void StorageTypeObservers::RemoveObserver(StorageObserver* observer) {
void StorageTypeObservers::RemoveObserverForFilter( void StorageTypeObservers::RemoveObserverForFilter(
StorageObserver* observer, const StorageObserver::Filter& filter) { StorageObserver* observer, const StorageObserver::Filter& filter) {
std::string host = net::GetHostOrSpecFromURL(filter.origin); std::string host = net::GetHostOrSpecFromURL(filter.origin);
HostObserversMap::iterator it = host_observers_map_.find(host); auto it = host_observers_map_.find(host);
if (it == host_observers_map_.end()) if (it == host_observers_map_.end())
return; return;
it->second->RemoveObserver(observer); it->second->RemoveObserver(observer);
if (!it->second->ContainsObservers()) { if (!it->second->ContainsObservers())
delete it->second;
host_observers_map_.erase(it); host_observers_map_.erase(it);
}
} }
const HostStorageObservers* StorageTypeObservers::GetHostObservers( const HostStorageObservers* StorageTypeObservers::GetHostObservers(
const std::string& host) const { const std::string& host) const {
HostObserversMap::const_iterator it = host_observers_map_.find(host); auto it = host_observers_map_.find(host);
if (it != host_observers_map_.end()) if (it != host_observers_map_.end())
return it->second; return it->second.get();
return NULL; return nullptr;
} }
void StorageTypeObservers::NotifyUsageChange( void StorageTypeObservers::NotifyUsageChange(
const StorageObserver::Filter& filter, const StorageObserver::Filter& filter,
int64_t delta) { int64_t delta) {
std::string host = net::GetHostOrSpecFromURL(filter.origin); std::string host = net::GetHostOrSpecFromURL(filter.origin);
HostObserversMap::iterator it = host_observers_map_.find(host); auto it = host_observers_map_.find(host);
if (it == host_observers_map_.end()) if (it == host_observers_map_.end())
return; return;
...@@ -323,7 +317,6 @@ StorageMonitor::StorageMonitor(QuotaManager* quota_manager) ...@@ -323,7 +317,6 @@ StorageMonitor::StorageMonitor(QuotaManager* quota_manager)
} }
StorageMonitor::~StorageMonitor() { StorageMonitor::~StorageMonitor() {
base::STLDeleteValues(&storage_type_observers_map_);
} }
void StorageMonitor::AddObserver( void StorageMonitor::AddObserver(
...@@ -338,22 +331,16 @@ void StorageMonitor::AddObserver( ...@@ -338,22 +331,16 @@ void StorageMonitor::AddObserver(
return; return;
} }
StorageTypeObservers* type_observers = NULL; auto& type_observers =
StorageTypeObserversMap::iterator it = storage_type_observers_map_[params.filter.storage_type];
storage_type_observers_map_.find(params.filter.storage_type); if (!type_observers)
if (it == storage_type_observers_map_.end()) { type_observers = base::MakeUnique<StorageTypeObservers>(quota_manager_);
type_observers = new StorageTypeObservers(quota_manager_);
storage_type_observers_map_[params.filter.storage_type] = type_observers;
} else {
type_observers = it->second;
}
type_observers->AddObserver(observer, params); type_observers->AddObserver(observer, params);
} }
void StorageMonitor::RemoveObserver(StorageObserver* observer) { void StorageMonitor::RemoveObserver(StorageObserver* observer) {
for (StorageTypeObserversMap::iterator it = for (auto it = storage_type_observers_map_.begin();
storage_type_observers_map_.begin();
it != storage_type_observers_map_.end(); ++it) { it != storage_type_observers_map_.end(); ++it) {
it->second->RemoveObserver(observer); it->second->RemoveObserver(observer);
} }
...@@ -361,8 +348,7 @@ void StorageMonitor::RemoveObserver(StorageObserver* observer) { ...@@ -361,8 +348,7 @@ void StorageMonitor::RemoveObserver(StorageObserver* observer) {
void StorageMonitor::RemoveObserverForFilter( void StorageMonitor::RemoveObserverForFilter(
StorageObserver* observer, const StorageObserver::Filter& filter) { StorageObserver* observer, const StorageObserver::Filter& filter) {
StorageTypeObserversMap::iterator it = auto it = storage_type_observers_map_.find(filter.storage_type);
storage_type_observers_map_.find(filter.storage_type);
if (it == storage_type_observers_map_.end()) if (it == storage_type_observers_map_.end())
return; return;
...@@ -371,12 +357,11 @@ void StorageMonitor::RemoveObserverForFilter( ...@@ -371,12 +357,11 @@ void StorageMonitor::RemoveObserverForFilter(
const StorageTypeObservers* StorageMonitor::GetStorageTypeObservers( const StorageTypeObservers* StorageMonitor::GetStorageTypeObservers(
StorageType storage_type) const { StorageType storage_type) const {
StorageTypeObserversMap::const_iterator it = auto it = storage_type_observers_map_.find(storage_type);
storage_type_observers_map_.find(storage_type);
if (it != storage_type_observers_map_.end()) if (it != storage_type_observers_map_.end())
return it->second; return it->second.get();
return NULL; return nullptr;
} }
void StorageMonitor::NotifyUsageChange(const StorageObserver::Filter& filter, void StorageMonitor::NotifyUsageChange(const StorageObserver::Filter& filter,
...@@ -389,8 +374,7 @@ void StorageMonitor::NotifyUsageChange(const StorageObserver::Filter& filter, ...@@ -389,8 +374,7 @@ void StorageMonitor::NotifyUsageChange(const StorageObserver::Filter& filter,
return; return;
} }
StorageTypeObserversMap::iterator it = auto it = storage_type_observers_map_.find(filter.storage_type);
storage_type_observers_map_.find(filter.storage_type);
if (it == storage_type_observers_map_.end()) if (it == storage_type_observers_map_.end())
return; return;
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <stdint.h> #include <stdint.h>
#include <map> #include <map>
#include <memory>
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
...@@ -140,10 +141,9 @@ class STORAGE_EXPORT StorageTypeObservers { ...@@ -140,10 +141,9 @@ class STORAGE_EXPORT StorageTypeObservers {
void NotifyUsageChange(const StorageObserver::Filter& filter, int64_t delta); void NotifyUsageChange(const StorageObserver::Filter& filter, int64_t delta);
private: private:
typedef std::map<std::string, HostStorageObservers*> HostObserversMap;
QuotaManager* quota_manager_; QuotaManager* quota_manager_;
HostObserversMap host_observers_map_; std::map<std::string, std::unique_ptr<HostStorageObservers>>
host_observers_map_;
DISALLOW_COPY_AND_ASSIGN(StorageTypeObservers); DISALLOW_COPY_AND_ASSIGN(StorageTypeObservers);
}; };
...@@ -170,10 +170,9 @@ class STORAGE_EXPORT StorageMonitor { ...@@ -170,10 +170,9 @@ class STORAGE_EXPORT StorageMonitor {
void NotifyUsageChange(const StorageObserver::Filter& filter, int64_t delta); void NotifyUsageChange(const StorageObserver::Filter& filter, int64_t delta);
private: private:
typedef std::map<StorageType, StorageTypeObservers*> StorageTypeObserversMap;
QuotaManager* quota_manager_; QuotaManager* quota_manager_;
StorageTypeObserversMap storage_type_observers_map_; std::map<StorageType, std::unique_ptr<StorageTypeObservers>>
storage_type_observers_map_;
DISALLOW_COPY_AND_ASSIGN(StorageMonitor); DISALLOW_COPY_AND_ASSIGN(StorageMonitor);
}; };
......
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