| 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/child/resource_dispatcher.h" | 5 #include "content/child/resource_dispatcher.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 void OnReceivedData(std::unique_ptr<ReceivedData> data) override { | 411 void OnReceivedData(std::unique_ptr<ReceivedData> data) override { |
| 412 data_.append(data->payload(), data->length()); | 412 data_.append(data->payload(), data->length()); |
| 413 } | 413 } |
| 414 void OnTransferSizeUpdated(int transfer_size_diff) override {} | 414 void OnTransferSizeUpdated(int transfer_size_diff) override {} |
| 415 | 415 |
| 416 void OnCompletedRequest(int error_code, | 416 void OnCompletedRequest(int error_code, |
| 417 bool was_ignored_by_handler, | 417 bool was_ignored_by_handler, |
| 418 bool stale_copy_in_cache, | 418 bool stale_copy_in_cache, |
| 419 const base::TimeTicks& completion_time, | 419 const base::TimeTicks& completion_time, |
| 420 int64_t total_transfer_size, | 420 int64_t total_transfer_size, |
| 421 int64_t encoded_body_size) override { | 421 int64_t encoded_body_size, |
| 422 int64_t decoded_body_size) override { |
| 422 original_peer_->OnReceivedResponse(response_info_); | 423 original_peer_->OnReceivedResponse(response_info_); |
| 423 if (!data_.empty()) { | 424 if (!data_.empty()) { |
| 424 original_peer_->OnReceivedData( | 425 original_peer_->OnReceivedData( |
| 425 base::MakeUnique<FixedReceivedData>(data_.data(), data_.size())); | 426 base::MakeUnique<FixedReceivedData>(data_.data(), data_.size())); |
| 426 } | 427 } |
| 427 original_peer_->OnCompletedRequest( | 428 original_peer_->OnCompletedRequest(error_code, was_ignored_by_handler, |
| 428 error_code, was_ignored_by_handler, stale_copy_in_cache, | 429 stale_copy_in_cache, completion_time, |
| 429 completion_time, total_transfer_size, encoded_body_size); | 430 total_transfer_size, encoded_body_size, |
| 431 decoded_body_size); |
| 430 } | 432 } |
| 431 | 433 |
| 432 private: | 434 private: |
| 433 std::unique_ptr<RequestPeer> original_peer_; | 435 std::unique_ptr<RequestPeer> original_peer_; |
| 434 ResourceResponseInfo response_info_; | 436 ResourceResponseInfo response_info_; |
| 435 std::string data_; | 437 std::string data_; |
| 436 | 438 |
| 437 DISALLOW_COPY_AND_ASSIGN(WrapperPeer); | 439 DISALLOW_COPY_AND_ASSIGN(WrapperPeer); |
| 438 }; | 440 }; |
| 439 | 441 |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 ResourceResponseHead response_head; | 913 ResourceResponseHead response_head; |
| 912 | 914 |
| 913 PerformTest(response_head); | 915 PerformTest(response_head); |
| 914 | 916 |
| 915 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start); | 917 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start); |
| 916 EXPECT_EQ(base::TimeTicks(), | 918 EXPECT_EQ(base::TimeTicks(), |
| 917 response_info().load_timing.connect_timing.dns_start); | 919 response_info().load_timing.connect_timing.dns_start); |
| 918 } | 920 } |
| 919 | 921 |
| 920 } // namespace content | 922 } // namespace content |
| OLD | NEW |