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

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

Issue 2176373005: [Housekeeping] Move file IO to slow pool. Base URL: https://chromium.googlesource.com/chromium/src.git@urlread
Patch Set: Created 4 years, 4 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 | « content/browser/webui/url_data_manager_backend.cc ('k') | no next file » | 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_request_simple_job.h" 5 #include "net/url_request/url_request_simple_job.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 18 matching lines...) Expand all
29 int64_t data_offset) { 29 int64_t data_offset) {
30 memcpy(buf->data(), data->front() + data_offset, buf_size); 30 memcpy(buf->data(), data->front() + data_offset, buf_size);
31 } 31 }
32 32
33 } // namespace 33 } // namespace
34 34
35 URLRequestSimpleJob::URLRequestSimpleJob(URLRequest* request, 35 URLRequestSimpleJob::URLRequestSimpleJob(URLRequest* request,
36 NetworkDelegate* network_delegate) 36 NetworkDelegate* network_delegate)
37 : URLRangeRequestJob(request, network_delegate), 37 : URLRangeRequestJob(request, network_delegate),
38 next_data_offset_(0), 38 next_data_offset_(0),
39 task_runner_(base::WorkerPool::GetTaskRunner(false)), 39 task_runner_(base::WorkerPool::GetTaskRunner(true)),
40 weak_factory_(this) { 40 weak_factory_(this) {}
41 }
42 41
43 void URLRequestSimpleJob::Start() { 42 void URLRequestSimpleJob::Start() {
44 // Start reading asynchronously so that all error reporting and data 43 // Start reading asynchronously so that all error reporting and data
45 // callbacks happen as they would for network requests. 44 // callbacks happen as they would for network requests.
46 base::ThreadTaskRunnerHandle::Get()->PostTask( 45 base::ThreadTaskRunnerHandle::Get()->PostTask(
47 FROM_HERE, 46 FROM_HERE,
48 base::Bind(&URLRequestSimpleJob::StartAsync, weak_factory_.GetWeakPtr())); 47 base::Bind(&URLRequestSimpleJob::StartAsync, weak_factory_.GetWeakPtr()));
49 } 48 }
50 49
51 void URLRequestSimpleJob::Kill() { 50 void URLRequestSimpleJob::Kill() {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 next_data_offset_ = byte_range_.first_byte_position(); 137 next_data_offset_ = byte_range_.first_byte_position();
139 set_expected_content_size(byte_range_.last_byte_position() - 138 set_expected_content_size(byte_range_.last_byte_position() -
140 next_data_offset_ + 1); 139 next_data_offset_ + 1);
141 NotifyHeadersComplete(); 140 NotifyHeadersComplete();
142 } else { 141 } else {
143 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result)); 142 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result));
144 } 143 }
145 } 144 }
146 145
147 } // namespace net 146 } // namespace net
OLDNEW
« no previous file with comments | « content/browser/webui/url_data_manager_backend.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698