Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: net/url_request/url_fetcher_core.cc

Issue 1545233002: Convert Pass()→std::move() in //net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/url_request/test_url_fetcher_factory.cc ('k') | net/url_request/url_fetcher_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/url_request/url_fetcher_core.h" 5 #include "net/url_request/url_fetcher_core.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility>
8 9
9 #include "base/bind.h" 10 #include "base/bind.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
12 #include "base/profiler/scoped_tracker.h" 13 #include "base/profiler/scoped_tracker.h"
13 #include "base/sequenced_task_runner.h" 14 #include "base/sequenced_task_runner.h"
14 #include "base/single_thread_task_runner.h" 15 #include "base/single_thread_task_runner.h"
15 #include "base/stl_util.h" 16 #include "base/stl_util.h"
16 #include "base/thread_task_runner_handle.h" 17 #include "base/thread_task_runner_handle.h"
17 #include "base/tracked_objects.h" 18 #include "base/tracked_objects.h"
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 void URLFetcherCore::SaveResponseToTemporaryFile( 295 void URLFetcherCore::SaveResponseToTemporaryFile(
295 scoped_refptr<base::SequencedTaskRunner> file_task_runner) { 296 scoped_refptr<base::SequencedTaskRunner> file_task_runner) {
296 DCHECK(delegate_task_runner_->BelongsToCurrentThread()); 297 DCHECK(delegate_task_runner_->BelongsToCurrentThread());
297 SaveResponseWithWriter(scoped_ptr<URLFetcherResponseWriter>( 298 SaveResponseWithWriter(scoped_ptr<URLFetcherResponseWriter>(
298 new URLFetcherFileWriter(file_task_runner, base::FilePath()))); 299 new URLFetcherFileWriter(file_task_runner, base::FilePath())));
299 } 300 }
300 301
301 void URLFetcherCore::SaveResponseWithWriter( 302 void URLFetcherCore::SaveResponseWithWriter(
302 scoped_ptr<URLFetcherResponseWriter> response_writer) { 303 scoped_ptr<URLFetcherResponseWriter> response_writer) {
303 DCHECK(delegate_task_runner_->BelongsToCurrentThread()); 304 DCHECK(delegate_task_runner_->BelongsToCurrentThread());
304 response_writer_ = response_writer.Pass(); 305 response_writer_ = std::move(response_writer);
305 } 306 }
306 307
307 HttpResponseHeaders* URLFetcherCore::GetResponseHeaders() const { 308 HttpResponseHeaders* URLFetcherCore::GetResponseHeaders() const {
308 return response_headers_.get(); 309 return response_headers_.get();
309 } 310 }
310 311
311 // TODO(panayiotis): socket_address_ is written in the IO thread, 312 // TODO(panayiotis): socket_address_ is written in the IO thread,
312 // if this is accessed in the UI thread, this could result in a race. 313 // if this is accessed in the UI thread, this could result in a race.
313 // Same for response_headers_ above and was_fetched_via_proxy_ below. 314 // Same for response_headers_ above and was_fetched_via_proxy_ below.
314 HostPortPair URLFetcherCore::GetSocketAddress() const { 315 HostPortPair URLFetcherCore::GetSocketAddress() const {
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 request_type_ == URLFetcher::POST ? "POST" : 577 request_type_ == URLFetcher::POST ? "POST" :
577 request_type_ == URLFetcher::PUT ? "PUT" : "PATCH"); 578 request_type_ == URLFetcher::PUT ? "PUT" : "PATCH");
578 if (!upload_content_type_.empty()) { 579 if (!upload_content_type_.empty()) {
579 extra_request_headers_.SetHeader(HttpRequestHeaders::kContentType, 580 extra_request_headers_.SetHeader(HttpRequestHeaders::kContentType,
580 upload_content_type_); 581 upload_content_type_);
581 } 582 }
582 if (!upload_content_.empty()) { 583 if (!upload_content_.empty()) {
583 scoped_ptr<UploadElementReader> reader(new UploadBytesElementReader( 584 scoped_ptr<UploadElementReader> reader(new UploadBytesElementReader(
584 upload_content_.data(), upload_content_.size())); 585 upload_content_.data(), upload_content_.size()));
585 request_->set_upload( 586 request_->set_upload(
586 ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0)); 587 ElementsUploadDataStream::CreateWithReader(std::move(reader), 0));
587 } else if (!upload_file_path_.empty()) { 588 } else if (!upload_file_path_.empty()) {
588 scoped_ptr<UploadElementReader> reader( 589 scoped_ptr<UploadElementReader> reader(
589 new UploadFileElementReader(upload_file_task_runner_.get(), 590 new UploadFileElementReader(upload_file_task_runner_.get(),
590 upload_file_path_, 591 upload_file_path_,
591 upload_range_offset_, 592 upload_range_offset_,
592 upload_range_length_, 593 upload_range_length_,
593 base::Time())); 594 base::Time()));
594 request_->set_upload( 595 request_->set_upload(
595 ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0)); 596 ElementsUploadDataStream::CreateWithReader(std::move(reader), 0));
596 } else if (!upload_stream_factory_.is_null()) { 597 } else if (!upload_stream_factory_.is_null()) {
597 scoped_ptr<UploadDataStream> stream = upload_stream_factory_.Run(); 598 scoped_ptr<UploadDataStream> stream = upload_stream_factory_.Run();
598 DCHECK(stream); 599 DCHECK(stream);
599 request_->set_upload(stream.Pass()); 600 request_->set_upload(std::move(stream));
600 } 601 }
601 602
602 current_upload_bytes_ = -1; 603 current_upload_bytes_ = -1;
603 // TODO(kinaba): http://crbug.com/118103. Implement upload callback in the 604 // TODO(kinaba): http://crbug.com/118103. Implement upload callback in the
604 // layer and avoid using timer here. 605 // layer and avoid using timer here.
605 upload_progress_checker_timer_.reset(new base::RepeatingTimer()); 606 upload_progress_checker_timer_.reset(new base::RepeatingTimer());
606 upload_progress_checker_timer_->Start( 607 upload_progress_checker_timer_->Start(
607 FROM_HERE, 608 FROM_HERE,
608 base::TimeDelta::FromMilliseconds(kUploadProgressTimerInterval), 609 base::TimeDelta::FromMilliseconds(kUploadProgressTimerInterval),
609 this, 610 this,
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 } 952 }
952 953
953 void URLFetcherCore::AssertHasNoUploadData() const { 954 void URLFetcherCore::AssertHasNoUploadData() const {
954 DCHECK(!upload_content_set_); 955 DCHECK(!upload_content_set_);
955 DCHECK(upload_content_.empty()); 956 DCHECK(upload_content_.empty());
956 DCHECK(upload_file_path_.empty()); 957 DCHECK(upload_file_path_.empty());
957 DCHECK(upload_stream_factory_.is_null()); 958 DCHECK(upload_stream_factory_.is_null());
958 } 959 }
959 960
960 } // namespace net 961 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/test_url_fetcher_factory.cc ('k') | net/url_request/url_fetcher_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698