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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 std::unique_ptr<RequestPeer> current_peer, | 512 std::unique_ptr<RequestPeer> current_peer, |
513 ResourceType resource_type, | 513 ResourceType resource_type, |
514 int error_code) override { | 514 int error_code) override { |
515 return current_peer; | 515 return current_peer; |
516 } | 516 } |
517 | 517 |
518 std::unique_ptr<RequestPeer> OnReceivedResponse( | 518 std::unique_ptr<RequestPeer> OnReceivedResponse( |
519 std::unique_ptr<RequestPeer> current_peer, | 519 std::unique_ptr<RequestPeer> current_peer, |
520 const std::string& mime_type, | 520 const std::string& mime_type, |
521 const GURL& url) override { | 521 const GURL& url) override { |
522 return base::WrapUnique(new WrapperPeer(std::move(current_peer))); | 522 return base::MakeUnique<WrapperPeer>(std::move(current_peer)); |
523 } | 523 } |
524 | 524 |
525 class WrapperPeer : public RequestPeer { | 525 class WrapperPeer : public RequestPeer { |
526 public: | 526 public: |
527 explicit WrapperPeer(std::unique_ptr<RequestPeer> original_peer) | 527 explicit WrapperPeer(std::unique_ptr<RequestPeer> original_peer) |
528 : original_peer_(std::move(original_peer)) {} | 528 : original_peer_(std::move(original_peer)) {} |
529 | 529 |
530 void OnUploadProgress(uint64_t position, uint64_t size) override {} | 530 void OnUploadProgress(uint64_t position, uint64_t size) override {} |
531 | 531 |
532 bool OnReceivedRedirect(const net::RedirectInfo& redirect_info, | 532 bool OnReceivedRedirect(const net::RedirectInfo& redirect_info, |
(...skipping 12 matching lines...) Expand all Loading... |
545 } | 545 } |
546 | 546 |
547 void OnCompletedRequest(int error_code, | 547 void OnCompletedRequest(int error_code, |
548 bool was_ignored_by_handler, | 548 bool was_ignored_by_handler, |
549 bool stale_copy_in_cache, | 549 bool stale_copy_in_cache, |
550 const std::string& security_info, | 550 const std::string& security_info, |
551 const base::TimeTicks& completion_time, | 551 const base::TimeTicks& completion_time, |
552 int64_t total_transfer_size) override { | 552 int64_t total_transfer_size) override { |
553 original_peer_->OnReceivedResponse(response_info_); | 553 original_peer_->OnReceivedResponse(response_info_); |
554 if (!data_.empty()) { | 554 if (!data_.empty()) { |
555 original_peer_->OnReceivedData(base::WrapUnique(new FixedReceivedData( | 555 original_peer_->OnReceivedData(base::MakeUnique<FixedReceivedData>( |
556 data_.data(), data_.size(), -1, data_.size()))); | 556 data_.data(), data_.size(), -1, data_.size())); |
557 } | 557 } |
558 original_peer_->OnCompletedRequest(error_code, was_ignored_by_handler, | 558 original_peer_->OnCompletedRequest(error_code, was_ignored_by_handler, |
559 stale_copy_in_cache, security_info, | 559 stale_copy_in_cache, security_info, |
560 completion_time, total_transfer_size); | 560 completion_time, total_transfer_size); |
561 } | 561 } |
562 | 562 |
563 private: | 563 private: |
564 std::unique_ptr<RequestPeer> original_peer_; | 564 std::unique_ptr<RequestPeer> original_peer_; |
565 ResourceResponseInfo response_info_; | 565 ResourceResponseInfo response_info_; |
566 std::string data_; | 566 std::string data_; |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 ResourceResponseHead response_head; | 936 ResourceResponseHead response_head; |
937 | 937 |
938 PerformTest(response_head); | 938 PerformTest(response_head); |
939 | 939 |
940 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start); | 940 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start); |
941 EXPECT_EQ(base::TimeTicks(), | 941 EXPECT_EQ(base::TimeTicks(), |
942 response_info().load_timing.connect_timing.dns_start); | 942 response_info().load_timing.connect_timing.dns_start); |
943 } | 943 } |
944 | 944 |
945 } // namespace content | 945 } // namespace content |
OLD | NEW |