From 0c39556939fdc7a522d9092f8a45e783550322c8 Mon Sep 17 00:00:00 2001 From: ricea Date: Wed, 14 Sep 2016 23:47:33 -0700 Subject: [PATCH] Re-write many calls to WrapUnique() with MakeUnique() A mostly-automated change to convert instances of WrapUnique(new Foo(...)) to MakeUnique(...). 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(). This is because Foo::Method() may be accessing an internal constructor of Foo. Cases where MakeUnique(...) 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() 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() 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} --- chrome/common/chrome_content_client.cc | 5 ++-- .../page_action_manifest_unittest.cc | 7 +++--- ...xtension_manifests_platformapp_unittest.cc | 2 +- chrome/installer/util/beacons.cc | 18 ++++++------- chrome/installer/util/browser_distribution.cc | 4 +-- .../util/lzma_file_allocator_unittest.cc | 2 +- .../scoped_user_protocol_entry_unittest.cc | 2 +- .../extensions/extension_localization_peer.cc | 2 +- .../extension_localization_peer_unittest.cc | 8 +++--- .../chrome_renderer_pepper_host_factory.cc | 25 +++++++++---------- chrome/renderer/pepper/pepper_helper.cc | 4 +-- chrome/renderer/security_filter_peer.cc | 16 ++++++------ chrome/service/service_process.cc | 5 ++-- chrome/service/service_process_prefs.cc | 6 ++--- chrome/test/base/chrome_render_view_test.cc | 5 ++-- chrome/test/base/test_browser_window.cc | 2 +- chrome/test/base/testing_profile.cc | 20 +++++++-------- .../chrome/devtools_client_impl_unittest.cc | 2 +- chrome/test/chromedriver/commands.cc | 2 +- .../net/url_request_context_getter.cc | 5 ++-- .../importer/edge_database_reader_win.cc | 4 +-- chrome/utility/safe_browsing/mac/hfs.cc | 4 +-- chrome/utility/safe_browsing/mac/udif.cc | 4 +-- 23 files changed, 77 insertions(+), 77 deletions(-) diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc index eb4d107e699929..e94b79c5ec7e7e 100644 --- a/chrome/common/chrome_content_client.cc +++ b/chrome/common/chrome_content_client.cc @@ -720,9 +720,8 @@ bool ChromeContentClient::IsSupplementarySiteIsolationModeEnabled() { } content::OriginTrialPolicy* ChromeContentClient::GetOriginTrialPolicy() { - if (!origin_trial_policy_) { - origin_trial_policy_ = base::WrapUnique(new ChromeOriginTrialPolicy()); - } + if (!origin_trial_policy_) + origin_trial_policy_ = base::MakeUnique(); return origin_trial_policy_.get(); } diff --git a/chrome/common/extensions/api/extension_action/page_action_manifest_unittest.cc b/chrome/common/extensions/api/extension_action/page_action_manifest_unittest.cc index 6e6d3d92fa77ea..4a0b6f984c3528 100644 --- a/chrome/common/extensions/api/extension_action/page_action_manifest_unittest.cc +++ b/chrome/common/extensions/api/extension_action/page_action_manifest_unittest.cc @@ -38,12 +38,11 @@ std::unique_ptr PageActionManifestTest::LoadAction( const ActionInfo* page_action_info = ActionInfo::GetPageActionInfo(extension.get()); EXPECT_TRUE(page_action_info); - if (page_action_info) { - return base::WrapUnique(new ActionInfo(*page_action_info)); - } + if (page_action_info) + return base::MakeUnique(*page_action_info); ADD_FAILURE() << "Expected manifest in " << manifest_filename << " to include a page_action section."; - return std::unique_ptr(); + return nullptr; } TEST_F(PageActionManifestTest, ManifestVersion2) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc index a3cdc4ef77c529..483b500a0aa780 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc @@ -131,7 +131,7 @@ TEST_F(PlatformAppsManifestTest, CertainApisRequirePlatformApps) { permissions->AppendString(api_name); manifest->Set("permissions", permissions); manifests.push_back( - base::WrapUnique(new ManifestData(manifest->CreateDeepCopy(), ""))); + base::MakeUnique(manifest->CreateDeepCopy(), "")); } // First try to load without any flags. This should warn for every API. for (const std::unique_ptr& manifest : manifests) { diff --git a/chrome/installer/util/beacons.cc b/chrome/installer/util/beacons.cc index dac4458e761237..752736cb9b3eef 100644 --- a/chrome/installer/util/beacons.cc +++ b/chrome/installer/util/beacons.cc @@ -54,25 +54,25 @@ namespace installer_util { std::unique_ptr MakeLastOsUpgradeBeacon( bool system_install, const AppRegistrationData& registration_data) { - return base::WrapUnique(new Beacon(L"LastOsUpgrade", Beacon::BeaconType::LAST, - Beacon::BeaconScope::PER_INSTALL, - system_install, registration_data)); + return base::MakeUnique(L"LastOsUpgrade", Beacon::BeaconType::LAST, + Beacon::BeaconScope::PER_INSTALL, + system_install, registration_data); } std::unique_ptr MakeLastWasDefaultBeacon( bool system_install, const AppRegistrationData& registration_data) { - return base::WrapUnique(new Beacon( - L"LastWasDefault", Beacon::BeaconType::LAST, - Beacon::BeaconScope::PER_USER, system_install, registration_data)); + return base::MakeUnique(L"LastWasDefault", Beacon::BeaconType::LAST, + Beacon::BeaconScope::PER_USER, system_install, + registration_data); } std::unique_ptr MakeFirstNotDefaultBeacon( bool system_install, const AppRegistrationData& registration_data) { - return base::WrapUnique(new Beacon( - L"FirstNotDefault", Beacon::BeaconType::FIRST, - Beacon::BeaconScope::PER_USER, system_install, registration_data)); + return base::MakeUnique(L"FirstNotDefault", Beacon::BeaconType::FIRST, + Beacon::BeaconScope::PER_USER, system_install, + registration_data); } // Beacon ---------------------------------------------------------------------- diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc index 072c800296eb9f..9eb33aaef7f1ce 100644 --- a/chrome/installer/util/browser_distribution.cc +++ b/chrome/installer/util/browser_distribution.cc @@ -55,8 +55,8 @@ BrowserDistribution::Type GetCurrentDistributionType() { BrowserDistribution::BrowserDistribution() : type_(CHROME_BROWSER), - app_reg_data_(base::WrapUnique( - new NonUpdatingAppRegistrationData(L"Software\\Chromium"))) {} + app_reg_data_(base::MakeUnique( + L"Software\\Chromium")) {} BrowserDistribution::BrowserDistribution( Type type, diff --git a/chrome/installer/util/lzma_file_allocator_unittest.cc b/chrome/installer/util/lzma_file_allocator_unittest.cc index e790495cd37d01..6df6fb40386d95 100644 --- a/chrome/installer/util/lzma_file_allocator_unittest.cc +++ b/chrome/installer/util/lzma_file_allocator_unittest.cc @@ -64,7 +64,7 @@ TEST_F(LzmaFileAllocatorTest, SizeIsZeroTest) { TEST_F(LzmaFileAllocatorTest, DeleteAfterCloseTest) { std::unique_ptr allocator = - base::WrapUnique(new LzmaFileAllocator(temp_dir_.path())); + base::MakeUnique(temp_dir_.path()); base::FilePath file_path = allocator->mapped_file_path_; ASSERT_TRUE(base::PathExists(file_path)); allocator.reset(); diff --git a/chrome/installer/util/scoped_user_protocol_entry_unittest.cc b/chrome/installer/util/scoped_user_protocol_entry_unittest.cc index bf308376c15689..b7e3eea1914c57 100644 --- a/chrome/installer/util/scoped_user_protocol_entry_unittest.cc +++ b/chrome/installer/util/scoped_user_protocol_entry_unittest.cc @@ -37,7 +37,7 @@ class ScopedUserProtocolEntryTest : public testing::Test { void CreateScopedUserProtocolEntryAndVerifyRegistryValue( const base::string16& expected_entry_value) { - entry_ = base::WrapUnique(new ScopedUserProtocolEntry(L"http")); + entry_ = base::MakeUnique(L"http"); ASSERT_TRUE(RegistryEntry(kProtocolEntryKeyPath, kProtocolEntryName, expected_entry_value) .ExistsInRegistry(RegistryEntry::LOOK_IN_HKCU)); diff --git a/chrome/renderer/extensions/extension_localization_peer.cc b/chrome/renderer/extensions/extension_localization_peer.cc index 0e550f70a3eff1..745aabe26a4765 100644 --- a/chrome/renderer/extensions/extension_localization_peer.cc +++ b/chrome/renderer/extensions/extension_localization_peer.cc @@ -109,7 +109,7 @@ void ExtensionLocalizationPeer::OnCompletedRequest( original_peer_->OnReceivedResponse(response_info_); if (!data_.empty()) - original_peer_->OnReceivedData(base::WrapUnique(new StringData(data_))); + original_peer_->OnReceivedData(base::MakeUnique(data_)); original_peer_->OnCompletedRequest(error_code, was_ignored_by_handler, stale_copy_in_cache, completion_time, total_transfer_size); diff --git a/chrome/renderer/extensions/extension_localization_peer_unittest.cc b/chrome/renderer/extensions/extension_localization_peer_unittest.cc index 501860f864d019..587f0020f46cd6 100644 --- a/chrome/renderer/extensions/extension_localization_peer_unittest.cc +++ b/chrome/renderer/extensions/extension_localization_peer_unittest.cc @@ -137,13 +137,13 @@ TEST_F(ExtensionLocalizationPeerTest, OnReceivedData) { EXPECT_TRUE(GetData().empty()); const std::string data_chunk("12345"); - filter_peer_->OnReceivedData(base::WrapUnique(new content::FixedReceivedData( - data_chunk.data(), data_chunk.length(), -1, 0))); + filter_peer_->OnReceivedData(base::MakeUnique( + data_chunk.data(), data_chunk.length(), -1, 0)); EXPECT_EQ(data_chunk, GetData()); - filter_peer_->OnReceivedData(base::WrapUnique(new content::FixedReceivedData( - data_chunk.data(), data_chunk.length(), -1, 0))); + filter_peer_->OnReceivedData(base::MakeUnique( + data_chunk.data(), data_chunk.length(), -1, 0)); EXPECT_EQ(data_chunk + data_chunk, GetData()); } diff --git a/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc b/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc index c1e2d1a09751ff..12d432198186da 100644 --- a/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc +++ b/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc @@ -44,19 +44,19 @@ ChromeRendererPepperHostFactory::CreateResourceHost( ppapi::PERMISSION_FLASH)) { switch (message.type()) { case PpapiHostMsg_Flash_Create::ID: { - return base::WrapUnique( - new PepperFlashRendererHost(host_, instance, resource)); + return base::MakeUnique(host_, instance, + resource); } case PpapiHostMsg_FlashFullscreen_Create::ID: { - return base::WrapUnique( - new PepperFlashFullscreenHost(host_, instance, resource)); + return base::MakeUnique(host_, instance, + resource); } case PpapiHostMsg_FlashMenu_Create::ID: { ppapi::proxy::SerializedFlashMenu serialized_menu; if (ppapi::UnpackMessage( message, &serialized_menu)) { - return base::WrapUnique(new PepperFlashMenuHost( - host_, instance, resource, serialized_menu)); + return base::MakeUnique( + host_, instance, resource, serialized_menu); } break; } @@ -76,14 +76,14 @@ ChromeRendererPepperHostFactory::CreateResourceHost( PP_PrivateFontCharset charset; if (ppapi::UnpackMessage( message, &description, &charset)) { - return base::WrapUnique(new PepperFlashFontFileHost( - host_, instance, resource, description, charset)); + return base::MakeUnique( + host_, instance, resource, description, charset); } break; } case PpapiHostMsg_FlashDRM_Create::ID: - return base::WrapUnique( - new PepperFlashDRMRendererHost(host_, instance, resource)); + return base::MakeUnique(host_, instance, + resource); } } @@ -91,8 +91,7 @@ ChromeRendererPepperHostFactory::CreateResourceHost( ppapi::PERMISSION_PRIVATE)) { switch (message.type()) { case PpapiHostMsg_PDF_Create::ID: { - return base::WrapUnique( - new pdf::PepperPDFHost(host_, instance, resource)); + return base::MakeUnique(host_, instance, resource); } } } @@ -103,7 +102,7 @@ ChromeRendererPepperHostFactory::CreateResourceHost( // access to the other private interfaces. switch (message.type()) { case PpapiHostMsg_UMA_Create::ID: { - return base::WrapUnique(new PepperUMAHost(host_, instance, resource)); + return base::MakeUnique(host_, instance, resource); } } diff --git a/chrome/renderer/pepper/pepper_helper.cc b/chrome/renderer/pepper/pepper_helper.cc index 503150fb76f97a..472a0e1299d517 100644 --- a/chrome/renderer/pepper/pepper_helper.cc +++ b/chrome/renderer/pepper/pepper_helper.cc @@ -21,9 +21,9 @@ void PepperHelper::DidCreatePepperPlugin(content::RendererPpapiHost* host) { // TODO(brettw) figure out how to hook up the host factory. It needs some // kind of filter-like system to allow dynamic additions. host->GetPpapiHost()->AddHostFactoryFilter( - base::WrapUnique(new ChromeRendererPepperHostFactory(host))); + base::MakeUnique(host)); host->GetPpapiHost()->AddInstanceMessageFilter( - base::WrapUnique(new PepperSharedMemoryMessageFilter(host))); + base::MakeUnique(host)); } void PepperHelper::OnDestruct() { diff --git a/chrome/renderer/security_filter_peer.cc b/chrome/renderer/security_filter_peer.cc index aef685c9d22fba..bfbdfa1710677a 100644 --- a/chrome/renderer/security_filter_peer.cc +++ b/chrome/renderer/security_filter_peer.cc @@ -48,8 +48,8 @@ SecurityFilterPeer::CreateSecurityFilterPeerForDeniedRequest( if (content::IsResourceTypeFrame(resource_type)) return CreateSecurityFilterPeerForFrame(std::move(peer), os_error); // Any other content is entirely filtered-out. - return base::WrapUnique(new ReplaceContentPeer( - std::move(peer), std::string(), std::string())); + return base::MakeUnique(std::move(peer), + std::string(), std::string()); default: // For other errors, we use our normal error handling. return peer; @@ -68,8 +68,8 @@ SecurityFilterPeer::CreateSecurityFilterPeerForFrame( "" "%s", l10n_util::GetStringUTF8(IDS_UNSAFE_FRAME_MESSAGE).c_str()); - return base::WrapUnique( - new ReplaceContentPeer(std::move(peer), "text/html", html)); + return base::MakeUnique(std::move(peer), "text/html", + html); } void SecurityFilterPeer::OnUploadProgress(uint64_t position, uint64_t size) { @@ -147,8 +147,8 @@ void BufferedPeer::OnCompletedRequest(int error_code, original_peer_->OnReceivedResponse(response_info_); if (!data_.empty()) { - original_peer_->OnReceivedData(base::WrapUnique( - new content::FixedReceivedData(data_.data(), data_.size(), -1, 0))); + original_peer_->OnReceivedData(base::MakeUnique( + data_.data(), data_.size(), -1, 0)); } original_peer_->OnCompletedRequest(error_code, was_ignored_by_handler, stale_copy_in_cache, completion_time, @@ -187,8 +187,8 @@ void ReplaceContentPeer::OnCompletedRequest( info.content_length = static_cast(data_.size()); original_peer_->OnReceivedResponse(info); if (!data_.empty()) { - original_peer_->OnReceivedData(base::WrapUnique( - new content::FixedReceivedData(data_.data(), data_.size(), -1, 0))); + original_peer_->OnReceivedData(base::MakeUnique( + data_.data(), data_.size(), -1, 0)); } original_peer_->OnCompletedRequest(net::OK, false, stale_copy_in_cache, completion_time, total_transfer_size); diff --git a/chrome/service/service_process.cc b/chrome/service/service_process.cc index 1f915e3f6ccf4e..56d8db8e67e80b 100644 --- a/chrome/service/service_process.cc +++ b/chrome/service/service_process.cc @@ -226,8 +226,9 @@ bool ServiceProcess::Initialize(base::MessageLoopForUI* message_loop, ipc_server_.reset(new ServiceIPCServer(this /* client */, io_task_runner(), &shutdown_event_)); - ipc_server_->AddMessageHandler(base::WrapUnique( - new cloud_print::CloudPrintMessageHandler(ipc_server_.get(), this))); + ipc_server_->AddMessageHandler( + base::MakeUnique(ipc_server_.get(), + this)); ipc_server_->Init(); // After the IPC server has started we signal that the service process is diff --git a/chrome/service/service_process_prefs.cc b/chrome/service/service_process_prefs.cc index ceded3471c6119..d4038b57ec1be3 100644 --- a/chrome/service/service_process_prefs.cc +++ b/chrome/service/service_process_prefs.cc @@ -40,7 +40,7 @@ std::string ServiceProcessPrefs::GetString( void ServiceProcessPrefs::SetString(const std::string& key, const std::string& value) { - prefs_->SetValue(key, base::WrapUnique(new base::StringValue(value)), + prefs_->SetValue(key, base::MakeUnique(value), WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); } @@ -55,7 +55,7 @@ bool ServiceProcessPrefs::GetBoolean(const std::string& key, } void ServiceProcessPrefs::SetBoolean(const std::string& key, bool value) { - prefs_->SetValue(key, base::WrapUnique(new base::FundamentalValue(value)), + prefs_->SetValue(key, base::MakeUnique(value), WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); } @@ -70,7 +70,7 @@ int ServiceProcessPrefs::GetInt(const std::string& key, } void ServiceProcessPrefs::SetInt(const std::string& key, int value) { - prefs_->SetValue(key, base::WrapUnique(new base::FundamentalValue(value)), + prefs_->SetValue(key, base::MakeUnique(value), WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); } diff --git a/chrome/test/base/chrome_render_view_test.cc b/chrome/test/base/chrome_render_view_test.cc index 443a55bee86eb3..a6f65e7d1e2de8 100644 --- a/chrome/test/base/chrome_render_view_test.cc +++ b/chrome/test/base/chrome_render_view_test.cc @@ -167,8 +167,9 @@ void ChromeRenderViewTest::InitChromeContentRendererClient( new ChromeExtensionsDispatcherDelegate()); ChromeExtensionsRendererClient* ext_client = ChromeExtensionsRendererClient::GetInstance(); - ext_client->SetExtensionDispatcherForTest(base::WrapUnique( - new extensions::Dispatcher(extension_dispatcher_delegate_.get()))); + ext_client->SetExtensionDispatcherForTest( + base::MakeUnique( + extension_dispatcher_delegate_.get())); #endif #if defined(ENABLE_SPELLCHECK) client->SetSpellcheck(new SpellCheck()); diff --git a/chrome/test/base/test_browser_window.cc b/chrome/test/base/test_browser_window.cc index b8181d4d8347cf..10662e6e311351 100644 --- a/chrome/test/base/test_browser_window.cc +++ b/chrome/test/base/test_browser_window.cc @@ -20,7 +20,7 @@ std::unique_ptr CreateBrowserWithTestWindowForParams( TestBrowserWindow* window = new TestBrowserWindow; new TestBrowserWindowOwner(window); params->window = window; - return base::WrapUnique(new Browser(*params)); + return base::MakeUnique(*params); } } // namespace chrome diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc index 0ea07e7e5ead73..e8ebc0b640ad38 100644 --- a/chrome/test/base/testing_profile.cc +++ b/chrome/test/base/testing_profile.cc @@ -199,10 +199,10 @@ class TestExtensionURLRequestContextGetter std::unique_ptr BuildHistoryService( content::BrowserContext* context) { - return base::WrapUnique(new history::HistoryService( - base::WrapUnique(new ChromeHistoryClient( - BookmarkModelFactory::GetForBrowserContext(context))), - base::WrapUnique(new history::ContentVisitDelegate(context)))); + return base::MakeUnique( + base::MakeUnique( + BookmarkModelFactory::GetForBrowserContext(context)), + base::MakeUnique(context)); } std::unique_ptr BuildInMemoryURLIndex( @@ -223,8 +223,8 @@ std::unique_ptr BuildBookmarkModel( content::BrowserContext* context) { Profile* profile = Profile::FromBrowserContext(context); std::unique_ptr bookmark_model( - new BookmarkModel(base::WrapUnique(new ChromeBookmarkClient( - profile, ManagedBookmarkServiceFactory::GetForProfile(profile))))); + new BookmarkModel(base::MakeUnique( + profile, ManagedBookmarkServiceFactory::GetForProfile(profile)))); bookmark_model->Load(profile->GetPrefs(), profile->GetPath(), profile->GetIOTaskRunner(), content::BrowserThread::GetTaskRunnerForThread( @@ -241,12 +241,12 @@ void TestProfileErrorCallback(WebDataServiceWrapper::ErrorType error_type, std::unique_ptr BuildWebDataService( content::BrowserContext* context) { const base::FilePath& context_path = context->GetPath(); - return base::WrapUnique(new WebDataServiceWrapper( + return base::MakeUnique( context_path, g_browser_process->GetApplicationLocale(), BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), BrowserThread::GetTaskRunnerForThread(BrowserThread::DB), sync_start_util::GetFlareForSyncableService(context_path), - &TestProfileErrorCallback)); + &TestProfileErrorCallback); } #if BUILDFLAG(ANDROID_JAVA_UI) @@ -666,9 +666,9 @@ base::FilePath TestingProfile::GetPath() const { std::unique_ptr TestingProfile::CreateZoomLevelDelegate(const base::FilePath& partition_path) { - return base::WrapUnique(new ChromeZoomLevelPrefs( + return base::MakeUnique( GetPrefs(), GetPath(), partition_path, - zoom::ZoomEventManager::GetForBrowserContext(this)->GetWeakPtr())); + zoom::ZoomEventManager::GetForBrowserContext(this)->GetWeakPtr()); } scoped_refptr TestingProfile::GetIOTaskRunner() { diff --git a/chrome/test/chromedriver/chrome/devtools_client_impl_unittest.cc b/chrome/test/chromedriver/chrome/devtools_client_impl_unittest.cc index a272b31cc4ca59..15753839cd05e6 100644 --- a/chrome/test/chromedriver/chrome/devtools_client_impl_unittest.cc +++ b/chrome/test/chromedriver/chrome/devtools_client_impl_unittest.cc @@ -998,7 +998,7 @@ class MockDevToolsEventListener : public DevToolsEventListener { std::unique_ptr CreateMockSyncWebSocket6( std::list* messages) { - return base::WrapUnique(new MockSyncWebSocket6(messages)); + return base::MakeUnique(messages); } } // namespace diff --git a/chrome/test/chromedriver/commands.cc b/chrome/test/chromedriver/commands.cc index 8a4061b347d019..123b90409a9a55 100644 --- a/chrome/test/chromedriver/commands.cc +++ b/chrome/test/chromedriver/commands.cc @@ -329,7 +329,7 @@ void ExecuteSessionCommand( namespace internal { void CreateSessionOnSessionThreadForTesting(const std::string& id) { - SetThreadLocalSession(base::WrapUnique(new Session(id))); + SetThreadLocalSession(base::MakeUnique(id)); } } // namespace internal diff --git a/chrome/test/chromedriver/net/url_request_context_getter.cc b/chrome/test/chromedriver/net/url_request_context_getter.cc index d9c809d1ee8bc4..21b32a397fee35 100644 --- a/chrome/test/chromedriver/net/url_request_context_getter.cc +++ b/chrome/test/chromedriver/net/url_request_context_getter.cc @@ -24,8 +24,9 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { // net::HttpServer fails to parse headers if user-agent header is blank. builder.set_user_agent("chromedriver"); builder.DisableHttpCache(); - builder.set_proxy_config_service(base::WrapUnique( - new net::ProxyConfigServiceFixed(net::ProxyConfig::CreateDirect()))); + builder.set_proxy_config_service( + base::MakeUnique( + net::ProxyConfig::CreateDirect())); url_request_context_ = builder.Build(); } return url_request_context_.get(); diff --git a/chrome/utility/importer/edge_database_reader_win.cc b/chrome/utility/importer/edge_database_reader_win.cc index dd5d45515a00ac..6a17c4630b6826 100644 --- a/chrome/utility/importer/edge_database_reader_win.cc +++ b/chrome/utility/importer/edge_database_reader_win.cc @@ -256,6 +256,6 @@ EdgeDatabaseReader::OpenTableEnumerator(const base::string16& table_name) { nullptr, 0, JET_bitTableReadOnly, &table_id))) return nullptr; - return base::WrapUnique( - new EdgeDatabaseTableEnumerator(table_name, session_id_, table_id)); + return base::MakeUnique(table_name, session_id_, + table_id); } diff --git a/chrome/utility/safe_browsing/mac/hfs.cc b/chrome/utility/safe_browsing/mac/hfs.cc index aab64c890c4351..fd2f75337e4e23 100644 --- a/chrome/utility/safe_browsing/mac/hfs.cc +++ b/chrome/utility/safe_browsing/mac/hfs.cc @@ -310,8 +310,8 @@ std::unique_ptr HFSIterator::GetReadStream() { return nullptr; DCHECK_EQ(kHFSPlusFileRecord, catalog_->current_record()->record_type); - return base::WrapUnique( - new HFSForkReadStream(this, catalog_->current_record()->file->dataFork)); + return base::MakeUnique( + this, catalog_->current_record()->file->dataFork); } bool HFSIterator::SeekToBlock(uint64_t block) { diff --git a/chrome/utility/safe_browsing/mac/udif.cc b/chrome/utility/safe_browsing/mac/udif.cc index 22d66c0453dd1a..df7406c5aa16ac 100644 --- a/chrome/utility/safe_browsing/mac/udif.cc +++ b/chrome/utility/safe_browsing/mac/udif.cc @@ -402,8 +402,8 @@ size_t UDIFParser::GetPartitionSize(size_t part_number) { std::unique_ptr UDIFParser::GetPartitionReadStream( size_t part_number) { DCHECK_LT(part_number, blocks_.size()); - return base::WrapUnique( - new UDIFPartitionReadStream(stream_, block_size_, blocks_[part_number])); + return base::MakeUnique(stream_, block_size_, + blocks_[part_number]); } bool UDIFParser::ParseBlkx() {