Merge pull request #12601 from electron/makeunique-replace

Replace base::MakeUnique with std::make_unique
This commit is contained in:
Shelley Vohr 2018-04-13 08:19:26 -04:00 коммит произвёл GitHub
Родитель 97fb15ac49 d722008367
Коммит 9e5c264012
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
28 изменённых файлов: 50 добавлений и 70 удалений

Просмотреть файл

@ -602,7 +602,7 @@ void Session::EnableNetworkEmulation(const mate::Dictionary& options) {
} }
void Session::DisableNetworkEmulation() { void Session::DisableNetworkEmulation() {
auto conditions = base::MakeUnique<content::DevToolsNetworkConditions>(); auto conditions = std::make_unique<content::DevToolsNetworkConditions>();
content::DevToolsNetworkController::SetNetworkState( content::DevToolsNetworkController::SetNetworkState(
devtools_network_emulation_client_id_, std::move(conditions)); devtools_network_emulation_client_id_, std::move(conditions));
BrowserThread::PostTask( BrowserThread::PostTask(

Просмотреть файл

@ -6,7 +6,6 @@
#include "atom/browser/atom_browser_main_parts.h" #include "atom/browser/atom_browser_main_parts.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/memory/ptr_util.h"
#include "base/supports_user_data.h" #include "base/supports_user_data.h"
namespace mate { namespace mate {
@ -49,7 +48,7 @@ void TrackableObjectBase::Destroy() {
void TrackableObjectBase::AttachAsUserData(base::SupportsUserData* wrapped) { void TrackableObjectBase::AttachAsUserData(base::SupportsUserData* wrapped) {
wrapped->SetUserData(kTrackedObjectKey, wrapped->SetUserData(kTrackedObjectKey,
base::MakeUnique<IDUserData>(weak_map_id_)); std::make_unique<IDUserData>(weak_map_id_));
} }
// static // static

Просмотреть файл

@ -111,7 +111,7 @@ AtomBrowserContext::RegisterCookieChangeCallback(
std::unique_ptr<net::NetworkDelegate> std::unique_ptr<net::NetworkDelegate>
AtomBrowserContext::CreateNetworkDelegate() { AtomBrowserContext::CreateNetworkDelegate() {
return base::MakeUnique<AtomNetworkDelegate>(); return std::make_unique<AtomNetworkDelegate>();
} }
std::string AtomBrowserContext::GetUserAgent() { std::string AtomBrowserContext::GetUserAgent() {

Просмотреть файл

@ -162,7 +162,7 @@ int AtomPermissionManager::RequestPermissionsWithDetails(
auto web_contents = auto web_contents =
content::WebContents::FromRenderFrameHost(render_frame_host); content::WebContents::FromRenderFrameHost(render_frame_host);
int request_id = pending_requests_.Add(base::MakeUnique<PendingRequest>( int request_id = pending_requests_.Add(std::make_unique<PendingRequest>(
render_frame_host, permissions, response_callback)); render_frame_host, permissions, response_callback));
for (size_t i = 0; i < permissions.size(); ++i) { for (size_t i = 0; i < permissions.size(); ++i) {

Просмотреть файл

@ -15,7 +15,6 @@
#include "atom/browser/web_dialog_helper.h" #include "atom/browser/web_dialog_helper.h"
#include "atom/common/atom_constants.h" #include "atom/common/atom_constants.h"
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "base/memory/ptr_util.h"
#include "chrome/browser/printing/print_preview_message_handler.h" #include "chrome/browser/printing/print_preview_message_handler.h"
#include "chrome/browser/printing/print_view_manager_basic.h" #include "chrome/browser/printing/print_view_manager_basic.h"
#include "chrome/browser/ssl/security_state_tab_helper.h" #include "chrome/browser/ssl/security_state_tab_helper.h"
@ -186,7 +185,7 @@ void CommonWebContentsDelegate::SetOwnerWindow(NativeWindow* owner_window) {
void CommonWebContentsDelegate::SetOwnerWindow( void CommonWebContentsDelegate::SetOwnerWindow(
content::WebContents* web_contents, NativeWindow* owner_window) { content::WebContents* web_contents, NativeWindow* owner_window) {
owner_window_ = owner_window ? owner_window->GetWeakPtr() : nullptr; owner_window_ = owner_window ? owner_window->GetWeakPtr() : nullptr;
auto relay = base::MakeUnique<NativeWindowRelay>(owner_window_); auto relay = std::make_unique<NativeWindowRelay>(owner_window_);
auto relay_key = relay->key; auto relay_key = relay->key;
if (owner_window) { if (owner_window) {
#if defined(TOOLKIT_VIEWS) #if defined(TOOLKIT_VIEWS)
@ -397,7 +396,7 @@ void CommonWebContentsDelegate::DevToolsAddFileSystem(
auto pref_service = GetPrefService(GetDevToolsWebContents()); auto pref_service = GetPrefService(GetDevToolsWebContents());
DictionaryPrefUpdate update(pref_service, prefs::kDevToolsFileSystemPaths); DictionaryPrefUpdate update(pref_service, prefs::kDevToolsFileSystemPaths);
update.Get()->SetWithoutPathExpansion( update.Get()->SetWithoutPathExpansion(
path.AsUTF8Unsafe(), base::MakeUnique<base::Value>()); path.AsUTF8Unsafe(), std::make_unique<base::Value>());
web_contents_->CallClientFunction("DevToolsAPI.fileSystemAdded", web_contents_->CallClientFunction("DevToolsAPI.fileSystemAdded",
file_system_value.get(), file_system_value.get(),

Просмотреть файл

@ -5,7 +5,6 @@
#include "atom/browser/mac/dict_util.h" #include "atom/browser/mac/dict_util.h"
#include "base/json/json_writer.h" #include "base/json/json_writer.h"
#include "base/memory/ptr_util.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "base/values.h" #include "base/values.h"
@ -46,14 +45,14 @@ std::unique_ptr<base::ListValue> NSArrayToListValue(NSArray* arr) {
if (sub_arr) if (sub_arr)
result->Append(std::move(sub_arr)); result->Append(std::move(sub_arr));
else else
result->Append(base::MakeUnique<base::Value>()); result->Append(std::make_unique<base::Value>());
} else if ([value isKindOfClass:[NSDictionary class]]) { } else if ([value isKindOfClass:[NSDictionary class]]) {
std::unique_ptr<base::DictionaryValue> sub_dict = std::unique_ptr<base::DictionaryValue> sub_dict =
NSDictionaryToDictionaryValue(value); NSDictionaryToDictionaryValue(value);
if (sub_dict) if (sub_dict)
result->Append(std::move(sub_dict)); result->Append(std::move(sub_dict));
else else
result->Append(base::MakeUnique<base::Value>()); result->Append(std::make_unique<base::Value>());
} else { } else {
result->AppendString(base::SysNSStringToUTF8([value description])); result->AppendString(base::SysNSStringToUTF8([value description]));
} }
@ -104,7 +103,7 @@ std::unique_ptr<base::DictionaryValue> NSDictionaryToDictionaryValue(
result->SetWithoutPathExpansion(str_key, std::move(sub_arr)); result->SetWithoutPathExpansion(str_key, std::move(sub_arr));
else else
result->SetWithoutPathExpansion(str_key, result->SetWithoutPathExpansion(str_key,
base::MakeUnique<base::Value>()); std::make_unique<base::Value>());
} else if ([value isKindOfClass:[NSDictionary class]]) { } else if ([value isKindOfClass:[NSDictionary class]]) {
std::unique_ptr<base::DictionaryValue> sub_dict = std::unique_ptr<base::DictionaryValue> sub_dict =
NSDictionaryToDictionaryValue(value); NSDictionaryToDictionaryValue(value);
@ -112,7 +111,7 @@ std::unique_ptr<base::DictionaryValue> NSDictionaryToDictionaryValue(
result->SetWithoutPathExpansion(str_key, std::move(sub_dict)); result->SetWithoutPathExpansion(str_key, std::move(sub_dict));
else else
result->SetWithoutPathExpansion(str_key, result->SetWithoutPathExpansion(str_key,
base::MakeUnique<base::Value>()); std::make_unique<base::Value>());
} else { } else {
result->SetKey(str_key, result->SetKey(str_key,
base::Value(base::SysNSStringToUTF8([value description]))); base::Value(base::SysNSStringToUTF8([value description])));

Просмотреть файл

@ -7,7 +7,6 @@
#include "atom/browser/browser.h" #include "atom/browser/browser.h"
#include "atom/common/native_mate_converters/net_converter.h" #include "atom/common/native_mate_converters/net_converter.h"
#include "base/containers/linked_list.h" #include "base/containers/linked_list.h"
#include "base/memory/ptr_util.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "brightray/browser/net/require_ct_delegate.h" #include "brightray/browser/net/require_ct_delegate.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
@ -177,7 +176,7 @@ int AtomCertVerifier::Verify(
if (!request) { if (!request) {
out_req->reset(); out_req->reset();
std::unique_ptr<CertVerifierRequest> new_request = std::unique_ptr<CertVerifierRequest> new_request =
base::MakeUnique<CertVerifierRequest>(params, this); std::make_unique<CertVerifierRequest>(params, this);
new_request->Start(crl_set, net_log); new_request->Start(crl_set, net_log);
request = new_request.get(); request = new_request.get();
*out_req = std::move(new_request); *out_req = std::move(new_request);

Просмотреть файл

@ -290,7 +290,7 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
DCHECK(render_widget_host_); DCHECK(render_widget_host_);
bool is_guest_view_hack = parent_host_view_ != nullptr; bool is_guest_view_hack = parent_host_view_ != nullptr;
#if !defined(OS_MACOSX) #if !defined(OS_MACOSX)
delegated_frame_host_ = base::MakeUnique<content::DelegatedFrameHost>( delegated_frame_host_ = std::make_unique<content::DelegatedFrameHost>(
AllocateFrameSinkId(is_guest_view_hack), this, AllocateFrameSinkId(is_guest_view_hack), this,
false /* enable_surface_synchronization */); false /* enable_surface_synchronization */);
@ -788,7 +788,7 @@ std::unique_ptr<content::CompositorResizeLock>
OffScreenRenderWidgetHostView::DelegatedFrameHostCreateResizeLock() { OffScreenRenderWidgetHostView::DelegatedFrameHostCreateResizeLock() {
HoldResize(); HoldResize();
const gfx::Size& desired_size = GetRootLayer()->bounds().size(); const gfx::Size& desired_size = GetRootLayer()->bounds().size();
return base::MakeUnique<content::CompositorResizeLock>(this, desired_size); return std::make_unique<content::CompositorResizeLock>(this, desired_size);
} }
viz::LocalSurfaceId OffScreenRenderWidgetHostView::GetLocalSurfaceId() const { viz::LocalSurfaceId OffScreenRenderWidgetHostView::GetLocalSurfaceId() const {
@ -897,7 +897,7 @@ void OffScreenRenderWidgetHostView::ProxyViewDestroyed(
void OffScreenRenderWidgetHostView::RegisterGuestViewFrameSwappedCallback( void OffScreenRenderWidgetHostView::RegisterGuestViewFrameSwappedCallback(
content::RenderWidgetHostViewGuest* guest_host_view) { content::RenderWidgetHostViewGuest* guest_host_view) {
guest_host_view->RegisterFrameSwappedCallback(base::MakeUnique<base::Closure>( guest_host_view->RegisterFrameSwappedCallback(std::make_unique<base::Closure>(
base::Bind(&OffScreenRenderWidgetHostView::OnGuestViewFrameSwapped, base::Bind(&OffScreenRenderWidgetHostView::OnGuestViewFrameSwapped,
weak_ptr_factory_.GetWeakPtr(), weak_ptr_factory_.GetWeakPtr(),
base::Unretained(guest_host_view)))); base::Unretained(guest_host_view))));

Просмотреть файл

@ -6,7 +6,6 @@
#include "atom/common/atom_constants.h" #include "atom/common/atom_constants.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/memory/ptr_util.h"
#include "base/values.h" #include "base/values.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "content/public/browser/stream_handle.h" #include "content/public/browser/stream_handle.h"
@ -45,7 +44,7 @@ void CreateResponseHeadersDictionary(const net::HttpResponseHeaders* headers,
void PopulateStreamInfo(base::DictionaryValue* stream_info, void PopulateStreamInfo(base::DictionaryValue* stream_info,
content::StreamInfo* stream, content::StreamInfo* stream,
const std::string& original_url) { const std::string& original_url) {
auto headers_dict = base::MakeUnique<base::DictionaryValue>(); auto headers_dict = std::make_unique<base::DictionaryValue>();
auto stream_url = stream->handle->GetURL().spec(); auto stream_url = stream->handle->GetURL().spec();
CreateResponseHeadersDictionary(stream->response_headers.get(), CreateResponseHeadersDictionary(stream->response_headers.get(),
headers_dict.get()); headers_dict.get());
@ -66,7 +65,7 @@ PdfViewerHandler::~PdfViewerHandler() {
void PdfViewerHandler::SetPdfResourceStream(content::StreamInfo* stream) { void PdfViewerHandler::SetPdfResourceStream(content::StreamInfo* stream) {
stream_ = stream; stream_ = stream;
if (!!initialize_callback_id_.get()) { if (!!initialize_callback_id_.get()) {
auto list = base::MakeUnique<base::ListValue>(); auto list = std::make_unique<base::ListValue>();
list->Set(0, std::move(initialize_callback_id_)); list->Set(0, std::move(initialize_callback_id_));
Initialize(list.get()); Initialize(list.get());
} }
@ -109,7 +108,7 @@ void PdfViewerHandler::Initialize(const base::ListValue* args) {
CHECK(!initialize_callback_id_.get()); CHECK(!initialize_callback_id_.get());
AllowJavascript(); AllowJavascript();
auto stream_info = base::MakeUnique<base::DictionaryValue>(); auto stream_info = std::make_unique<base::DictionaryValue>();
PopulateStreamInfo(stream_info.get(), stream_, original_url_); PopulateStreamInfo(stream_info.get(), stream_, original_url_);
ResolveJavascriptCallback(*callback_id, *stream_info); ResolveJavascriptCallback(*callback_id, *stream_info);
} else { } else {
@ -174,7 +173,7 @@ void PdfViewerHandler::GetStrings(const base::ListValue* args) {
const base::Value* callback_id; const base::Value* callback_id;
CHECK(args->Get(0, &callback_id)); CHECK(args->Get(0, &callback_id));
auto result = base::MakeUnique<base::DictionaryValue>(); auto result = std::make_unique<base::DictionaryValue>();
// TODO(deepak1556): Generate strings from components/pdf_strings.grdp. // TODO(deepak1556): Generate strings from components/pdf_strings.grdp.
#define SET_STRING(id, resource) result->SetString(id, resource) #define SET_STRING(id, resource) result->SetString(id, resource)
SET_STRING("passwordPrompt", SET_STRING("passwordPrompt",

Просмотреть файл

@ -145,7 +145,7 @@ class PdfViewerUI::ResourceRequester
content::GetStreamContextForResourceContext(resource_context); content::GetStreamContextForResourceContext(resource_context);
std::unique_ptr<content::ResourceHandler> handler = std::unique_ptr<content::ResourceHandler> handler =
base::MakeUnique<content::StreamResourceHandler>( std::make_unique<content::StreamResourceHandler>(
request.get(), stream_context->registry(), origin, false); request.get(), stream_context->registry(), origin, false);
info->set_is_stream(true); info->set_is_stream(true);
stream_info_.reset(new content::StreamInfo); stream_info_.reset(new content::StreamInfo);

Просмотреть файл

@ -10,7 +10,6 @@
#include <utility> #include <utility>
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/values.h" #include "base/values.h"
#include "native_mate/dictionary.h" #include "native_mate/dictionary.h"
@ -309,10 +308,10 @@ base::Value* V8ValueConverter::FromV8ValueImpl(
return nullptr; return nullptr;
if (val->IsExternal()) if (val->IsExternal())
return base::MakeUnique<base::Value>().release(); return std::make_unique<base::Value>().release();
if (val->IsNull()) if (val->IsNull())
return base::MakeUnique<base::Value>().release(); return std::make_unique<base::Value>().release();
if (val->IsBoolean()) if (val->IsBoolean())
return new base::Value(val->ToBoolean()->Value()); return new base::Value(val->ToBoolean()->Value());
@ -386,7 +385,7 @@ base::Value* V8ValueConverter::FromV8Array(
v8::Isolate* isolate) const { v8::Isolate* isolate) const {
ScopedUniquenessGuard uniqueness_guard(state, val); ScopedUniquenessGuard uniqueness_guard(state, val);
if (!uniqueness_guard.is_valid()) if (!uniqueness_guard.is_valid())
return base::MakeUnique<base::Value>().release(); return std::make_unique<base::Value>().release();
std::unique_ptr<v8::Context::Scope> scope; std::unique_ptr<v8::Context::Scope> scope;
// If val was created in a different context than our current one, change to // If val was created in a different context than our current one, change to
@ -415,7 +414,7 @@ base::Value* V8ValueConverter::FromV8Array(
else else
// JSON.stringify puts null in places where values don't serialize, for // JSON.stringify puts null in places where values don't serialize, for
// example undefined and functions. Emulate that behavior. // example undefined and functions. Emulate that behavior.
result->Append(base::MakeUnique<base::Value>()); result->Append(std::make_unique<base::Value>());
} }
return result; return result;
} }
@ -434,7 +433,7 @@ base::Value* V8ValueConverter::FromV8Object(
v8::Isolate* isolate) const { v8::Isolate* isolate) const {
ScopedUniquenessGuard uniqueness_guard(state, val); ScopedUniquenessGuard uniqueness_guard(state, val);
if (!uniqueness_guard.is_valid()) if (!uniqueness_guard.is_valid())
return base::MakeUnique<base::Value>().release(); return std::make_unique<base::Value>().release();
std::unique_ptr<v8::Context::Scope> scope; std::unique_ptr<v8::Context::Scope> scope;
// If val was created in a different context than our current one, change to // If val was created in a different context than our current one, change to

Просмотреть файл

@ -17,7 +17,6 @@
#include "atom/renderer/guest_view_container.h" #include "atom/renderer/guest_view_container.h"
#include "atom/renderer/preferences_manager.h" #include "atom/renderer/preferences_manager.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/memory/ptr_util.h"
#include "base/strings/string_split.h" #include "base/strings/string_split.h"
#include "chrome/renderer/media/chrome_key_systems.h" #include "chrome/renderer/media/chrome_key_systems.h"
#include "chrome/renderer/pepper/pepper_helper.h" #include "chrome/renderer/pepper/pepper_helper.h"
@ -190,7 +189,7 @@ void RendererClientBase::DidClearWindowObject(
std::unique_ptr<blink::WebSpeechSynthesizer> std::unique_ptr<blink::WebSpeechSynthesizer>
RendererClientBase::OverrideSpeechSynthesizer( RendererClientBase::OverrideSpeechSynthesizer(
blink::WebSpeechSynthesizerClient* client) { blink::WebSpeechSynthesizerClient* client) {
return base::MakeUnique<TtsDispatcher>(client); return std::make_unique<TtsDispatcher>(client);
} }
bool RendererClientBase::OverrideCreatePlugin( bool RendererClientBase::OverrideCreatePlugin(

Просмотреть файл

@ -5,7 +5,6 @@
#include "atom/utility/atom_content_utility_client.h" #include "atom/utility/atom_content_utility_client.h"
#if defined(OS_WIN) #if defined(OS_WIN)
#include "base/memory/ptr_util.h"
#include "chrome/utility/printing_handler_win.h" #include "chrome/utility/printing_handler_win.h"
#endif #endif
@ -13,7 +12,7 @@ namespace atom {
AtomContentUtilityClient::AtomContentUtilityClient() { AtomContentUtilityClient::AtomContentUtilityClient() {
#if defined(OS_WIN) #if defined(OS_WIN)
handlers_.push_back(base::MakeUnique<printing::PrintingHandlerWin>()); handlers_.push_back(std::make_unique<printing::PrintingHandlerWin>());
#endif #endif
} }

Просмотреть файл

@ -149,7 +149,7 @@ net::URLRequestContextGetter* BrowserContext::CreateRequestContext(
} }
std::unique_ptr<net::NetworkDelegate> BrowserContext::CreateNetworkDelegate() { std::unique_ptr<net::NetworkDelegate> BrowserContext::CreateNetworkDelegate() {
return base::MakeUnique<NetworkDelegate>(); return std::make_unique<NetworkDelegate>();
} }
std::string BrowserContext::GetMediaDeviceIDSalt() { std::string BrowserContext::GetMediaDeviceIDSalt() {
@ -165,7 +165,7 @@ base::FilePath BrowserContext::GetPath() const {
std::unique_ptr<content::ZoomLevelDelegate> std::unique_ptr<content::ZoomLevelDelegate>
BrowserContext::CreateZoomLevelDelegate(const base::FilePath& partition_path) { BrowserContext::CreateZoomLevelDelegate(const base::FilePath& partition_path) {
if (!IsOffTheRecord()) { if (!IsOffTheRecord()) {
return base::MakeUnique<ZoomLevelDelegate>(prefs(), partition_path); return std::make_unique<ZoomLevelDelegate>(prefs(), partition_path);
} }
return std::unique_ptr<content::ZoomLevelDelegate>(); return std::unique_ptr<content::ZoomLevelDelegate>();
} }

Просмотреть файл

@ -307,7 +307,7 @@ int BrowserMainParts::PreCreateThreads() {
l10n_util::GetApplicationLocale(custom_locale_)); l10n_util::GetApplicationLocale(custom_locale_));
// Manage global state of net and other IO thread related. // Manage global state of net and other IO thread related.
io_thread_ = base::MakeUnique<IOThread>(); io_thread_ = std::make_unique<IOThread>();
return 0; return 0;
} }

Просмотреть файл

@ -10,7 +10,6 @@
#include "base/guid.h" #include "base/guid.h"
#include "base/json/json_reader.h" #include "base/json/json_reader.h"
#include "base/json/json_writer.h" #include "base/json/json_writer.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram.h" #include "base/metrics/histogram.h"
#include "base/strings/pattern.h" #include "base/strings/pattern.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
@ -828,7 +827,7 @@ void InspectableWebContentsImpl::OnURLFetchComplete(
response.SetInteger("statusCode", rh ? rh->response_code() : 200); response.SetInteger("statusCode", rh ? rh->response_code() : 200);
{ {
auto headers = base::MakeUnique<base::DictionaryValue>(); auto headers = std::make_unique<base::DictionaryValue>();
size_t iterator = 0; size_t iterator = 0;
std::string name; std::string name;

Просмотреть файл

@ -9,7 +9,6 @@
#include "base/callback.h" #include "base/callback.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/memory/ptr_util.h"
#include "base/values.h" #include "base/values.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "net/log/file_net_log_observer.h" #include "net/log/file_net_log_observer.h"
@ -23,7 +22,7 @@ std::unique_ptr<base::DictionaryValue> GetConstants() {
std::unique_ptr<base::DictionaryValue> constants = net::GetNetConstants(); std::unique_ptr<base::DictionaryValue> constants = net::GetNetConstants();
// Adding client information to constants dictionary. // Adding client information to constants dictionary.
auto client_info = base::MakeUnique<base::DictionaryValue>(); auto client_info = std::make_unique<base::DictionaryValue>();
client_info->SetString( client_info->SetString(
"command_line", "command_line",
base::CommandLine::ForCurrentProcess()->GetCommandLineString()); base::CommandLine::ForCurrentProcess()->GetCommandLineString());

Просмотреть файл

@ -220,7 +220,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
url_request_context_->cookie_store()->AddCallbackForAllChanges( url_request_context_->cookie_store()->AddCallbackForAllChanges(
base::Bind(&URLRequestContextGetter::OnCookieChanged, this)); base::Bind(&URLRequestContextGetter::OnCookieChanged, this));
storage_->set_channel_id_service(base::MakeUnique<net::ChannelIDService>( storage_->set_channel_id_service(std::make_unique<net::ChannelIDService>(
new net::DefaultChannelIDStore(nullptr))); new net::DefaultChannelIDStore(nullptr)));
storage_->set_http_user_agent_settings( storage_->set_http_user_agent_settings(
@ -306,10 +306,10 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
storage_->set_http_server_properties(std::move(server_properties)); storage_->set_http_server_properties(std::move(server_properties));
std::unique_ptr<net::MultiLogCTVerifier> ct_verifier = std::unique_ptr<net::MultiLogCTVerifier> ct_verifier =
base::MakeUnique<net::MultiLogCTVerifier>(); std::make_unique<net::MultiLogCTVerifier>();
ct_verifier->AddLogs(net::ct::CreateLogVerifiersForKnownLogs()); ct_verifier->AddLogs(net::ct::CreateLogVerifiersForKnownLogs());
storage_->set_cert_transparency_verifier(std::move(ct_verifier)); storage_->set_cert_transparency_verifier(std::move(ct_verifier));
storage_->set_ct_policy_enforcer(base::MakeUnique<net::CTPolicyEnforcer>()); storage_->set_ct_policy_enforcer(std::make_unique<net::CTPolicyEnforcer>());
net::HttpNetworkSession::Params network_session_params; net::HttpNetworkSession::Params network_session_params;
network_session_params.ignore_certificate_errors = false; network_session_params.ignore_certificate_errors = false;
@ -346,7 +346,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
backend.reset(delegate_->CreateHttpCacheBackendFactory(base_path_)); backend.reset(delegate_->CreateHttpCacheBackendFactory(base_path_));
} }
storage_->set_http_transaction_factory(base::MakeUnique<net::HttpCache>( storage_->set_http_transaction_factory(std::make_unique<net::HttpCache>(
content::CreateDevToolsNetworkTransactionFactory( content::CreateDevToolsNetworkTransactionFactory(
http_network_session_.get()), http_network_session_.get()),
std::move(backend), false)); std::move(backend), false));

Просмотреть файл

@ -8,7 +8,6 @@
#include <vector> #include <vector>
#include "base/bind.h" #include "base/bind.h"
#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/values.h" #include "base/values.h"
#include "components/prefs/json_pref_store.h" #include "components/prefs/json_pref_store.h"
@ -89,7 +88,7 @@ void ZoomLevelDelegate::OnZoomLevelChanged(
if (!host_zoom_dictionaries->GetDictionary(partition_key_, if (!host_zoom_dictionaries->GetDictionary(partition_key_,
&host_zoom_dictionary)) { &host_zoom_dictionary)) {
host_zoom_dictionary = host_zoom_dictionaries->SetDictionary( host_zoom_dictionary = host_zoom_dictionaries->SetDictionary(
partition_key_, base::MakeUnique<base::DictionaryValue>()); partition_key_, std::make_unique<base::DictionaryValue>());
} }
if (modification_is_removal) if (modification_is_removal)

Просмотреть файл

@ -5,7 +5,6 @@
#include "chrome/browser/icon_loader.h" #include "chrome/browser/icon_loader.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/nix/mime_util_xdg.h" #include "base/nix/mime_util_xdg.h"
#include "ui/views/linux_ui/linux_ui.h" #include "ui/views/linux_ui/linux_ui.h"
@ -44,7 +43,7 @@ void IconLoader::ReadIcon() {
views::LinuxUI* ui = views::LinuxUI::instance(); views::LinuxUI* ui = views::LinuxUI::instance();
if (ui) { if (ui) {
image = base::MakeUnique<gfx::Image>( image = std::make_unique<gfx::Image>(
ui->GetIconForContentType(group_, size_pixels)); ui->GetIconForContentType(group_, size_pixels));
if (image->IsEmpty()) if (image->IsEmpty())
image = nullptr; image = nullptr;

Просмотреть файл

@ -8,7 +8,6 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "base/task_scheduler/post_task.h" #include "base/task_scheduler/post_task.h"
@ -37,7 +36,7 @@ void IconLoader::ReadIcon() {
if (icon_size_ == ALL) { if (icon_size_ == ALL) {
// The NSImage already has all sizes. // The NSImage already has all sizes.
image = base::MakeUnique<gfx::Image>([icon retain]); image = std::make_unique<gfx::Image>([icon retain]);
} else { } else {
NSSize size = NSZeroSize; NSSize size = NSZeroSize;
switch (icon_size_) { switch (icon_size_) {
@ -53,7 +52,7 @@ void IconLoader::ReadIcon() {
gfx::ImageSkia image_skia(gfx::ImageSkiaFromResizedNSImage(icon, size)); gfx::ImageSkia image_skia(gfx::ImageSkiaFromResizedNSImage(icon, size));
if (!image_skia.isNull()) { if (!image_skia.isNull()) {
image_skia.MakeThreadSafe(); image_skia.MakeThreadSafe();
image = base::MakeUnique<gfx::Image>(image_skia); image = std::make_unique<gfx::Image>(image_skia);
} }
} }

Просмотреть файл

@ -8,7 +8,6 @@
#include <shellapi.h> #include <shellapi.h>
#include "base/bind.h" #include "base/bind.h"
#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/task_scheduler/post_task.h" #include "base/task_scheduler/post_task.h"
#include "base/threading/thread.h" #include "base/threading/thread.h"
@ -65,7 +64,7 @@ void IconLoader::ReadIcon() {
gfx::ImageSkia image_skia(gfx::ImageSkiaRep(*bitmap, gfx::ImageSkia image_skia(gfx::ImageSkiaRep(*bitmap,
display::win::GetDPIScale())); display::win::GetDPIScale()));
image_skia.MakeThreadSafe(); image_skia.MakeThreadSafe();
image = base::MakeUnique<gfx::Image>(image_skia); image = std::make_unique<gfx::Image>(image_skia);
DestroyIcon(file_info.hIcon); DestroyIcon(file_info.hIcon);
} }
} }

Просмотреть файл

@ -17,7 +17,6 @@
#include "base/files/scoped_temp_dir.h" #include "base/files/scoped_temp_dir.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "chrome/common/chrome_utility_printing_messages.h" #include "chrome/common/chrome_utility_printing_messages.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
@ -228,10 +227,10 @@ PdfConverterUtilityProcessHostClient::GetFileFromTemp(
temp_file) { temp_file) {
if (settings_.mode == PdfRenderSettings::Mode::POSTSCRIPT_LEVEL2 || if (settings_.mode == PdfRenderSettings::Mode::POSTSCRIPT_LEVEL2 ||
settings_.mode == PdfRenderSettings::Mode::POSTSCRIPT_LEVEL3) { settings_.mode == PdfRenderSettings::Mode::POSTSCRIPT_LEVEL3) {
return base::MakeUnique<PostScriptMetaFile>(temp_dir_, return std::make_unique<PostScriptMetaFile>(temp_dir_,
std::move(temp_file)); std::move(temp_file));
} }
return base::MakeUnique<LazyEmf>(temp_dir_, std::move(temp_file)); return std::make_unique<LazyEmf>(temp_dir_, std::move(temp_file));
} }
class PdfConverterImpl : public PdfConverter { class PdfConverterImpl : public PdfConverter {
@ -632,7 +631,7 @@ std::unique_ptr<PdfConverter> PdfConverter::StartPdfConverter(
const PdfRenderSettings& conversion_settings, const PdfRenderSettings& conversion_settings,
const StartCallback& start_callback) { const StartCallback& start_callback) {
std::unique_ptr<PdfConverterImpl> converter = std::unique_ptr<PdfConverterImpl> converter =
base::MakeUnique<PdfConverterImpl>(); std::make_unique<PdfConverterImpl>();
converter->Start( converter->Start(
new PdfConverterUtilityProcessHostClient(converter->GetWeakPtr(), new PdfConverterUtilityProcessHostClient(converter->GetWeakPtr(),
conversion_settings), conversion_settings),

Просмотреть файл

@ -10,7 +10,6 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/bind_helpers.h" #include "base/bind_helpers.h"
#include "base/location.h" #include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/task_scheduler/post_task.h" #include "base/task_scheduler/post_task.h"
@ -267,7 +266,7 @@ void PrintJob::StartPdfToEmfConversion(
bool print_text_with_gdi) { bool print_text_with_gdi) {
DCHECK(!pdf_conversion_state_); DCHECK(!pdf_conversion_state_);
pdf_conversion_state_ = pdf_conversion_state_ =
base::MakeUnique<PdfConversionState>(page_size, content_area); std::make_unique<PdfConversionState>(page_size, content_area);
const int kPrinterDpi = settings().dpi(); const int kPrinterDpi = settings().dpi();
PdfRenderSettings settings( PdfRenderSettings settings(
content_area, gfx::Point(0, 0), kPrinterDpi, /*autorotate=*/true, content_area, gfx::Point(0, 0), kPrinterDpi, /*autorotate=*/true,
@ -314,7 +313,7 @@ void PrintJob::StartPdfToPostScriptConversion(
const gfx::Point& physical_offsets, const gfx::Point& physical_offsets,
bool ps_level2) { bool ps_level2) {
DCHECK(!pdf_conversion_state_); DCHECK(!pdf_conversion_state_);
pdf_conversion_state_ = base::MakeUnique<PdfConversionState>( pdf_conversion_state_ = std::make_unique<PdfConversionState>(
gfx::Size(), gfx::Rect()); gfx::Size(), gfx::Rect());
const int kPrinterDpi = settings().dpi(); const int kPrinterDpi = settings().dpi();
PdfRenderSettings settings( PdfRenderSettings settings(

Просмотреть файл

@ -11,7 +11,6 @@
#include "base/callback.h" #include "base/callback.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/location.h" #include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
@ -99,7 +98,7 @@ void PrintSettingsToJobSettings(const PrintSettings& settings,
// range // range
if (!settings.ranges().empty()) { if (!settings.ranges().empty()) {
auto page_range_array = base::MakeUnique<base::ListValue>(); auto page_range_array = std::make_unique<base::ListValue>();
job_settings->Set(kSettingPageRange, std::move(page_range_array)); job_settings->Set(kSettingPageRange, std::move(page_range_array));
for (size_t i = 0; i < settings.ranges().size(); ++i) { for (size_t i = 0; i < settings.ranges().size(); ++i) {
std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue); std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
@ -200,7 +199,7 @@ PrintJobWorker::PrintJobWorker(int render_process_id,
// The object is created in the IO thread. // The object is created in the IO thread.
DCHECK(owner_->RunsTasksInCurrentSequence()); DCHECK(owner_->RunsTasksInCurrentSequence());
printing_context_delegate_ = base::MakeUnique<PrintingContextDelegate>( printing_context_delegate_ = std::make_unique<PrintingContextDelegate>(
render_process_id, render_frame_id); render_process_id, render_frame_id);
printing_context_ = PrintingContext::Create(printing_context_delegate_.get()); printing_context_ = PrintingContext::Create(printing_context_delegate_.get());
} }

Просмотреть файл

@ -8,7 +8,6 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/memory/ref_counted_memory.h" #include "base/memory/ref_counted_memory.h"
#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
@ -73,7 +72,7 @@ bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh,
int32_t id = rfh->GetRoutingID(); int32_t id = rfh->GetRoutingID();
return PrintNowInternal( return PrintNowInternal(
rfh, rfh,
base::MakeUnique<PrintMsg_PrintPages>(id, silent, print_background, device_name)); std::make_unique<PrintMsg_PrintPages>(id, silent, print_background, device_name));
} }
#endif // !DISABLE_BASIC_PRINTING #endif // !DISABLE_BASIC_PRINTING

Просмотреть файл

@ -67,7 +67,6 @@
#include "base/location.h" #include "base/location.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
@ -585,7 +584,7 @@ void ProcessSingleton::LinuxWatcher::OnSocketCanReadWithoutBlocking(
DCHECK(base::SetNonBlocking(connection_socket)) DCHECK(base::SetNonBlocking(connection_socket))
<< "Failed to make non-blocking socket."; << "Failed to make non-blocking socket.";
readers_.insert( readers_.insert(
base::MakeUnique<SocketReader>(this, ui_task_runner_, connection_socket)); std::make_unique<SocketReader>(this, ui_task_runner_, connection_socket));
} }
void ProcessSingleton::LinuxWatcher::StartListening(int socket) { void ProcessSingleton::LinuxWatcher::StartListening(int socket) {

Просмотреть файл

@ -17,7 +17,6 @@
#include "ppapi/shared_impl/ppapi_permissions.h" #include "ppapi/shared_impl/ppapi_permissions.h"
#if defined(ENABLE_PDF_VIEWER) #if defined(ENABLE_PDF_VIEWER)
#include "base/memory/ptr_util.h"
#include "components/pdf/renderer/pepper_pdf_host.h" #include "components/pdf/renderer/pepper_pdf_host.h"
#endif // defined(ENABLE_PDF_VIEWER) #endif // defined(ENABLE_PDF_VIEWER)
@ -89,7 +88,7 @@ std::unique_ptr<ResourceHost> ChromeRendererPepperHostFactory::CreateResourceHos
ppapi::PERMISSION_PRIVATE)) { ppapi::PERMISSION_PRIVATE)) {
switch (message.type()) { switch (message.type()) {
case PpapiHostMsg_PDF_Create::ID: { case PpapiHostMsg_PDF_Create::ID: {
return base::MakeUnique<pdf::PepperPDFHost>(host_, instance, resource); return std::make_unique<pdf::PepperPDFHost>(host_, instance, resource);
} }
} }
} }