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

Side by Side Diff: content/renderer/service_worker/service_worker_context_client.cc

Issue 2943463002: Implement dumb URLLoader{Factory} for ServiceWorker script loading (Closed)
Patch Set: rebased Created 3 years, 6 months 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
« no previous file with comments | « content/common/service_worker/service_worker_provider.mojom ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/renderer/service_worker/service_worker_context_client.h" 5 #include "content/renderer/service_worker/service_worker_context_client.h"
6 6
7 #include <map> 7 #include <map>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 // Blink calls this method for each request starting with the main script, 94 // Blink calls this method for each request starting with the main script,
95 // we tag them with the provider id. 95 // we tag them with the provider id.
96 void WillSendRequest(blink::WebURLRequest& request) override { 96 void WillSendRequest(blink::WebURLRequest& request) override {
97 std::unique_ptr<RequestExtraData> extra_data(new RequestExtraData); 97 std::unique_ptr<RequestExtraData> extra_data(new RequestExtraData);
98 extra_data->set_service_worker_provider_id(provider_->provider_id()); 98 extra_data->set_service_worker_provider_id(provider_->provider_id());
99 extra_data->set_originated_from_service_worker(true); 99 extra_data->set_originated_from_service_worker(true);
100 // Service workers are only available in secure contexts, so all requests 100 // Service workers are only available in secure contexts, so all requests
101 // are initiated in a secure context. 101 // are initiated in a secure context.
102 extra_data->set_initiated_in_secure_context(true); 102 extra_data->set_initiated_in_secure_context(true);
103 extra_data->set_url_loader_factory_override(
104 provider_->script_loader_factory());
103 request.SetExtraData(extra_data.release()); 105 request.SetExtraData(extra_data.release());
104 } 106 }
105 107
106 int GetProviderID() const override { return provider_->provider_id(); } 108 int GetProviderID() const override { return provider_->provider_id(); }
107 109
108 private: 110 private:
109 std::unique_ptr<ServiceWorkerNetworkProvider> provider_; 111 std::unique_ptr<ServiceWorkerNetworkProvider> provider_;
110 }; 112 };
111 113
112 class StreamHandleListener 114 class StreamHandleListener
(...skipping 1573 matching lines...) Expand 10 before | Expand all | Expand 10 after
1686 } 1688 }
1687 1689
1688 base::WeakPtr<ServiceWorkerContextClient> 1690 base::WeakPtr<ServiceWorkerContextClient>
1689 ServiceWorkerContextClient::GetWeakPtr() { 1691 ServiceWorkerContextClient::GetWeakPtr() {
1690 DCHECK(worker_task_runner_->RunsTasksInCurrentSequence()); 1692 DCHECK(worker_task_runner_->RunsTasksInCurrentSequence());
1691 DCHECK(context_); 1693 DCHECK(context_);
1692 return context_->weak_factory.GetWeakPtr(); 1694 return context_->weak_factory.GetWeakPtr();
1693 } 1695 }
1694 1696
1695 } // namespace content 1697 } // namespace content
OLDNEW
« no previous file with comments | « content/common/service_worker/service_worker_provider.mojom ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698