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);
return context->CreateRequestContext(static_cast<NetLog*>(GetNetLog()),
protocol_handlers,
protocol_interceptors.Pass());
std::move(protocol_interceptors));
}
content::MediaObserver* BrowserClient::GetMediaObserver() {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -23,6 +23,7 @@
#include "net/cookies/cookie_monster.h"
#include "net/dns/mapped_host_resolver.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/log/net_log.h"
#include "net/proxy/dhcp_proxy_script_fetcher_factory.h"
@ -139,14 +140,14 @@ URLRequestContextGetter::Delegate::CreateURLRequestJobFactory(
base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))));
// 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;
for (i = protocol_interceptors->rbegin(); i != protocol_interceptors->rend(); ++i)
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();
return top_job_factory.Pass();
return top_job_factory;
}
net::HttpCache::BackendFactory*
@ -195,8 +196,7 @@ URLRequestContextGetter::URLRequestContextGetter(
in_memory_(in_memory),
io_loop_(io_loop),
file_loop_(file_loop),
url_sec_mgr_(new URLRequestContextGetter::DelegateURLSecurityManager(delegate)),
protocol_interceptors_(protocol_interceptors.Pass()) {
protocol_interceptors_(std::move(protocol_interceptors)) {
// Must first be created on the UI thread.
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@ -265,10 +265,10 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
// --host-resolver-rules
if (command_line.HasSwitch(switches::kHostResolverRules)) {
scoped_ptr<net::MappedHostResolver> remapped_resolver(
new net::MappedHostResolver(host_resolver.Pass()));
new net::MappedHostResolver(std::move(host_resolver)));
remapped_resolver->SetRulesFromString(
command_line.GetSwitchValueASCII(switches::kHostResolverRules));
host_resolver = remapped_resolver.Pass();
host_resolver = std::move(remapped_resolver);
}
// --proxy-server
@ -291,7 +291,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
} else {
storage_->set_proxy_service(
net::CreateProxyServiceUsingV8ProxyResolver(
proxy_config_service_.Pass(),
std::move(proxy_config_service_),
new net::ProxyScriptFetcherImpl(url_request_context_.get()),
dhcp_factory.Create(url_request_context_.get()),
host_resolver.get(),
@ -304,16 +304,15 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
schemes.push_back(std::string("digest"));
schemes.push_back(std::string("ntlm"));
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(
net::HttpAuthHandlerRegistryFactory::Create(
schemes,
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
http_auth_preferences_.get(), host_resolver.get()));
storage_->set_cert_verifier(delegate_->CreateCertVerifier());
storage_->set_transport_security_state(
@ -322,7 +321,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
storage_->set_http_auth_handler_factory(auth_handler_factory.Pass());
scoped_ptr<net::HttpServerProperties> server_properties(
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;
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|.
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();
net::HttpNetworkSession* session = new net::HttpNetworkSession(network_session_params);
net::HttpCache::BackendFactory* backend = nullptr;
http_network_session_.reset(
new net::HttpNetworkSession(network_session_params));
scoped_ptr<net::HttpCache::BackendFactory> backend;
if (in_memory_) {
backend = net::HttpCache::DefaultBackend::InMemory(0);
} else {
backend = delegate_->CreateHttpCacheBackendFactory(base_path_);
backend.reset(delegate_->CreateHttpCacheBackendFactory(base_path_));
}
storage_->set_http_transaction_factory(make_scoped_ptr(
new net::HttpCache(
new DevToolsNetworkTransactionFactory(controller_, session),
new DevToolsNetworkTransactionFactory(controller_,
http_network_session_.get()),
url_request_context_->net_log(),
backend)));
std::move(backend))));
storage_->set_job_factory(delegate_->CreateURLRequestJobFactory(
&protocol_handlers_, &protocol_interceptors_));

View file

@ -19,6 +19,7 @@ class MessageLoop;
namespace net {
class HostMappingRules;
class HostResolver;
class HttpAuthPreferences;
class NetworkDelegate;
class ProxyConfigService;
class URLRequestContextStorage;
@ -103,7 +104,8 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
scoped_ptr<net::URLRequestContextStorage> storage_;
scoped_ptr<net::URLRequestContext> url_request_context_;
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::URLRequestInterceptorScopedVector protocol_interceptors_;

View file

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