Pass() is deprecated for std::move

This commit is contained in:
Cheng Zhao 2016-03-08 20:59:29 +09:00
parent 948e7c4055
commit baf5f384cd
14 changed files with 52 additions and 48 deletions

View file

@ -75,7 +75,7 @@ net::URLRequestContextGetter* BrowserClient::CreateRequestContext(
auto context = static_cast<BrowserContext*>(browser_context); auto context = static_cast<BrowserContext*>(browser_context);
return context->CreateRequestContext(static_cast<NetLog*>(GetNetLog()), return context->CreateRequestContext(static_cast<NetLog*>(GetNetLog()),
protocol_handlers, protocol_handlers,
protocol_interceptors.Pass()); std::move(protocol_interceptors));
} }
content::MediaObserver* BrowserClient::GetMediaObserver() { content::MediaObserver* BrowserClient::GetMediaObserver() {

View file

@ -148,7 +148,7 @@ net::URLRequestContextGetter* BrowserContext::CreateRequestContext(
BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO), BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO),
BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE), BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE),
protocol_handlers, protocol_handlers,
protocol_interceptors.Pass()); std::move(protocol_interceptors));
resource_context_->set_url_request_context_getter(url_request_getter_.get()); resource_context_->set_url_request_context_getter(url_request_getter_.get());
return url_request_getter_.get(); return url_request_getter_.get();
} }

View file

@ -39,7 +39,7 @@ void CocoaNotification::Show(const base::string16& title,
if ([notification_ respondsToSelector:@selector(setContentImage:)] && if ([notification_ respondsToSelector:@selector(setContentImage:)] &&
!icon.drawsNothing()) { !icon.drawsNothing()) {
NSImage* image = gfx::SkBitmapToNSImageWithColorSpace( NSImage* image = skia::SkBitmapToNSImageWithColorSpace(
icon, base::mac::GetGenericRGBColorSpace()); icon, base::mac::GetGenericRGBColorSpace());
[notification_ setContentImage:image]; [notification_ setContentImage:image];
} }

View file

@ -30,7 +30,7 @@ void DevToolsNetworkController::SetNetworkState(
if (client_id.empty()) { if (client_id.empty()) {
if (!conditions) if (!conditions)
return; return;
default_interceptor_->UpdateConditions(conditions.Pass()); default_interceptor_->UpdateConditions(std::move(conditions));
return; return;
} }
@ -40,16 +40,16 @@ void DevToolsNetworkController::SetNetworkState(
return; return;
scoped_ptr<DevToolsNetworkInterceptor> new_interceptor( scoped_ptr<DevToolsNetworkInterceptor> new_interceptor(
new DevToolsNetworkInterceptor); new DevToolsNetworkInterceptor);
new_interceptor->UpdateConditions(conditions.Pass()); new_interceptor->UpdateConditions(std::move(conditions));
interceptors_.set(client_id, new_interceptor.Pass()); interceptors_.set(client_id, std::move(new_interceptor));
} else { } else {
if (!conditions) { if (!conditions) {
scoped_ptr<DevToolsNetworkConditions> online_conditions( scoped_ptr<DevToolsNetworkConditions> online_conditions(
new DevToolsNetworkConditions(false)); new DevToolsNetworkConditions(false));
interceptor->UpdateConditions(online_conditions.Pass()); interceptor->UpdateConditions(std::move(online_conditions));
interceptors_.erase(client_id); interceptors_.erase(client_id);
} else { } else {
interceptor->UpdateConditions(conditions.Pass()); interceptor->UpdateConditions(std::move(conditions));
} }
} }
} }

View file

@ -40,7 +40,7 @@ void DevToolsNetworkInterceptor::UpdateConditions(
if (conditions_->IsThrottling()) if (conditions_->IsThrottling())
UpdateThrottledTransactions(now); UpdateThrottledTransactions(now);
conditions_ = conditions.Pass(); conditions_ = std::move(conditions);
if (conditions_->offline()) { if (conditions_->offline()) {
timer_.Stop(); timer_.Stop();

View file

@ -64,7 +64,7 @@ CreateSuccessResponse(int id, scoped_ptr<base::DictionaryValue> result) {
scoped_ptr<base::DictionaryValue> response(new base::DictionaryValue); scoped_ptr<base::DictionaryValue> response(new base::DictionaryValue);
response->SetInteger(kId, id); response->SetInteger(kId, id);
response->Set(params::kResult, result.release()); response->Set(params::kResult, result.release());
return response.Pass(); return response;
} }
scoped_ptr<base::DictionaryValue> scoped_ptr<base::DictionaryValue>
@ -75,14 +75,14 @@ CreateFailureResponse(int id, const std::string& param) {
error_object->SetInteger(params::kErrorCode, kErrorInvalidParams); error_object->SetInteger(params::kErrorCode, kErrorInvalidParams);
error_object->SetString(params::kErrorMessage, error_object->SetString(params::kErrorMessage,
base::StringPrintf("Missing or Invalid '%s' parameter", param.c_str())); base::StringPrintf("Missing or Invalid '%s' parameter", param.c_str()));
return response.Pass(); return response;
} }
void UpdateNetworkStateInIO(brightray::DevToolsNetworkController* controller, void UpdateNetworkStateInIO(brightray::DevToolsNetworkController* controller,
const std::string& client_id, const std::string& client_id,
scoped_ptr<brightray::DevToolsNetworkConditions> conditions) { scoped_ptr<brightray::DevToolsNetworkConditions> conditions) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
controller->SetNetworkState(client_id, conditions.Pass()); controller->SetNetworkState(client_id, std::move(conditions));
} }
} // namespace } // namespace
@ -119,7 +119,7 @@ DevToolsNetworkProtocolHandler::CanEmulateNetworkConditions(
const base::DictionaryValue* params) { const base::DictionaryValue* params) {
scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue); scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue);
result->SetBoolean(params::kResult, true); result->SetBoolean(params::kResult, true);
return CreateSuccessResponse(id, result.Pass()); return CreateSuccessResponse(id, std::move(result));
} }
scoped_ptr<base::DictionaryValue> scoped_ptr<base::DictionaryValue>
@ -154,7 +154,7 @@ DevToolsNetworkProtocolHandler::EmulateNetworkConditions(
latency, latency,
download_throughput, download_throughput,
upload_throughput)); upload_throughput));
UpdateNetworkState(agent_host, conditions.Pass()); UpdateNetworkState(agent_host, std::move(conditions));
return scoped_ptr<base::DictionaryValue>(); return scoped_ptr<base::DictionaryValue>();
} }

View file

@ -24,7 +24,7 @@ DevToolsNetworkTransaction::DevToolsNetworkTransaction(
DevToolsNetworkController* controller, DevToolsNetworkController* controller,
scoped_ptr<net::HttpTransaction> transaction) scoped_ptr<net::HttpTransaction> transaction)
: controller_(controller), : controller_(controller),
transaction_(transaction.Pass()), transaction_(std::move(transaction)),
request_(nullptr), request_(nullptr),
failed_(false), failed_(false),
throttled_byte_count_(0), throttled_byte_count_(0),

View file

@ -35,7 +35,8 @@ int DevToolsNetworkTransactionFactory::CreateTransaction(
int rv = network_layer_->CreateTransaction(priority, &new_transaction); int rv = network_layer_->CreateTransaction(priority, &new_transaction);
if (rv != net::OK) if (rv != net::OK)
return rv; return rv;
transaction->reset(new DevToolsNetworkTransaction(controller_, new_transaction.Pass())); transaction->reset(
new DevToolsNetworkTransaction(controller_, std::move(new_transaction)));
return net::OK; return net::OK;
} }

View file

@ -55,7 +55,7 @@ void NetLog::StartLogging(net::URLRequestContext* url_request_context) {
scoped_ptr<base::Value> constants(GetConstants()); scoped_ptr<base::Value> constants(GetConstants());
write_to_file_observer_.StartObserving(this, write_to_file_observer_.StartObserving(this,
log_file_.Pass(), std::move(log_file_),
constants.get(), constants.get(),
url_request_context); url_request_context);
} }

View file

@ -8,7 +8,7 @@ namespace brightray {
NotificationDelegateAdapter::NotificationDelegateAdapter( NotificationDelegateAdapter::NotificationDelegateAdapter(
scoped_ptr<content::DesktopNotificationDelegate> delegate) scoped_ptr<content::DesktopNotificationDelegate> delegate)
: delegate_(delegate.Pass()) { : delegate_(std::move(delegate)) {
} }
NotificationDelegateAdapter::~NotificationDelegateAdapter() { NotificationDelegateAdapter::~NotificationDelegateAdapter() {

View file

@ -33,7 +33,7 @@ void OnWebNotificationAllowed(
if (!presenter) if (!presenter)
return; return;
scoped_ptr<NotificationDelegateAdapter> adapter( scoped_ptr<NotificationDelegateAdapter> adapter(
new NotificationDelegateAdapter(delegate.Pass())); new NotificationDelegateAdapter(std::move(delegate)));
auto notification = presenter->CreateNotification(adapter.get()); auto notification = presenter->CreateNotification(adapter.get());
if (notification) { if (notification) {
ignore_result(adapter.release()); // it will release itself automatically. ignore_result(adapter.release()); // it will release itself automatically.

View file

@ -23,6 +23,7 @@
#include "net/cookies/cookie_monster.h" #include "net/cookies/cookie_monster.h"
#include "net/dns/mapped_host_resolver.h" #include "net/dns/mapped_host_resolver.h"
#include "net/http/http_auth_handler_factory.h" #include "net/http/http_auth_handler_factory.h"
#include "net/http/http_auth_preferences.h"
#include "net/http/http_server_properties_impl.h" #include "net/http/http_server_properties_impl.h"
#include "net/log/net_log.h" #include "net/log/net_log.h"
#include "net/proxy/dhcp_proxy_script_fetcher_factory.h" #include "net/proxy/dhcp_proxy_script_fetcher_factory.h"
@ -139,14 +140,14 @@ URLRequestContextGetter::Delegate::CreateURLRequestJobFactory(
base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)))); base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))));
// Set up interceptors in the reverse order. // Set up interceptors in the reverse order.
scoped_ptr<net::URLRequestJobFactory> top_job_factory = job_factory.Pass(); scoped_ptr<net::URLRequestJobFactory> top_job_factory = std::move(job_factory);
content::URLRequestInterceptorScopedVector::reverse_iterator i; content::URLRequestInterceptorScopedVector::reverse_iterator i;
for (i = protocol_interceptors->rbegin(); i != protocol_interceptors->rend(); ++i) for (i = protocol_interceptors->rbegin(); i != protocol_interceptors->rend(); ++i)
top_job_factory.reset(new net::URLRequestInterceptingJobFactory( top_job_factory.reset(new net::URLRequestInterceptingJobFactory(
top_job_factory.Pass(), make_scoped_ptr(*i))); std::move(top_job_factory), make_scoped_ptr(*i)));
protocol_interceptors->weak_clear(); protocol_interceptors->weak_clear();
return top_job_factory.Pass(); return top_job_factory;
} }
net::HttpCache::BackendFactory* net::HttpCache::BackendFactory*
@ -195,8 +196,7 @@ URLRequestContextGetter::URLRequestContextGetter(
in_memory_(in_memory), in_memory_(in_memory),
io_loop_(io_loop), io_loop_(io_loop),
file_loop_(file_loop), file_loop_(file_loop),
url_sec_mgr_(new URLRequestContextGetter::DelegateURLSecurityManager(delegate)), protocol_interceptors_(std::move(protocol_interceptors)) {
protocol_interceptors_(protocol_interceptors.Pass()) {
// Must first be created on the UI thread. // Must first be created on the UI thread.
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@ -265,10 +265,10 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
// --host-resolver-rules // --host-resolver-rules
if (command_line.HasSwitch(switches::kHostResolverRules)) { if (command_line.HasSwitch(switches::kHostResolverRules)) {
scoped_ptr<net::MappedHostResolver> remapped_resolver( scoped_ptr<net::MappedHostResolver> remapped_resolver(
new net::MappedHostResolver(host_resolver.Pass())); new net::MappedHostResolver(std::move(host_resolver)));
remapped_resolver->SetRulesFromString( remapped_resolver->SetRulesFromString(
command_line.GetSwitchValueASCII(switches::kHostResolverRules)); command_line.GetSwitchValueASCII(switches::kHostResolverRules));
host_resolver = remapped_resolver.Pass(); host_resolver = std::move(remapped_resolver);
} }
// --proxy-server // --proxy-server
@ -291,7 +291,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
} else { } else {
storage_->set_proxy_service( storage_->set_proxy_service(
net::CreateProxyServiceUsingV8ProxyResolver( net::CreateProxyServiceUsingV8ProxyResolver(
proxy_config_service_.Pass(), std::move(proxy_config_service_),
new net::ProxyScriptFetcherImpl(url_request_context_.get()), new net::ProxyScriptFetcherImpl(url_request_context_.get()),
dhcp_factory.Create(url_request_context_.get()), dhcp_factory.Create(url_request_context_.get()),
host_resolver.get(), host_resolver.get(),
@ -304,16 +304,15 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
schemes.push_back(std::string("digest")); schemes.push_back(std::string("digest"));
schemes.push_back(std::string("ntlm")); schemes.push_back(std::string("ntlm"));
schemes.push_back(std::string("negotiate")); schemes.push_back(std::string("negotiate"));
#if defined(OS_POSIX)
http_auth_preferences_.reset(new net::HttpAuthPreferences(schemes,
std::string()));
#else
http_auth_preferences_.reset(new net::HttpAuthPreferences(schemes));
#endif
auto auth_handler_factory = make_scoped_ptr( auto auth_handler_factory = make_scoped_ptr(
net::HttpAuthHandlerRegistryFactory::Create( net::HttpAuthHandlerRegistryFactory::Create(
schemes, http_auth_preferences_.get(), host_resolver.get()));
url_sec_mgr_.get(),
host_resolver.get(),
std::string(), // gssapi_library_name
std::string(), // gssapi_library_nam
false, // auth_android_negotiate_account_type
true)); // negotiate_enable_port
storage_->set_cert_verifier(delegate_->CreateCertVerifier()); storage_->set_cert_verifier(delegate_->CreateCertVerifier());
storage_->set_transport_security_state( storage_->set_transport_security_state(
@ -322,7 +321,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
storage_->set_http_auth_handler_factory(auth_handler_factory.Pass()); storage_->set_http_auth_handler_factory(auth_handler_factory.Pass());
scoped_ptr<net::HttpServerProperties> server_properties( scoped_ptr<net::HttpServerProperties> server_properties(
new net::HttpServerPropertiesImpl); new net::HttpServerPropertiesImpl);
storage_->set_http_server_properties(server_properties.Pass()); storage_->set_http_server_properties(std::move(server_properties));
net::HttpNetworkSession::Params network_session_params; net::HttpNetworkSession::Params network_session_params;
network_session_params.cert_verifier = url_request_context_->cert_verifier(); network_session_params.cert_verifier = url_request_context_->cert_verifier();
@ -355,21 +354,23 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
} }
// Give |storage_| ownership at the end in case it's |mapped_host_resolver|. // Give |storage_| ownership at the end in case it's |mapped_host_resolver|.
storage_->set_host_resolver(host_resolver.Pass()); storage_->set_host_resolver(std::move(host_resolver));
network_session_params.host_resolver = url_request_context_->host_resolver(); network_session_params.host_resolver = url_request_context_->host_resolver();
net::HttpNetworkSession* session = new net::HttpNetworkSession(network_session_params); http_network_session_.reset(
net::HttpCache::BackendFactory* backend = nullptr; new net::HttpNetworkSession(network_session_params));
scoped_ptr<net::HttpCache::BackendFactory> backend;
if (in_memory_) { if (in_memory_) {
backend = net::HttpCache::DefaultBackend::InMemory(0); backend = net::HttpCache::DefaultBackend::InMemory(0);
} else { } else {
backend = delegate_->CreateHttpCacheBackendFactory(base_path_); backend.reset(delegate_->CreateHttpCacheBackendFactory(base_path_));
} }
storage_->set_http_transaction_factory(make_scoped_ptr( storage_->set_http_transaction_factory(make_scoped_ptr(
new net::HttpCache( new net::HttpCache(
new DevToolsNetworkTransactionFactory(controller_, session), new DevToolsNetworkTransactionFactory(controller_,
http_network_session_.get()),
url_request_context_->net_log(), url_request_context_->net_log(),
backend))); std::move(backend))));
storage_->set_job_factory(delegate_->CreateURLRequestJobFactory( storage_->set_job_factory(delegate_->CreateURLRequestJobFactory(
&protocol_handlers_, &protocol_interceptors_)); &protocol_handlers_, &protocol_interceptors_));

View file

@ -19,6 +19,7 @@ class MessageLoop;
namespace net { namespace net {
class HostMappingRules; class HostMappingRules;
class HostResolver; class HostResolver;
class HttpAuthPreferences;
class NetworkDelegate; class NetworkDelegate;
class ProxyConfigService; class ProxyConfigService;
class URLRequestContextStorage; class URLRequestContextStorage;
@ -103,7 +104,8 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
scoped_ptr<net::URLRequestContextStorage> storage_; scoped_ptr<net::URLRequestContextStorage> storage_;
scoped_ptr<net::URLRequestContext> url_request_context_; scoped_ptr<net::URLRequestContext> url_request_context_;
scoped_ptr<net::HostMappingRules> host_mapping_rules_; scoped_ptr<net::HostMappingRules> host_mapping_rules_;
scoped_ptr<net::URLSecurityManager> url_sec_mgr_; scoped_ptr<net::HttpAuthPreferences> http_auth_preferences_;
scoped_ptr<net::HttpNetworkSession> http_network_session_;
content::ProtocolHandlerMap protocol_handlers_; content::ProtocolHandlerMap protocol_handlers_;
content::URLRequestInterceptorScopedVector protocol_interceptors_; content::URLRequestInterceptorScopedVector protocol_interceptors_;

View file

@ -81,11 +81,11 @@ MainDelegate::~MainDelegate() {
} }
scoped_ptr<ContentClient> MainDelegate::CreateContentClient() { scoped_ptr<ContentClient> MainDelegate::CreateContentClient() {
return make_scoped_ptr(new ContentClient).Pass(); return make_scoped_ptr(new ContentClient);
} }
bool MainDelegate::BasicStartupComplete(int* exit_code) { bool MainDelegate::BasicStartupComplete(int* exit_code) {
content_client_ = CreateContentClient().Pass(); content_client_ = CreateContentClient();
SetContentClient(content_client_.get()); SetContentClient(content_client_.get());
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
OverrideChildProcessPath(); OverrideChildProcessPath();
@ -108,12 +108,12 @@ void MainDelegate::PreSandboxStartup() {
} }
content::ContentBrowserClient* MainDelegate::CreateContentBrowserClient() { content::ContentBrowserClient* MainDelegate::CreateContentBrowserClient() {
browser_client_ = CreateBrowserClient().Pass(); browser_client_ = CreateBrowserClient();
return browser_client_.get(); return browser_client_.get();
} }
scoped_ptr<BrowserClient> MainDelegate::CreateBrowserClient() { scoped_ptr<BrowserClient> MainDelegate::CreateBrowserClient() {
return make_scoped_ptr(new BrowserClient).Pass(); return make_scoped_ptr(new BrowserClient);
} }
} // namespace brightray } // namespace brightray