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

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

Issue 2466843002: Cancel the request when URLLoader is gone (Closed)
Patch Set: fix 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 28 matching lines...) Expand all
39 39
40 // This class wraps a mojo::AssociatedInterfacePtr<URLLoader>. It also is a 40 // This class wraps a mojo::AssociatedInterfacePtr<URLLoader>. It also is a
41 // URLLoader implementation and delegates URLLoader calls to the wrapped loader. 41 // URLLoader implementation and delegates URLLoader calls to the wrapped loader.
42 class DelegatingURLLoader final : public mojom::URLLoader { 42 class DelegatingURLLoader final : public mojom::URLLoader {
43 public: 43 public:
44 explicit DelegatingURLLoader(mojom::URLLoaderAssociatedPtr loader) 44 explicit DelegatingURLLoader(mojom::URLLoaderAssociatedPtr loader)
45 : binding_(this), loader_(std::move(loader)) {} 45 : binding_(this), loader_(std::move(loader)) {}
46 ~DelegatingURLLoader() override {} 46 ~DelegatingURLLoader() override {}
47 47
48 void FollowRedirect() override { loader_->FollowRedirect(); } 48 void FollowRedirect() override { loader_->FollowRedirect(); }
49 void Cancel() override { loader_->Cancel(); }
50 49
51 mojom::URLLoaderPtr CreateInterfacePtrAndBind() { 50 mojom::URLLoaderPtr CreateInterfacePtrAndBind() {
52 return binding_.CreateInterfacePtrAndBind(); 51 return binding_.CreateInterfacePtrAndBind();
53 } 52 }
54 53
55 private: 54 private:
56 mojo::Binding<mojom::URLLoader> binding_; 55 mojo::Binding<mojom::URLLoader> binding_;
57 mojom::URLLoaderAssociatedPtr loader_; 56 mojom::URLLoaderAssociatedPtr loader_;
58 57
59 DISALLOW_COPY_AND_ASSIGN(DelegatingURLLoader); 58 DISALLOW_COPY_AND_ASSIGN(DelegatingURLLoader);
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 } 433 }
435 434
436 ServiceWorkerMetrics::EventType ServiceWorkerFetchDispatcher::GetEventType() 435 ServiceWorkerMetrics::EventType ServiceWorkerFetchDispatcher::GetEventType()
437 const { 436 const {
438 if (request_->fetch_type == ServiceWorkerFetchType::FOREIGN_FETCH) 437 if (request_->fetch_type == ServiceWorkerFetchType::FOREIGN_FETCH)
439 return ServiceWorkerMetrics::EventType::FOREIGN_FETCH; 438 return ServiceWorkerMetrics::EventType::FOREIGN_FETCH;
440 return ResourceTypeToEventType(resource_type_); 439 return ResourceTypeToEventType(resource_type_);
441 } 440 }
442 441
443 } // namespace content 442 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698