| 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 "content/browser/loader/resource_loader.h" | 5 #include "content/browser/loader/resource_loader.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 | 511 |
| 512 void ResourceLoader::StoreSignedCertificateTimestamps( | 512 void ResourceLoader::StoreSignedCertificateTimestamps( |
| 513 const net::SignedCertificateTimestampAndStatusList& sct_list, | 513 const net::SignedCertificateTimestampAndStatusList& sct_list, |
| 514 int process_id, | 514 int process_id, |
| 515 SignedCertificateTimestampIDStatusList* sct_ids) { | 515 SignedCertificateTimestampIDStatusList* sct_ids) { |
| 516 SignedCertificateTimestampStore* sct_store( | 516 SignedCertificateTimestampStore* sct_store( |
| 517 SignedCertificateTimestampStore::GetInstance()); | 517 SignedCertificateTimestampStore::GetInstance()); |
| 518 | 518 |
| 519 for (net::SignedCertificateTimestampAndStatusList::const_iterator iter = | 519 for (net::SignedCertificateTimestampAndStatusList::const_iterator iter = |
| 520 sct_list.begin(); iter != sct_list.end(); ++iter) { | 520 sct_list.begin(); iter != sct_list.end(); ++iter) { |
| 521 const int sct_id(sct_store->Store(iter->sct, process_id)); | 521 const int sct_id(sct_store->Store(iter->sct.get(), process_id)); |
| 522 sct_ids->push_back( | 522 sct_ids->push_back( |
| 523 SignedCertificateTimestampIDAndStatus(sct_id, iter->status)); | 523 SignedCertificateTimestampIDAndStatus(sct_id, iter->status)); |
| 524 } | 524 } |
| 525 } | 525 } |
| 526 | 526 |
| 527 void ResourceLoader::CompleteResponseStarted() { | 527 void ResourceLoader::CompleteResponseStarted() { |
| 528 ResourceRequestInfoImpl* info = GetRequestInfo(); | 528 ResourceRequestInfoImpl* info = GetRequestInfo(); |
| 529 | 529 |
| 530 scoped_refptr<ResourceResponse> response(new ResourceResponse()); | 530 scoped_refptr<ResourceResponse> response(new ResourceResponse()); |
| 531 PopulateResourceResponse(info, request_.get(), response.get()); | 531 PopulateResourceResponse(info, request_.get(), response.get()); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 // Make sure we track the buffer in at least one place. This ensures it gets | 607 // Make sure we track the buffer in at least one place. This ensures it gets |
| 608 // deleted even in the case the request has already finished its job and | 608 // deleted even in the case the request has already finished its job and |
| 609 // doesn't use the buffer. | 609 // doesn't use the buffer. |
| 610 scoped_refptr<net::IOBuffer> buf; | 610 scoped_refptr<net::IOBuffer> buf; |
| 611 int buf_size; | 611 int buf_size; |
| 612 if (!handler_->OnWillRead(&buf, &buf_size, -1)) { | 612 if (!handler_->OnWillRead(&buf, &buf_size, -1)) { |
| 613 Cancel(); | 613 Cancel(); |
| 614 return; | 614 return; |
| 615 } | 615 } |
| 616 | 616 |
| 617 DCHECK(buf); | 617 DCHECK(buf.get()); |
| 618 DCHECK(buf_size > 0); | 618 DCHECK(buf_size > 0); |
| 619 | 619 |
| 620 request_->Read(buf.get(), buf_size, bytes_read); | 620 request_->Read(buf.get(), buf_size, bytes_read); |
| 621 | 621 |
| 622 // No need to check the return value here as we'll detect errors by | 622 // No need to check the return value here as we'll detect errors by |
| 623 // inspecting the URLRequest's status. | 623 // inspecting the URLRequest's status. |
| 624 } | 624 } |
| 625 | 625 |
| 626 void ResourceLoader::CompleteRead(int bytes_read) { | 626 void ResourceLoader::CompleteRead(int bytes_read) { |
| 627 DCHECK(bytes_read >= 0); | 627 DCHECK(bytes_read >= 0); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 case net::URLRequestStatus::FAILED: | 704 case net::URLRequestStatus::FAILED: |
| 705 status = STATUS_UNDEFINED; | 705 status = STATUS_UNDEFINED; |
| 706 break; | 706 break; |
| 707 } | 707 } |
| 708 | 708 |
| 709 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); | 709 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); |
| 710 } | 710 } |
| 711 } | 711 } |
| 712 | 712 |
| 713 } // namespace content | 713 } // namespace content |
| OLD | NEW |