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

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

Issue 877623002: [ServiceWorker] Fills SSLInfo of the response from a SW with the SSLInfo of the SW script. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_version.h" 5 #include "content/browser/service_worker/service_worker_version.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
11 #include "content/browser/message_port_message_filter.h" 11 #include "content/browser/message_port_message_filter.h"
12 #include "content/browser/message_port_service.h" 12 #include "content/browser/message_port_service.h"
13 #include "content/browser/service_worker/embedded_worker_instance.h" 13 #include "content/browser/service_worker/embedded_worker_instance.h"
14 #include "content/browser/service_worker/embedded_worker_registry.h" 14 #include "content/browser/service_worker/embedded_worker_registry.h"
15 #include "content/browser/service_worker/service_worker_context_core.h" 15 #include "content/browser/service_worker/service_worker_context_core.h"
16 #include "content/browser/service_worker/service_worker_registration.h" 16 #include "content/browser/service_worker/service_worker_registration.h"
17 #include "content/browser/service_worker/service_worker_utils.h" 17 #include "content/browser/service_worker/service_worker_utils.h"
18 #include "content/common/service_worker/service_worker_messages.h" 18 #include "content/common/service_worker/service_worker_messages.h"
19 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
20 #include "content/public/common/content_switches.h" 20 #include "content/public/common/content_switches.h"
21 #include "net/http/http_response_info.h"
21 22
22 namespace content { 23 namespace content {
23 24
24 typedef ServiceWorkerVersion::StatusCallback StatusCallback; 25 typedef ServiceWorkerVersion::StatusCallback StatusCallback;
25 typedef ServiceWorkerVersion::MessageCallback MessageCallback; 26 typedef ServiceWorkerVersion::MessageCallback MessageCallback;
26 27
27 class ServiceWorkerVersion::GetClientDocumentsCallback 28 class ServiceWorkerVersion::GetClientDocumentsCallback
28 : public base::RefCounted<GetClientDocumentsCallback> { 29 : public base::RefCounted<GetClientDocumentsCallback> {
29 public: 30 public:
30 GetClientDocumentsCallback(int request_id, 31 GetClientDocumentsCallback(int request_id,
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 663
663 void ServiceWorkerVersion::SetDevToolsAttached(bool attached) { 664 void ServiceWorkerVersion::SetDevToolsAttached(bool attached) {
664 embedded_worker()->set_devtools_attached(attached); 665 embedded_worker()->set_devtools_attached(attached);
665 if (!attached && !stop_worker_timer_.IsRunning()) { 666 if (!attached && !stop_worker_timer_.IsRunning()) {
666 // If devtools is detached from this version and stop-worker-timer is not 667 // If devtools is detached from this version and stop-worker-timer is not
667 // running, try scheduling stop-worker-timer now. 668 // running, try scheduling stop-worker-timer now.
668 ScheduleStopWorker(); 669 ScheduleStopWorker();
669 } 670 }
670 } 671 }
671 672
673 void ServiceWorkerVersion::SetMainScriptHttpResponseInfo(
674 const net::HttpResponseInfo& http_info) {
675 main_script_http_info_.reset(new net::HttpResponseInfo(http_info));
676 }
677
678 const net::HttpResponseInfo*
679 ServiceWorkerVersion::GetMainScriptHttpResponseInfo() {
680 return main_script_http_info_.get();
681 }
682
672 void ServiceWorkerVersion::OnStarted() { 683 void ServiceWorkerVersion::OnStarted() {
673 DCHECK_EQ(RUNNING, running_status()); 684 DCHECK_EQ(RUNNING, running_status());
674 DCHECK(cache_listener_.get()); 685 DCHECK(cache_listener_.get());
675 ScheduleStopWorker(); 686 ScheduleStopWorker();
676 687
677 // Fire all start callbacks. 688 // Fire all start callbacks.
678 scoped_refptr<ServiceWorkerVersion> protect(this); 689 scoped_refptr<ServiceWorkerVersion> protect(this);
679 RunCallbacks(this, &start_callbacks_, SERVICE_WORKER_OK); 690 RunCallbacks(this, &start_callbacks_, SERVICE_WORKER_OK);
680 FOR_EACH_OBSERVER(Listener, listeners_, OnWorkerStarted(this)); 691 FOR_EACH_OBSERVER(Listener, listeners_, OnWorkerStarted(this));
681 } 692 }
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 int request_id) { 1183 int request_id) {
1173 callbacks->Remove(request_id); 1184 callbacks->Remove(request_id);
1174 if (is_doomed_) { 1185 if (is_doomed_) {
1175 // The stop should be already scheduled, but try to stop immediately, in 1186 // The stop should be already scheduled, but try to stop immediately, in
1176 // order to release worker resources soon. 1187 // order to release worker resources soon.
1177 StopWorkerIfIdle(); 1188 StopWorkerIfIdle();
1178 } 1189 }
1179 } 1190 }
1180 1191
1181 } // namespace content 1192 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698