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

Side by Side Diff: content/browser/service_worker/service_worker_fetch_dispatcher.cc

Issue 2503813002: Fix and refactor downloaded file handling in the loading stack (Closed)
Patch Set: revert an unrelated change Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/service_worker/service_worker_fetch_dispatcher.h" 5 #include "content/browser/service_worker/service_worker_fetch_dispatcher.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // wrapped client. 64 // wrapped client.
65 class DelegatingURLLoaderClient final : public mojom::URLLoaderClient { 65 class DelegatingURLLoaderClient final : public mojom::URLLoaderClient {
66 public: 66 public:
67 explicit DelegatingURLLoaderClient(mojom::URLLoaderClientPtr client) 67 explicit DelegatingURLLoaderClient(mojom::URLLoaderClientPtr client)
68 : binding_(this), client_(std::move(client)) {} 68 : binding_(this), client_(std::move(client)) {}
69 ~DelegatingURLLoaderClient() override {} 69 ~DelegatingURLLoaderClient() override {}
70 70
71 void OnDataDownloaded(int64_t data_length, int64_t encoded_length) override { 71 void OnDataDownloaded(int64_t data_length, int64_t encoded_length) override {
72 client_->OnDataDownloaded(data_length, encoded_length); 72 client_->OnDataDownloaded(data_length, encoded_length);
73 } 73 }
74 void OnReceiveResponse(const ResourceResponseHead& head) override { 74 void OnReceiveResponse(
75 client_->OnReceiveResponse(head); 75 const ResourceResponseHead& head,
76 mojom::DownloadedTempFilePtr downloaded_file) override {
77 client_->OnReceiveResponse(head, std::move(downloaded_file));
76 } 78 }
77 void OnStartLoadingResponseBody( 79 void OnStartLoadingResponseBody(
78 mojo::ScopedDataPipeConsumerHandle body) override { 80 mojo::ScopedDataPipeConsumerHandle body) override {
79 client_->OnStartLoadingResponseBody(std::move(body)); 81 client_->OnStartLoadingResponseBody(std::move(body));
80 } 82 }
81 void OnComplete( 83 void OnComplete(
82 const ResourceRequestCompletionStatus& completion_status) override { 84 const ResourceRequestCompletionStatus& completion_status) override {
83 client_->OnComplete(completion_status); 85 client_->OnComplete(completion_status);
84 } 86 }
85 87
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 } 436 }
435 437
436 ServiceWorkerMetrics::EventType ServiceWorkerFetchDispatcher::GetEventType() 438 ServiceWorkerMetrics::EventType ServiceWorkerFetchDispatcher::GetEventType()
437 const { 439 const {
438 if (request_->fetch_type == ServiceWorkerFetchType::FOREIGN_FETCH) 440 if (request_->fetch_type == ServiceWorkerFetchType::FOREIGN_FETCH)
439 return ServiceWorkerMetrics::EventType::FOREIGN_FETCH; 441 return ServiceWorkerMetrics::EventType::FOREIGN_FETCH;
440 return ResourceTypeToEventType(resource_type_); 442 return ResourceTypeToEventType(resource_type_);
441 } 443 }
442 444
443 } // namespace content 445 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698