OLD | NEW |
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_job.h" | 5 #include "net/url_request/url_request_job.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 // SourceStream implementation: | 134 // SourceStream implementation: |
135 int Read(IOBuffer* dest_buffer, | 135 int Read(IOBuffer* dest_buffer, |
136 int buffer_size, | 136 int buffer_size, |
137 const CompletionCallback& callback) override { | 137 const CompletionCallback& callback) override { |
138 DCHECK(job_); | 138 DCHECK(job_); |
139 return job_->ReadRawDataHelper(dest_buffer, buffer_size, callback); | 139 return job_->ReadRawDataHelper(dest_buffer, buffer_size, callback); |
140 } | 140 } |
141 | 141 |
142 std::string Description() const override { return std::string(); } | 142 std::string Description() const override { return std::string(); } |
143 | 143 |
| 144 void DumpMemoryStats( |
| 145 base::trace_event::ProcessMemoryDump* pmd, |
| 146 const std::string& parent_dump_absolute_name) const override {} |
| 147 |
144 private: | 148 private: |
145 // It is safe to keep a raw pointer because |job_| owns the last stream which | 149 // It is safe to keep a raw pointer because |job_| owns the last stream which |
146 // indirectly owns |this|. Therefore, |job_| will not be destroyed when |this| | 150 // indirectly owns |this|. Therefore, |job_| will not be destroyed when |this| |
147 // is alive. | 151 // is alive. |
148 URLRequestJob* const job_; | 152 URLRequestJob* const job_; |
149 | 153 |
150 DISALLOW_COPY_AND_ASSIGN(URLRequestJobSourceStream); | 154 DISALLOW_COPY_AND_ASSIGN(URLRequestJobSourceStream); |
151 }; | 155 }; |
152 | 156 |
153 URLRequestJob::URLRequestJob(URLRequest* request, | 157 URLRequestJob::URLRequestJob(URLRequest* request, |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 request_->Cancel(); | 357 request_->Cancel(); |
354 } | 358 } |
355 | 359 |
356 void URLRequestJob::NotifyURLRequestDestroyed() { | 360 void URLRequestJob::NotifyURLRequestDestroyed() { |
357 } | 361 } |
358 | 362 |
359 void URLRequestJob::GetConnectionAttempts(ConnectionAttempts* out) const { | 363 void URLRequestJob::GetConnectionAttempts(ConnectionAttempts* out) const { |
360 out->clear(); | 364 out->clear(); |
361 } | 365 } |
362 | 366 |
| 367 void URLRequestJob::DumpMemoryStats( |
| 368 base::trace_event::ProcessMemoryDump* pmd, |
| 369 const std::string& parent_dump_absolute_name) const { |
| 370 if (source_stream_) |
| 371 source_stream_->DumpMemoryStats(pmd, parent_dump_absolute_name); |
| 372 } |
| 373 |
363 // static | 374 // static |
364 GURL URLRequestJob::ComputeReferrerForRedirect( | 375 GURL URLRequestJob::ComputeReferrerForRedirect( |
365 URLRequest::ReferrerPolicy policy, | 376 URLRequest::ReferrerPolicy policy, |
366 const GURL& original_referrer, | 377 const GURL& original_referrer, |
367 const GURL& redirect_destination) { | 378 const GURL& redirect_destination) { |
368 bool secure_referrer_but_insecure_destination = | 379 bool secure_referrer_but_insecure_destination = |
369 original_referrer.SchemeIsCryptographic() && | 380 original_referrer.SchemeIsCryptographic() && |
370 !redirect_destination.SchemeIsCryptographic(); | 381 !redirect_destination.SchemeIsCryptographic(); |
371 url::Origin referrer_origin(original_referrer); | 382 url::Origin referrer_origin(original_referrer); |
372 bool same_origin = | 383 bool same_origin = |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 int64_t total_sent_bytes = GetTotalSentBytes(); | 858 int64_t total_sent_bytes = GetTotalSentBytes(); |
848 DCHECK_GE(total_sent_bytes, last_notified_total_sent_bytes_); | 859 DCHECK_GE(total_sent_bytes, last_notified_total_sent_bytes_); |
849 if (total_sent_bytes > last_notified_total_sent_bytes_) { | 860 if (total_sent_bytes > last_notified_total_sent_bytes_) { |
850 network_delegate_->NotifyNetworkBytesSent( | 861 network_delegate_->NotifyNetworkBytesSent( |
851 request_, total_sent_bytes - last_notified_total_sent_bytes_); | 862 request_, total_sent_bytes - last_notified_total_sent_bytes_); |
852 } | 863 } |
853 last_notified_total_sent_bytes_ = total_sent_bytes; | 864 last_notified_total_sent_bytes_ = total_sent_bytes; |
854 } | 865 } |
855 | 866 |
856 } // namespace net | 867 } // namespace net |
OLD | NEW |