Commit 0c395569 authored by ricea's avatar ricea Committed by Commit bot

Re-write many calls to WrapUnique() with MakeUnique()

A mostly-automated change to convert instances of WrapUnique(new Foo(...)) to
MakeUnique<Foo>(...). See the thread at
https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/iQgMedVA8-k
for background.

To avoid requiring too many manual fixups, the change skips some cases that are
frequently problematic. In particular, in methods named Foo::Method() it will
not try to change WrapUnique(new Foo()) to MakeUnique<Foo>(). This is because
Foo::Method() may be accessing an internal constructor of Foo.

Cases where MakeUnique<NestedClass>(...) is called within a method of
OuterClass are common but hard to detect automatically, so have been fixed-up
manually.

The only types of manual fix ups applied are:
1) Revert MakeUnique back to WrapUnique
2) Change NULL to nullptr in argument list (MakeUnique cannot forward NULL
   correctly)
3) Add base:: namespace qualifier where missing.

WrapUnique(new Foo) has not been converted to MakeUnique<Foo>() as this might
change behaviour if Foo does not have a user-defined constructor. For example,
WrapUnique(new int) creates an unitialised integer, but MakeUnique<int>()
creates an integer initialised to 0.

git cl format has been been run over the CL. Spot-checking has uncovered no
cases of mis-formatting.

Miscellaneous minor cleanups were applied.

BUG=637812

Review-Url: https://codereview.chromium.org/2341693002
Cr-Commit-Position: refs/heads/master@{#418795}
parent d64a5f64
...@@ -720,9 +720,8 @@ bool ChromeContentClient::IsSupplementarySiteIsolationModeEnabled() { ...@@ -720,9 +720,8 @@ bool ChromeContentClient::IsSupplementarySiteIsolationModeEnabled() {
} }
content::OriginTrialPolicy* ChromeContentClient::GetOriginTrialPolicy() { content::OriginTrialPolicy* ChromeContentClient::GetOriginTrialPolicy() {
if (!origin_trial_policy_) { if (!origin_trial_policy_)
origin_trial_policy_ = base::WrapUnique(new ChromeOriginTrialPolicy()); origin_trial_policy_ = base::MakeUnique<ChromeOriginTrialPolicy>();
}
return origin_trial_policy_.get(); return origin_trial_policy_.get();
} }
......
...@@ -38,12 +38,11 @@ std::unique_ptr<ActionInfo> PageActionManifestTest::LoadAction( ...@@ -38,12 +38,11 @@ std::unique_ptr<ActionInfo> PageActionManifestTest::LoadAction(
const ActionInfo* page_action_info = const ActionInfo* page_action_info =
ActionInfo::GetPageActionInfo(extension.get()); ActionInfo::GetPageActionInfo(extension.get());
EXPECT_TRUE(page_action_info); EXPECT_TRUE(page_action_info);
if (page_action_info) { if (page_action_info)
return base::WrapUnique(new ActionInfo(*page_action_info)); return base::MakeUnique<ActionInfo>(*page_action_info);
}
ADD_FAILURE() << "Expected manifest in " << manifest_filename ADD_FAILURE() << "Expected manifest in " << manifest_filename
<< " to include a page_action section."; << " to include a page_action section.";
return std::unique_ptr<ActionInfo>(); return nullptr;
} }
TEST_F(PageActionManifestTest, ManifestVersion2) { TEST_F(PageActionManifestTest, ManifestVersion2) {
......
...@@ -131,7 +131,7 @@ TEST_F(PlatformAppsManifestTest, CertainApisRequirePlatformApps) { ...@@ -131,7 +131,7 @@ TEST_F(PlatformAppsManifestTest, CertainApisRequirePlatformApps) {
permissions->AppendString(api_name); permissions->AppendString(api_name);
manifest->Set("permissions", permissions); manifest->Set("permissions", permissions);
manifests.push_back( manifests.push_back(
base::WrapUnique(new ManifestData(manifest->CreateDeepCopy(), ""))); base::MakeUnique<ManifestData>(manifest->CreateDeepCopy(), ""));
} }
// First try to load without any flags. This should warn for every API. // First try to load without any flags. This should warn for every API.
for (const std::unique_ptr<ManifestData>& manifest : manifests) { for (const std::unique_ptr<ManifestData>& manifest : manifests) {
......
...@@ -54,25 +54,25 @@ namespace installer_util { ...@@ -54,25 +54,25 @@ namespace installer_util {
std::unique_ptr<Beacon> MakeLastOsUpgradeBeacon( std::unique_ptr<Beacon> MakeLastOsUpgradeBeacon(
bool system_install, bool system_install,
const AppRegistrationData& registration_data) { const AppRegistrationData& registration_data) {
return base::WrapUnique(new Beacon(L"LastOsUpgrade", Beacon::BeaconType::LAST, return base::MakeUnique<Beacon>(L"LastOsUpgrade", Beacon::BeaconType::LAST,
Beacon::BeaconScope::PER_INSTALL, Beacon::BeaconScope::PER_INSTALL,
system_install, registration_data)); system_install, registration_data);
} }
std::unique_ptr<Beacon> MakeLastWasDefaultBeacon( std::unique_ptr<Beacon> MakeLastWasDefaultBeacon(
bool system_install, bool system_install,
const AppRegistrationData& registration_data) { const AppRegistrationData& registration_data) {
return base::WrapUnique(new Beacon( return base::MakeUnique<Beacon>(L"LastWasDefault", Beacon::BeaconType::LAST,
L"LastWasDefault", Beacon::BeaconType::LAST, Beacon::BeaconScope::PER_USER, system_install,
Beacon::BeaconScope::PER_USER, system_install, registration_data)); registration_data);
} }
std::unique_ptr<Beacon> MakeFirstNotDefaultBeacon( std::unique_ptr<Beacon> MakeFirstNotDefaultBeacon(
bool system_install, bool system_install,
const AppRegistrationData& registration_data) { const AppRegistrationData& registration_data) {
return base::WrapUnique(new Beacon( return base::MakeUnique<Beacon>(L"FirstNotDefault", Beacon::BeaconType::FIRST,
L"FirstNotDefault", Beacon::BeaconType::FIRST, Beacon::BeaconScope::PER_USER, system_install,
Beacon::BeaconScope::PER_USER, system_install, registration_data)); registration_data);
} }
// Beacon ---------------------------------------------------------------------- // Beacon ----------------------------------------------------------------------
......
...@@ -55,8 +55,8 @@ BrowserDistribution::Type GetCurrentDistributionType() { ...@@ -55,8 +55,8 @@ BrowserDistribution::Type GetCurrentDistributionType() {
BrowserDistribution::BrowserDistribution() BrowserDistribution::BrowserDistribution()
: type_(CHROME_BROWSER), : type_(CHROME_BROWSER),
app_reg_data_(base::WrapUnique( app_reg_data_(base::MakeUnique<NonUpdatingAppRegistrationData>(
new NonUpdatingAppRegistrationData(L"Software\\Chromium"))) {} L"Software\\Chromium")) {}
BrowserDistribution::BrowserDistribution( BrowserDistribution::BrowserDistribution(
Type type, Type type,
......
...@@ -64,7 +64,7 @@ TEST_F(LzmaFileAllocatorTest, SizeIsZeroTest) { ...@@ -64,7 +64,7 @@ TEST_F(LzmaFileAllocatorTest, SizeIsZeroTest) {
TEST_F(LzmaFileAllocatorTest, DeleteAfterCloseTest) { TEST_F(LzmaFileAllocatorTest, DeleteAfterCloseTest) {
std::unique_ptr<LzmaFileAllocator> allocator = std::unique_ptr<LzmaFileAllocator> allocator =
base::WrapUnique(new LzmaFileAllocator(temp_dir_.path())); base::MakeUnique<LzmaFileAllocator>(temp_dir_.path());
base::FilePath file_path = allocator->mapped_file_path_; base::FilePath file_path = allocator->mapped_file_path_;
ASSERT_TRUE(base::PathExists(file_path)); ASSERT_TRUE(base::PathExists(file_path));
allocator.reset(); allocator.reset();
......
...@@ -37,7 +37,7 @@ class ScopedUserProtocolEntryTest : public testing::Test { ...@@ -37,7 +37,7 @@ class ScopedUserProtocolEntryTest : public testing::Test {
void CreateScopedUserProtocolEntryAndVerifyRegistryValue( void CreateScopedUserProtocolEntryAndVerifyRegistryValue(
const base::string16& expected_entry_value) { const base::string16& expected_entry_value) {
entry_ = base::WrapUnique(new ScopedUserProtocolEntry(L"http")); entry_ = base::MakeUnique<ScopedUserProtocolEntry>(L"http");
ASSERT_TRUE(RegistryEntry(kProtocolEntryKeyPath, kProtocolEntryName, ASSERT_TRUE(RegistryEntry(kProtocolEntryKeyPath, kProtocolEntryName,
expected_entry_value) expected_entry_value)
.ExistsInRegistry(RegistryEntry::LOOK_IN_HKCU)); .ExistsInRegistry(RegistryEntry::LOOK_IN_HKCU));
......
...@@ -109,7 +109,7 @@ void ExtensionLocalizationPeer::OnCompletedRequest( ...@@ -109,7 +109,7 @@ void ExtensionLocalizationPeer::OnCompletedRequest(
original_peer_->OnReceivedResponse(response_info_); original_peer_->OnReceivedResponse(response_info_);
if (!data_.empty()) if (!data_.empty())
original_peer_->OnReceivedData(base::WrapUnique(new StringData(data_))); original_peer_->OnReceivedData(base::MakeUnique<StringData>(data_));
original_peer_->OnCompletedRequest(error_code, was_ignored_by_handler, original_peer_->OnCompletedRequest(error_code, was_ignored_by_handler,
stale_copy_in_cache, completion_time, stale_copy_in_cache, completion_time,
total_transfer_size); total_transfer_size);
......
...@@ -137,13 +137,13 @@ TEST_F(ExtensionLocalizationPeerTest, OnReceivedData) { ...@@ -137,13 +137,13 @@ TEST_F(ExtensionLocalizationPeerTest, OnReceivedData) {
EXPECT_TRUE(GetData().empty()); EXPECT_TRUE(GetData().empty());
const std::string data_chunk("12345"); const std::string data_chunk("12345");
filter_peer_->OnReceivedData(base::WrapUnique(new content::FixedReceivedData( filter_peer_->OnReceivedData(base::MakeUnique<content::FixedReceivedData>(
data_chunk.data(), data_chunk.length(), -1, 0))); data_chunk.data(), data_chunk.length(), -1, 0));
EXPECT_EQ(data_chunk, GetData()); EXPECT_EQ(data_chunk, GetData());
filter_peer_->OnReceivedData(base::WrapUnique(new content::FixedReceivedData( filter_peer_->OnReceivedData(base::MakeUnique<content::FixedReceivedData>(
data_chunk.data(), data_chunk.length(), -1, 0))); data_chunk.data(), data_chunk.length(), -1, 0));
EXPECT_EQ(data_chunk + data_chunk, GetData()); EXPECT_EQ(data_chunk + data_chunk, GetData());
} }
......
...@@ -44,19 +44,19 @@ ChromeRendererPepperHostFactory::CreateResourceHost( ...@@ -44,19 +44,19 @@ ChromeRendererPepperHostFactory::CreateResourceHost(
ppapi::PERMISSION_FLASH)) { ppapi::PERMISSION_FLASH)) {
switch (message.type()) { switch (message.type()) {
case PpapiHostMsg_Flash_Create::ID: { case PpapiHostMsg_Flash_Create::ID: {
return base::WrapUnique( return base::MakeUnique<PepperFlashRendererHost>(host_, instance,
new PepperFlashRendererHost(host_, instance, resource)); resource);
} }
case PpapiHostMsg_FlashFullscreen_Create::ID: { case PpapiHostMsg_FlashFullscreen_Create::ID: {
return base::WrapUnique( return base::MakeUnique<PepperFlashFullscreenHost>(host_, instance,
new PepperFlashFullscreenHost(host_, instance, resource)); resource);
} }
case PpapiHostMsg_FlashMenu_Create::ID: { case PpapiHostMsg_FlashMenu_Create::ID: {
ppapi::proxy::SerializedFlashMenu serialized_menu; ppapi::proxy::SerializedFlashMenu serialized_menu;
if (ppapi::UnpackMessage<PpapiHostMsg_FlashMenu_Create>( if (ppapi::UnpackMessage<PpapiHostMsg_FlashMenu_Create>(
message, &serialized_menu)) { message, &serialized_menu)) {
return base::WrapUnique(new PepperFlashMenuHost( return base::MakeUnique<PepperFlashMenuHost>(
host_, instance, resource, serialized_menu)); host_, instance, resource, serialized_menu);
} }
break; break;
} }
...@@ -76,14 +76,14 @@ ChromeRendererPepperHostFactory::CreateResourceHost( ...@@ -76,14 +76,14 @@ ChromeRendererPepperHostFactory::CreateResourceHost(
PP_PrivateFontCharset charset; PP_PrivateFontCharset charset;
if (ppapi::UnpackMessage<PpapiHostMsg_FlashFontFile_Create>( if (ppapi::UnpackMessage<PpapiHostMsg_FlashFontFile_Create>(
message, &description, &charset)) { message, &description, &charset)) {
return base::WrapUnique(new PepperFlashFontFileHost( return base::MakeUnique<PepperFlashFontFileHost>(
host_, instance, resource, description, charset)); host_, instance, resource, description, charset);
} }
break; break;
} }
case PpapiHostMsg_FlashDRM_Create::ID: case PpapiHostMsg_FlashDRM_Create::ID:
return base::WrapUnique( return base::MakeUnique<PepperFlashDRMRendererHost>(host_, instance,
new PepperFlashDRMRendererHost(host_, instance, resource)); resource);
} }
} }
...@@ -91,8 +91,7 @@ ChromeRendererPepperHostFactory::CreateResourceHost( ...@@ -91,8 +91,7 @@ ChromeRendererPepperHostFactory::CreateResourceHost(
ppapi::PERMISSION_PRIVATE)) { ppapi::PERMISSION_PRIVATE)) {
switch (message.type()) { switch (message.type()) {
case PpapiHostMsg_PDF_Create::ID: { case PpapiHostMsg_PDF_Create::ID: {
return base::WrapUnique( return base::MakeUnique<pdf::PepperPDFHost>(host_, instance, resource);
new pdf::PepperPDFHost(host_, instance, resource));
} }
} }
} }
...@@ -103,7 +102,7 @@ ChromeRendererPepperHostFactory::CreateResourceHost( ...@@ -103,7 +102,7 @@ ChromeRendererPepperHostFactory::CreateResourceHost(
// access to the other private interfaces. // access to the other private interfaces.
switch (message.type()) { switch (message.type()) {
case PpapiHostMsg_UMA_Create::ID: { case PpapiHostMsg_UMA_Create::ID: {
return base::WrapUnique(new PepperUMAHost(host_, instance, resource)); return base::MakeUnique<PepperUMAHost>(host_, instance, resource);
} }
} }
......
...@@ -21,9 +21,9 @@ void PepperHelper::DidCreatePepperPlugin(content::RendererPpapiHost* host) { ...@@ -21,9 +21,9 @@ void PepperHelper::DidCreatePepperPlugin(content::RendererPpapiHost* host) {
// TODO(brettw) figure out how to hook up the host factory. It needs some // TODO(brettw) figure out how to hook up the host factory. It needs some
// kind of filter-like system to allow dynamic additions. // kind of filter-like system to allow dynamic additions.
host->GetPpapiHost()->AddHostFactoryFilter( host->GetPpapiHost()->AddHostFactoryFilter(
base::WrapUnique(new ChromeRendererPepperHostFactory(host))); base::MakeUnique<ChromeRendererPepperHostFactory>(host));
host->GetPpapiHost()->AddInstanceMessageFilter( host->GetPpapiHost()->AddInstanceMessageFilter(
base::WrapUnique(new PepperSharedMemoryMessageFilter(host))); base::MakeUnique<PepperSharedMemoryMessageFilter>(host));
} }
void PepperHelper::OnDestruct() { void PepperHelper::OnDestruct() {
......
...@@ -48,8 +48,8 @@ SecurityFilterPeer::CreateSecurityFilterPeerForDeniedRequest( ...@@ -48,8 +48,8 @@ SecurityFilterPeer::CreateSecurityFilterPeerForDeniedRequest(
if (content::IsResourceTypeFrame(resource_type)) if (content::IsResourceTypeFrame(resource_type))
return CreateSecurityFilterPeerForFrame(std::move(peer), os_error); return CreateSecurityFilterPeerForFrame(std::move(peer), os_error);
// Any other content is entirely filtered-out. // Any other content is entirely filtered-out.
return base::WrapUnique(new ReplaceContentPeer( return base::MakeUnique<ReplaceContentPeer>(std::move(peer),
std::move(peer), std::string(), std::string())); std::string(), std::string());
default: default:
// For other errors, we use our normal error handling. // For other errors, we use our normal error handling.
return peer; return peer;
...@@ -68,8 +68,8 @@ SecurityFilterPeer::CreateSecurityFilterPeerForFrame( ...@@ -68,8 +68,8 @@ SecurityFilterPeer::CreateSecurityFilterPeerForFrame(
"<body style='background-color:#990000;color:white;'>" "<body style='background-color:#990000;color:white;'>"
"%s</body></html>", "%s</body></html>",
l10n_util::GetStringUTF8(IDS_UNSAFE_FRAME_MESSAGE).c_str()); l10n_util::GetStringUTF8(IDS_UNSAFE_FRAME_MESSAGE).c_str());
return base::WrapUnique( return base::MakeUnique<ReplaceContentPeer>(std::move(peer), "text/html",
new ReplaceContentPeer(std::move(peer), "text/html", html)); html);
} }
void SecurityFilterPeer::OnUploadProgress(uint64_t position, uint64_t size) { void SecurityFilterPeer::OnUploadProgress(uint64_t position, uint64_t size) {
...@@ -147,8 +147,8 @@ void BufferedPeer::OnCompletedRequest(int error_code, ...@@ -147,8 +147,8 @@ void BufferedPeer::OnCompletedRequest(int error_code,
original_peer_->OnReceivedResponse(response_info_); original_peer_->OnReceivedResponse(response_info_);
if (!data_.empty()) { if (!data_.empty()) {
original_peer_->OnReceivedData(base::WrapUnique( original_peer_->OnReceivedData(base::MakeUnique<content::FixedReceivedData>(
new content::FixedReceivedData(data_.data(), data_.size(), -1, 0))); data_.data(), data_.size(), -1, 0));
} }
original_peer_->OnCompletedRequest(error_code, was_ignored_by_handler, original_peer_->OnCompletedRequest(error_code, was_ignored_by_handler,
stale_copy_in_cache, completion_time, stale_copy_in_cache, completion_time,
...@@ -187,8 +187,8 @@ void ReplaceContentPeer::OnCompletedRequest( ...@@ -187,8 +187,8 @@ void ReplaceContentPeer::OnCompletedRequest(
info.content_length = static_cast<int>(data_.size()); info.content_length = static_cast<int>(data_.size());
original_peer_->OnReceivedResponse(info); original_peer_->OnReceivedResponse(info);
if (!data_.empty()) { if (!data_.empty()) {
original_peer_->OnReceivedData(base::WrapUnique( original_peer_->OnReceivedData(base::MakeUnique<content::FixedReceivedData>(
new content::FixedReceivedData(data_.data(), data_.size(), -1, 0))); data_.data(), data_.size(), -1, 0));
} }
original_peer_->OnCompletedRequest(net::OK, false, stale_copy_in_cache, original_peer_->OnCompletedRequest(net::OK, false, stale_copy_in_cache,
completion_time, total_transfer_size); completion_time, total_transfer_size);
......
...@@ -226,8 +226,9 @@ bool ServiceProcess::Initialize(base::MessageLoopForUI* message_loop, ...@@ -226,8 +226,9 @@ bool ServiceProcess::Initialize(base::MessageLoopForUI* message_loop,
ipc_server_.reset(new ServiceIPCServer(this /* client */, io_task_runner(), ipc_server_.reset(new ServiceIPCServer(this /* client */, io_task_runner(),
&shutdown_event_)); &shutdown_event_));
ipc_server_->AddMessageHandler(base::WrapUnique( ipc_server_->AddMessageHandler(
new cloud_print::CloudPrintMessageHandler(ipc_server_.get(), this))); base::MakeUnique<cloud_print::CloudPrintMessageHandler>(ipc_server_.get(),
this));
ipc_server_->Init(); ipc_server_->Init();
// After the IPC server has started we signal that the service process is // After the IPC server has started we signal that the service process is
......
...@@ -40,7 +40,7 @@ std::string ServiceProcessPrefs::GetString( ...@@ -40,7 +40,7 @@ std::string ServiceProcessPrefs::GetString(
void ServiceProcessPrefs::SetString(const std::string& key, void ServiceProcessPrefs::SetString(const std::string& key,
const std::string& value) { const std::string& value) {
prefs_->SetValue(key, base::WrapUnique(new base::StringValue(value)), prefs_->SetValue(key, base::MakeUnique<base::StringValue>(value),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
} }
...@@ -55,7 +55,7 @@ bool ServiceProcessPrefs::GetBoolean(const std::string& key, ...@@ -55,7 +55,7 @@ bool ServiceProcessPrefs::GetBoolean(const std::string& key,
} }
void ServiceProcessPrefs::SetBoolean(const std::string& key, bool value) { void ServiceProcessPrefs::SetBoolean(const std::string& key, bool value) {
prefs_->SetValue(key, base::WrapUnique(new base::FundamentalValue(value)), prefs_->SetValue(key, base::MakeUnique<base::FundamentalValue>(value),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
} }
...@@ -70,7 +70,7 @@ int ServiceProcessPrefs::GetInt(const std::string& key, ...@@ -70,7 +70,7 @@ int ServiceProcessPrefs::GetInt(const std::string& key,
} }
void ServiceProcessPrefs::SetInt(const std::string& key, int value) { void ServiceProcessPrefs::SetInt(const std::string& key, int value) {
prefs_->SetValue(key, base::WrapUnique(new base::FundamentalValue(value)), prefs_->SetValue(key, base::MakeUnique<base::FundamentalValue>(value),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
} }
......
...@@ -167,8 +167,9 @@ void ChromeRenderViewTest::InitChromeContentRendererClient( ...@@ -167,8 +167,9 @@ void ChromeRenderViewTest::InitChromeContentRendererClient(
new ChromeExtensionsDispatcherDelegate()); new ChromeExtensionsDispatcherDelegate());
ChromeExtensionsRendererClient* ext_client = ChromeExtensionsRendererClient* ext_client =
ChromeExtensionsRendererClient::GetInstance(); ChromeExtensionsRendererClient::GetInstance();
ext_client->SetExtensionDispatcherForTest(base::WrapUnique( ext_client->SetExtensionDispatcherForTest(
new extensions::Dispatcher(extension_dispatcher_delegate_.get()))); base::MakeUnique<extensions::Dispatcher>(
extension_dispatcher_delegate_.get()));
#endif #endif
#if defined(ENABLE_SPELLCHECK) #if defined(ENABLE_SPELLCHECK)
client->SetSpellcheck(new SpellCheck()); client->SetSpellcheck(new SpellCheck());
......
...@@ -20,7 +20,7 @@ std::unique_ptr<Browser> CreateBrowserWithTestWindowForParams( ...@@ -20,7 +20,7 @@ std::unique_ptr<Browser> CreateBrowserWithTestWindowForParams(
TestBrowserWindow* window = new TestBrowserWindow; TestBrowserWindow* window = new TestBrowserWindow;
new TestBrowserWindowOwner(window); new TestBrowserWindowOwner(window);
params->window = window; params->window = window;
return base::WrapUnique(new Browser(*params)); return base::MakeUnique<Browser>(*params);
} }
} // namespace chrome } // namespace chrome
......
...@@ -199,10 +199,10 @@ class TestExtensionURLRequestContextGetter ...@@ -199,10 +199,10 @@ class TestExtensionURLRequestContextGetter
std::unique_ptr<KeyedService> BuildHistoryService( std::unique_ptr<KeyedService> BuildHistoryService(
content::BrowserContext* context) { content::BrowserContext* context) {
return base::WrapUnique(new history::HistoryService( return base::MakeUnique<history::HistoryService>(
base::WrapUnique(new ChromeHistoryClient( base::MakeUnique<ChromeHistoryClient>(
BookmarkModelFactory::GetForBrowserContext(context))), BookmarkModelFactory::GetForBrowserContext(context)),
base::WrapUnique(new history::ContentVisitDelegate(context)))); base::MakeUnique<history::ContentVisitDelegate>(context));
} }
std::unique_ptr<KeyedService> BuildInMemoryURLIndex( std::unique_ptr<KeyedService> BuildInMemoryURLIndex(
...@@ -223,8 +223,8 @@ std::unique_ptr<KeyedService> BuildBookmarkModel( ...@@ -223,8 +223,8 @@ std::unique_ptr<KeyedService> BuildBookmarkModel(
content::BrowserContext* context) { content::BrowserContext* context) {
Profile* profile = Profile::FromBrowserContext(context); Profile* profile = Profile::FromBrowserContext(context);
std::unique_ptr<BookmarkModel> bookmark_model( std::unique_ptr<BookmarkModel> bookmark_model(
new BookmarkModel(base::WrapUnique(new ChromeBookmarkClient( new BookmarkModel(base::MakeUnique<ChromeBookmarkClient>(
profile, ManagedBookmarkServiceFactory::GetForProfile(profile))))); profile, ManagedBookmarkServiceFactory::GetForProfile(profile))));
bookmark_model->Load(profile->GetPrefs(), profile->GetPath(), bookmark_model->Load(profile->GetPrefs(), profile->GetPath(),
profile->GetIOTaskRunner(), profile->GetIOTaskRunner(),
content::BrowserThread::GetTaskRunnerForThread( content::BrowserThread::GetTaskRunnerForThread(
...@@ -241,12 +241,12 @@ void TestProfileErrorCallback(WebDataServiceWrapper::ErrorType error_type, ...@@ -241,12 +241,12 @@ void TestProfileErrorCallback(WebDataServiceWrapper::ErrorType error_type,
std::unique_ptr<KeyedService> BuildWebDataService( std::unique_ptr<KeyedService> BuildWebDataService(
content::BrowserContext* context) { content::BrowserContext* context) {
const base::FilePath& context_path = context->GetPath(); const base::FilePath& context_path = context->GetPath();
return base::WrapUnique(new WebDataServiceWrapper( return base::MakeUnique<WebDataServiceWrapper>(
context_path, g_browser_process->GetApplicationLocale(), context_path, g_browser_process->GetApplicationLocale(),
BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), BrowserThread::GetTaskRunnerForThread(BrowserThread::UI),
BrowserThread::GetTaskRunnerForThread(BrowserThread::DB), BrowserThread::GetTaskRunnerForThread(BrowserThread::DB),
sync_start_util::GetFlareForSyncableService(context_path), sync_start_util::GetFlareForSyncableService(context_path),
&TestProfileErrorCallback)); &TestProfileErrorCallback);
} }
#if BUILDFLAG(ANDROID_JAVA_UI) #if BUILDFLAG(ANDROID_JAVA_UI)
...@@ -666,9 +666,9 @@ base::FilePath TestingProfile::GetPath() const { ...@@ -666,9 +666,9 @@ base::FilePath TestingProfile::GetPath() const {
std::unique_ptr<content::ZoomLevelDelegate> std::unique_ptr<content::ZoomLevelDelegate>
TestingProfile::CreateZoomLevelDelegate(const base::FilePath& partition_path) { TestingProfile::CreateZoomLevelDelegate(const base::FilePath& partition_path) {
return base::WrapUnique(new ChromeZoomLevelPrefs( return base::MakeUnique<ChromeZoomLevelPrefs>(
GetPrefs(), GetPath(), partition_path, GetPrefs(), GetPath(), partition_path,
zoom::ZoomEventManager::GetForBrowserContext(this)->GetWeakPtr())); zoom::ZoomEventManager::GetForBrowserContext(this)->GetWeakPtr());
} }
scoped_refptr<base::SequencedTaskRunner> TestingProfile::GetIOTaskRunner() { scoped_refptr<base::SequencedTaskRunner> TestingProfile::GetIOTaskRunner() {
......
...@@ -998,7 +998,7 @@ class MockDevToolsEventListener : public DevToolsEventListener { ...@@ -998,7 +998,7 @@ class MockDevToolsEventListener : public DevToolsEventListener {
std::unique_ptr<SyncWebSocket> CreateMockSyncWebSocket6( std::unique_ptr<SyncWebSocket> CreateMockSyncWebSocket6(
std::list<std::string>* messages) { std::list<std::string>* messages) {
return base::WrapUnique(new MockSyncWebSocket6(messages)); return base::MakeUnique<MockSyncWebSocket6>(messages);
} }
} // namespace } // namespace
......
...@@ -329,7 +329,7 @@ void ExecuteSessionCommand( ...@@ -329,7 +329,7 @@ void ExecuteSessionCommand(
namespace internal { namespace internal {
void CreateSessionOnSessionThreadForTesting(const std::string& id) { void CreateSessionOnSessionThreadForTesting(const std::string& id) {
SetThreadLocalSession(base::WrapUnique(new Session(id))); SetThreadLocalSession(base::MakeUnique<Session>(id));
} }
} // namespace internal } // namespace internal
...@@ -24,8 +24,9 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { ...@@ -24,8 +24,9 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
// net::HttpServer fails to parse headers if user-agent header is blank. // net::HttpServer fails to parse headers if user-agent header is blank.
builder.set_user_agent("chromedriver"); builder.set_user_agent("chromedriver");
builder.DisableHttpCache(); builder.DisableHttpCache();
builder.set_proxy_config_service(base::WrapUnique( builder.set_proxy_config_service(
new net::ProxyConfigServiceFixed(net::ProxyConfig::CreateDirect()))); base::MakeUnique<net::ProxyConfigServiceFixed>(
net::ProxyConfig::CreateDirect()));
url_request_context_ = builder.Build(); url_request_context_ = builder.Build();
} }
return url_request_context_.get(); return url_request_context_.get();
......
...@@ -256,6 +256,6 @@ EdgeDatabaseReader::OpenTableEnumerator(const base::string16& table_name) { ...@@ -256,6 +256,6 @@ EdgeDatabaseReader::OpenTableEnumerator(const base::string16& table_name) {
nullptr, 0, JET_bitTableReadOnly, &table_id))) nullptr, 0, JET_bitTableReadOnly, &table_id)))
return nullptr; return nullptr;
return base::WrapUnique( return base::MakeUnique<EdgeDatabaseTableEnumerator>(table_name, session_id_,
new EdgeDatabaseTableEnumerator(table_name, session_id_, table_id)); table_id);
} }
...@@ -310,8 +310,8 @@ std::unique_ptr<ReadStream> HFSIterator::GetReadStream() { ...@@ -310,8 +310,8 @@ std::unique_ptr<ReadStream> HFSIterator::GetReadStream() {
return nullptr; return nullptr;
DCHECK_EQ(kHFSPlusFileRecord, catalog_->current_record()->record_type); DCHECK_EQ(kHFSPlusFileRecord, catalog_->current_record()->record_type);
return base::WrapUnique( return base::MakeUnique<HFSForkReadStream>(
new HFSForkReadStream(this, catalog_->current_record()->file->dataFork)); this, catalog_->current_record()->file->dataFork);
} }
bool HFSIterator::SeekToBlock(uint64_t block) { bool HFSIterator::SeekToBlock(uint64_t block) {
......
...@@ -402,8 +402,8 @@ size_t UDIFParser::GetPartitionSize(size_t part_number) { ...@@ -402,8 +402,8 @@ size_t UDIFParser::GetPartitionSize(size_t part_number) {
std::unique_ptr<ReadStream> UDIFParser::GetPartitionReadStream( std::unique_ptr<ReadStream> UDIFParser::GetPartitionReadStream(
size_t part_number) { size_t part_number) {
DCHECK_LT(part_number, blocks_.size()); DCHECK_LT(part_number, blocks_.size());
return base::WrapUnique( return base::MakeUnique<UDIFPartitionReadStream>(stream_, block_size_,
new UDIFPartitionReadStream(stream_, block_size_, blocks_[part_number])); blocks_[part_number]);
} }
bool UDIFParser::ParseBlkx() { bool UDIFParser::ParseBlkx() {
......
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