Index: chrome/browser/media_galleries/media_file_system_registry_unittest.cc |
diff --git a/chrome/browser/media_galleries/media_file_system_registry_unittest.cc b/chrome/browser/media_galleries/media_file_system_registry_unittest.cc |
index 5dcda752b926031e128a64940c49bd57a0ba7298..92cf3459b8ec1a87e06a9606dd35807a94ce8fd3 100644 |
--- a/chrome/browser/media_galleries/media_file_system_registry_unittest.cc |
+++ b/chrome/browser/media_galleries/media_file_system_registry_unittest.cc |
@@ -17,11 +17,11 @@ |
#include "base/files/file_util.h" |
#include "base/files/scoped_temp_dir.h" |
#include "base/macros.h" |
+#include "base/memory/ptr_util.h" |
#include "base/memory/ref_counted.h" |
#include "base/memory/scoped_vector.h" |
#include "base/path_service.h" |
#include "base/run_loop.h" |
-#include "base/stl_util.h" |
#include "base/strings/stringprintf.h" |
#include "base/strings/utf_string_conversions.h" |
#include "base/threading/sequenced_worker_pool.h" |
@@ -198,7 +198,7 @@ class MockProfileSharedRenderProcessHostFactory |
// RPH created with this factory are owned by it. If the RPH is destroyed |
// for testing purposes, it must be removed from the factory first. |
- content::MockRenderProcessHost* ReleaseRPH( |
+ std::unique_ptr<content::MockRenderProcessHost> ReleaseRPH( |
content::BrowserContext* browser_context); |
content::RenderProcessHost* CreateRenderProcessHost( |
@@ -206,9 +206,9 @@ class MockProfileSharedRenderProcessHostFactory |
content::SiteInstance* site_instance) const override; |
private: |
- typedef std::map<content::BrowserContext*, content::MockRenderProcessHost*> |
- ProfileRPHMap; |
- mutable ProfileRPHMap rph_map_; |
+ mutable std::map<content::BrowserContext*, |
+ std::unique_ptr<content::MockRenderProcessHost>> |
+ rph_map_; |
DISALLOW_COPY_AND_ASSIGN(MockProfileSharedRenderProcessHostFactory); |
}; |
@@ -397,16 +397,16 @@ bool MediaFileSystemInfoComparator(const MediaFileSystemInfo& a, |
MockProfileSharedRenderProcessHostFactory:: |
~MockProfileSharedRenderProcessHostFactory() { |
- base::STLDeleteValues(&rph_map_); |
} |
-content::MockRenderProcessHost* |
+std::unique_ptr<content::MockRenderProcessHost> |
MockProfileSharedRenderProcessHostFactory::ReleaseRPH( |
content::BrowserContext* browser_context) { |
- ProfileRPHMap::iterator existing = rph_map_.find(browser_context); |
+ auto existing = rph_map_.find(browser_context); |
if (existing == rph_map_.end()) |
return NULL; |
- content::MockRenderProcessHost* result = existing->second; |
+ std::unique_ptr<content::MockRenderProcessHost> result = |
+ std::move(existing->second); |
rph_map_.erase(existing); |
return result; |
} |
@@ -415,12 +415,12 @@ content::RenderProcessHost* |
MockProfileSharedRenderProcessHostFactory::CreateRenderProcessHost( |
content::BrowserContext* browser_context, |
content::SiteInstance* site_instance) const { |
- ProfileRPHMap::const_iterator existing = rph_map_.find(browser_context); |
+ auto existing = rph_map_.find(browser_context); |
if (existing != rph_map_.end()) |
- return existing->second; |
+ return existing->second.get(); |
rph_map_[browser_context] = |
- new content::MockRenderProcessHost(browser_context); |
- return rph_map_[browser_context]; |
+ base::MakeUnique<content::MockRenderProcessHost>(browser_context); |
+ return rph_map_[browser_context].get(); |
} |
////////////////// |
@@ -452,13 +452,13 @@ ProfileState::ProfileState( |
single_web_contents_.reset( |
content::WebContentsTester::CreateTestWebContents(profile_.get(), NULL)); |
- single_rph_ = rph_factory->ReleaseRPH(profile_.get()); |
+ single_rph_ = rph_factory->ReleaseRPH(profile_.get()).release(); |
Nico
2016/10/24 18:41:02
as far as i can tell nothing ever reads this varia
Lei Zhang
2016/10/24 18:45:14
The |single_rph_| declaration above has this comme
Nico
2016/10/24 18:49:00
But why is this in an env var then? And if somethi
Avi (use Gerrit)
2016/10/24 19:15:37
Let me remove this set of files from this CL and f
|
shared_web_contents1_.reset( |
content::WebContentsTester::CreateTestWebContents(profile_.get(), NULL)); |
shared_web_contents2_.reset( |
content::WebContentsTester::CreateTestWebContents(profile_.get(), NULL)); |
- shared_rph_ = rph_factory->ReleaseRPH(profile_.get()); |
+ shared_rph_ = rph_factory->ReleaseRPH(profile_.get()).release(); |
} |
ProfileState::~ProfileState() { |