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

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: -Release 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // wrapped client. 74 // wrapped client.
75 class DelegatingURLLoaderClient final : public mojom::URLLoaderClient { 75 class DelegatingURLLoaderClient final : public mojom::URLLoaderClient {
76 public: 76 public:
77 explicit DelegatingURLLoaderClient(mojom::URLLoaderClientPtr client) 77 explicit DelegatingURLLoaderClient(mojom::URLLoaderClientPtr client)
78 : binding_(this), client_(std::move(client)) {} 78 : binding_(this), client_(std::move(client)) {}
79 ~DelegatingURLLoaderClient() override {} 79 ~DelegatingURLLoaderClient() override {}
80 80
81 void OnDataDownloaded(int64_t data_length, int64_t encoded_length) override { 81 void OnDataDownloaded(int64_t data_length, int64_t encoded_length) override {
82 client_->OnDataDownloaded(data_length, encoded_length); 82 client_->OnDataDownloaded(data_length, encoded_length);
83 } 83 }
84 void OnReceiveResponse(const ResourceResponseHead& head) override { 84 void OnReceiveResponse(
85 client_->OnReceiveResponse(head); 85 const ResourceResponseHead& head,
86 mojom::DownloadedTempFilePtr downloaded_file) override {
87 client_->OnReceiveResponse(head, std::move(downloaded_file));
86 } 88 }
87 void OnStartLoadingResponseBody( 89 void OnStartLoadingResponseBody(
88 mojo::ScopedDataPipeConsumerHandle body) override { 90 mojo::ScopedDataPipeConsumerHandle body) override {
89 client_->OnStartLoadingResponseBody(std::move(body)); 91 client_->OnStartLoadingResponseBody(std::move(body));
90 } 92 }
91 void OnComplete( 93 void OnComplete(
92 const ResourceRequestCompletionStatus& completion_status) override { 94 const ResourceRequestCompletionStatus& completion_status) override {
93 client_->OnComplete(completion_status); 95 client_->OnComplete(completion_status);
94 } 96 }
95 97
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 } 446 }
445 447
446 ServiceWorkerMetrics::EventType ServiceWorkerFetchDispatcher::GetEventType() 448 ServiceWorkerMetrics::EventType ServiceWorkerFetchDispatcher::GetEventType()
447 const { 449 const {
448 if (request_->fetch_type == ServiceWorkerFetchType::FOREIGN_FETCH) 450 if (request_->fetch_type == ServiceWorkerFetchType::FOREIGN_FETCH)
449 return ServiceWorkerMetrics::EventType::FOREIGN_FETCH; 451 return ServiceWorkerMetrics::EventType::FOREIGN_FETCH;
450 return ResourceTypeToEventType(resource_type_); 452 return ResourceTypeToEventType(resource_type_);
451 } 453 }
452 454
453 } // namespace content 455 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698