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

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

Issue 2906163002: [network service][SW] Rework browser-side SW on top of URL loader chaining (Closed)
Patch Set: fixes 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/browser/service_worker/service_worker_url_job_wrapper.cc ('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 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <map> 10 #include <map>
(...skipping 24 matching lines...) Expand all
35 #include "content/browser/service_worker/service_worker_metrics.h" 35 #include "content/browser/service_worker/service_worker_metrics.h"
36 #include "content/browser/service_worker/service_worker_registration.h" 36 #include "content/browser/service_worker/service_worker_registration.h"
37 #include "content/common/origin_trials/trial_token_validator.h" 37 #include "content/common/origin_trials/trial_token_validator.h"
38 #include "content/common/service_worker/embedded_worker_messages.h" 38 #include "content/common/service_worker/embedded_worker_messages.h"
39 #include "content/common/service_worker/embedded_worker_start_params.h" 39 #include "content/common/service_worker/embedded_worker_start_params.h"
40 #include "content/common/service_worker/service_worker_messages.h" 40 #include "content/common/service_worker/service_worker_messages.h"
41 #include "content/common/service_worker/service_worker_utils.h" 41 #include "content/common/service_worker/service_worker_utils.h"
42 #include "content/public/browser/browser_thread.h" 42 #include "content/public/browser/browser_thread.h"
43 #include "content/public/browser/content_browser_client.h" 43 #include "content/public/browser/content_browser_client.h"
44 #include "content/public/browser/render_process_host.h" 44 #include "content/public/browser/render_process_host.h"
45 #include "content/public/common/browser_side_navigation_policy.h"
45 #include "content/public/common/content_client.h" 46 #include "content/public/common/content_client.h"
46 #include "content/public/common/content_switches.h" 47 #include "content/public/common/content_switches.h"
47 #include "content/public/common/result_codes.h" 48 #include "content/public/common/result_codes.h"
48 #include "net/http/http_response_headers.h" 49 #include "net/http/http_response_headers.h"
49 #include "net/http/http_response_info.h" 50 #include "net/http/http_response_info.h"
50 #include "third_party/WebKit/public/web/WebConsoleMessage.h" 51 #include "third_party/WebKit/public/web/WebConsoleMessage.h"
51 52
52 namespace content { 53 namespace content {
53 54
54 using StatusCallback = ServiceWorkerVersion::StatusCallback; 55 using StatusCallback = ServiceWorkerVersion::StatusCallback;
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 897
897 void ServiceWorkerVersion::OnDetached(EmbeddedWorkerStatus old_status) { 898 void ServiceWorkerVersion::OnDetached(EmbeddedWorkerStatus old_status) {
898 if (IsInstalled(status())) { 899 if (IsInstalled(status())) {
899 ServiceWorkerMetrics::RecordWorkerStopped( 900 ServiceWorkerMetrics::RecordWorkerStopped(
900 ServiceWorkerMetrics::StopStatus::DETACH_BY_REGISTRY); 901 ServiceWorkerMetrics::StopStatus::DETACH_BY_REGISTRY);
901 } 902 }
902 OnStoppedInternal(old_status); 903 OnStoppedInternal(old_status);
903 } 904 }
904 905
905 void ServiceWorkerVersion::OnScriptLoaded() { 906 void ServiceWorkerVersion::OnScriptLoaded() {
906 DCHECK(GetMainScriptHttpResponseInfo()); 907 DCHECK(GetMainScriptHttpResponseInfo() ||
908 // TODO(scottmg|falken): This DCHECK is currently triggered in
909 // --network-service because ServiceWorkerReadFromCacheJob isn't being
910 // used to retrieve the service worker js. This should be removed once
911 // that's done.
912 (IsBrowserSideNavigationEnabled() &&
913 base::CommandLine::ForCurrentProcess()->HasSwitch(
914 switches::kEnableNetworkService)));
907 if (IsInstalled(status())) 915 if (IsInstalled(status()))
908 UMA_HISTOGRAM_BOOLEAN("ServiceWorker.ScriptLoadSuccess", true); 916 UMA_HISTOGRAM_BOOLEAN("ServiceWorker.ScriptLoadSuccess", true);
909 } 917 }
910 918
911 void ServiceWorkerVersion::OnScriptLoadFailed() { 919 void ServiceWorkerVersion::OnScriptLoadFailed() {
912 if (IsInstalled(status())) 920 if (IsInstalled(status()))
913 UMA_HISTOGRAM_BOOLEAN("ServiceWorker.ScriptLoadSuccess", false); 921 UMA_HISTOGRAM_BOOLEAN("ServiceWorker.ScriptLoadSuccess", false);
914 } 922 }
915 923
916 void ServiceWorkerVersion::OnRegisteredToDevToolsManager() { 924 void ServiceWorkerVersion::OnRegisteredToDevToolsManager() {
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after
1841 1849
1842 void ServiceWorkerVersion::CleanUpExternalRequest( 1850 void ServiceWorkerVersion::CleanUpExternalRequest(
1843 const std::string& request_uuid, 1851 const std::string& request_uuid,
1844 ServiceWorkerStatusCode status) { 1852 ServiceWorkerStatusCode status) {
1845 if (status == SERVICE_WORKER_OK) 1853 if (status == SERVICE_WORKER_OK)
1846 return; 1854 return;
1847 external_request_uuid_to_request_id_.erase(request_uuid); 1855 external_request_uuid_to_request_id_.erase(request_uuid);
1848 } 1856 }
1849 1857
1850 } // namespace content 1858 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_url_job_wrapper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698