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

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

Issue 2891453005: Pipe the FirstPartyForCookies to WorkerFetchContext for off-main-thread-fetch (Closed)
Patch Set: rebase Created 3 years, 7 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_fetch_context_impl.h" 5 #include "content/renderer/service_worker/service_worker_fetch_context_impl.h"
6 6
7 #include "content/child/request_extra_data.h" 7 #include "content/child/request_extra_data.h"
8 #include "content/child/resource_dispatcher.h" 8 #include "content/child/resource_dispatcher.h"
9 #include "content/child/web_url_loader_impl.h" 9 #include "content/child/web_url_loader_impl.h"
10 10
11 namespace content { 11 namespace content {
12 12
13 ServiceWorkerFetchContextImpl::ServiceWorkerFetchContextImpl( 13 ServiceWorkerFetchContextImpl::ServiceWorkerFetchContextImpl(
14 const GURL& worker_script_url,
14 mojom::WorkerURLLoaderFactoryProviderPtrInfo provider_info, 15 mojom::WorkerURLLoaderFactoryProviderPtrInfo provider_info,
15 int service_worker_provider_id) 16 int service_worker_provider_id)
16 : provider_info_(std::move(provider_info)), 17 : worker_script_url_(worker_script_url),
18 provider_info_(std::move(provider_info)),
17 service_worker_provider_id_(service_worker_provider_id) {} 19 service_worker_provider_id_(service_worker_provider_id) {}
18 20
19 ServiceWorkerFetchContextImpl::~ServiceWorkerFetchContextImpl() {} 21 ServiceWorkerFetchContextImpl::~ServiceWorkerFetchContextImpl() {}
20 22
21 void ServiceWorkerFetchContextImpl::InitializeOnWorkerThread( 23 void ServiceWorkerFetchContextImpl::InitializeOnWorkerThread(
22 base::SingleThreadTaskRunner* loading_task_runner) { 24 base::SingleThreadTaskRunner* loading_task_runner) {
23 DCHECK(provider_info_.is_valid()); 25 DCHECK(provider_info_.is_valid());
24 resource_dispatcher_ = 26 resource_dispatcher_ =
25 base::MakeUnique<ResourceDispatcher>(nullptr, loading_task_runner); 27 base::MakeUnique<ResourceDispatcher>(nullptr, loading_task_runner);
26 provider_.Bind(std::move(provider_info_)); 28 provider_.Bind(std::move(provider_info_));
(...skipping 20 matching lines...) Expand all
47 } 49 }
48 50
49 void ServiceWorkerFetchContextImpl::SetDataSaverEnabled(bool enabled) { 51 void ServiceWorkerFetchContextImpl::SetDataSaverEnabled(bool enabled) {
50 is_data_saver_enabled_ = enabled; 52 is_data_saver_enabled_ = enabled;
51 } 53 }
52 54
53 bool ServiceWorkerFetchContextImpl::IsDataSaverEnabled() const { 55 bool ServiceWorkerFetchContextImpl::IsDataSaverEnabled() const {
54 return is_data_saver_enabled_; 56 return is_data_saver_enabled_;
55 } 57 }
56 58
59 blink::WebURL ServiceWorkerFetchContextImpl::FirstPartyForCookies() const {
60 // According to the spec, we can use the |worker_script_url_| for
61 // FirstPartyForCookies, because "site for cookies" for the service worker is
62 // the service worker's origin's host's registrable domain.
63 // https://tools.ietf.org/html/draft-west-first-party-cookies-07#section-2.1.2
64 return worker_script_url_;
65 }
66
57 } // namespace content 67 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698