| OLD | NEW |
| 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 Loading... |
| 39 // This class wraps a mojo::AssociatedInterfacePtr<URLLoader>. It also is a | 39 // This class wraps a mojo::AssociatedInterfacePtr<URLLoader>. It also is a |
| 40 // URLLoader implementation and delegates URLLoader calls to the wrapped loader. | 40 // URLLoader implementation and delegates URLLoader calls to the wrapped loader. |
| 41 class DelegatingURLLoader final : public mojom::URLLoader { | 41 class DelegatingURLLoader final : public mojom::URLLoader { |
| 42 public: | 42 public: |
| 43 explicit DelegatingURLLoader(mojom::URLLoaderAssociatedPtr loader) | 43 explicit DelegatingURLLoader(mojom::URLLoaderAssociatedPtr loader) |
| 44 : binding_(this), loader_(std::move(loader)) {} | 44 : binding_(this), loader_(std::move(loader)) {} |
| 45 ~DelegatingURLLoader() override {} | 45 ~DelegatingURLLoader() override {} |
| 46 | 46 |
| 47 void FollowRedirect() override { loader_->FollowRedirect(); } | 47 void FollowRedirect() override { loader_->FollowRedirect(); } |
| 48 | 48 |
| 49 void SetPriority(mojom::RequestPriority priority, |
| 50 int intra_priority_value) override { |
| 51 loader_->SetPriority(priority, intra_priority_value); |
| 52 } |
| 53 |
| 49 mojom::URLLoaderPtr CreateInterfacePtrAndBind() { | 54 mojom::URLLoaderPtr CreateInterfacePtrAndBind() { |
| 50 auto p = binding_.CreateInterfacePtrAndBind(); | 55 auto p = binding_.CreateInterfacePtrAndBind(); |
| 51 // This unretained pointer is safe, because |binding_| is owned by |this| | 56 // This unretained pointer is safe, because |binding_| is owned by |this| |
| 52 // and the callback will never be called after |this| is destroyed. | 57 // and the callback will never be called after |this| is destroyed. |
| 53 binding_.set_connection_error_handler( | 58 binding_.set_connection_error_handler( |
| 54 base::Bind(&DelegatingURLLoader::Cancel, base::Unretained(this))); | 59 base::Bind(&DelegatingURLLoader::Cancel, base::Unretained(this))); |
| 55 return p; | 60 return p; |
| 56 } | 61 } |
| 57 | 62 |
| 58 private: | 63 private: |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 ServiceWorkerVersion* version, | 517 ServiceWorkerVersion* version, |
| 513 int event_finish_id, | 518 int event_finish_id, |
| 514 scoped_refptr<URLLoaderAssets> url_loader_assets, | 519 scoped_refptr<URLLoaderAssets> url_loader_assets, |
| 515 ServiceWorkerStatusCode status, | 520 ServiceWorkerStatusCode status, |
| 516 base::Time dispatch_event_time) { | 521 base::Time dispatch_event_time) { |
| 517 version->FinishRequest(event_finish_id, status != SERVICE_WORKER_ERROR_ABORT, | 522 version->FinishRequest(event_finish_id, status != SERVICE_WORKER_ERROR_ABORT, |
| 518 dispatch_event_time); | 523 dispatch_event_time); |
| 519 } | 524 } |
| 520 | 525 |
| 521 } // namespace content | 526 } // namespace content |
| OLD | NEW |