Ban raw pointers to ref-counted types on base::Bind

https://chromium-review.googlesource.com/c/chromium/src/+/549537
This commit is contained in:
Aleksei Kuzmin 2017-08-24 01:42:59 +03:00 committed by Cheng Zhao
parent 12a4321e2b
commit a9eb0cbec0
2 changed files with 5 additions and 3 deletions

View file

@ -623,7 +623,8 @@ void Session::SetUserAgent(const std::string& user_agent,
std::string accept_lang = l10n_util::GetApplicationLocale("");
args->GetNext(&accept_lang);
auto getter = browser_context_->GetRequestContext();
scoped_refptr<brightray::URLRequestContextGetter> getter(
browser_context_->GetRequestContext());
getter->GetNetworkTaskRunner()->PostTask(
FROM_HERE,
base::Bind(&SetUserAgentInIO, getter, accept_lang, user_agent));

View file

@ -69,7 +69,8 @@ scoped_refptr<AtomURLRequest> AtomURLRequest::Create(
if (!browser_context || url.empty() || !delegate) {
return nullptr;
}
auto request_context_getter = browser_context->url_request_context_getter();
scoped_refptr<brightray::URLRequestContextGetter> request_context_getter(
browser_context->url_request_context_getter());
DCHECK(request_context_getter);
if (!request_context_getter) {
return nullptr;
@ -439,7 +440,7 @@ bool AtomURLRequest::CopyAndPostBuffer(int bytes_read) {
// data is only a wrapper for the asynchronous response_read_buffer_.
// Make a deep copy of payload and transfer ownership to the UI thread.
auto buffer_copy = new net::IOBufferWithSize(bytes_read);
auto buffer_copy = make_scoped_refptr(new net::IOBufferWithSize(bytes_read));
memcpy(buffer_copy->data(), response_read_buffer_->data(), bytes_read);
return content::BrowserThread::PostTask(