| OLD | NEW |
| 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 20 matching lines...) Expand all Loading... |
| 31 #include "content/common/origin_trials/trial_token_validator.h" | 31 #include "content/common/origin_trials/trial_token_validator.h" |
| 32 #include "content/common/service_worker/embedded_worker_messages.h" | 32 #include "content/common/service_worker/embedded_worker_messages.h" |
| 33 #include "content/common/service_worker/embedded_worker_start_params.h" | 33 #include "content/common/service_worker/embedded_worker_start_params.h" |
| 34 #include "content/common/service_worker/service_worker_messages.h" | 34 #include "content/common/service_worker/service_worker_messages.h" |
| 35 #include "content/common/service_worker/service_worker_utils.h" | 35 #include "content/common/service_worker/service_worker_utils.h" |
| 36 #include "content/public/browser/browser_thread.h" | 36 #include "content/public/browser/browser_thread.h" |
| 37 #include "content/public/browser/content_browser_client.h" | 37 #include "content/public/browser/content_browser_client.h" |
| 38 #include "content/public/browser/render_process_host.h" | 38 #include "content/public/browser/render_process_host.h" |
| 39 #include "content/public/common/browser_side_navigation_policy.h" | 39 #include "content/public/common/browser_side_navigation_policy.h" |
| 40 #include "content/public/common/content_client.h" | 40 #include "content/public/common/content_client.h" |
| 41 #include "content/public/common/content_switches.h" | 41 #include "content/public/common/content_features.h" |
| 42 #include "content/public/common/result_codes.h" | 42 #include "content/public/common/result_codes.h" |
| 43 #include "net/http/http_response_headers.h" | 43 #include "net/http/http_response_headers.h" |
| 44 #include "net/http/http_response_info.h" | 44 #include "net/http/http_response_info.h" |
| 45 #include "third_party/WebKit/public/web/WebConsoleMessage.h" | 45 #include "third_party/WebKit/public/web/WebConsoleMessage.h" |
| 46 | 46 |
| 47 namespace content { | 47 namespace content { |
| 48 | 48 |
| 49 using StatusCallback = ServiceWorkerVersion::StatusCallback; | 49 using StatusCallback = ServiceWorkerVersion::StatusCallback; |
| 50 | 50 |
| 51 namespace { | 51 namespace { |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 OnStoppedInternal(old_status); | 902 OnStoppedInternal(old_status); |
| 903 } | 903 } |
| 904 | 904 |
| 905 void ServiceWorkerVersion::OnScriptLoaded() { | 905 void ServiceWorkerVersion::OnScriptLoaded() { |
| 906 DCHECK(GetMainScriptHttpResponseInfo() || | 906 DCHECK(GetMainScriptHttpResponseInfo() || |
| 907 // TODO(scottmg|falken): This DCHECK is currently triggered in | 907 // TODO(scottmg|falken): This DCHECK is currently triggered in |
| 908 // --network-service because ServiceWorkerReadFromCacheJob isn't being | 908 // --network-service because ServiceWorkerReadFromCacheJob isn't being |
| 909 // used to retrieve the service worker js. This should be removed once | 909 // used to retrieve the service worker js. This should be removed once |
| 910 // that's done. | 910 // that's done. |
| 911 (IsBrowserSideNavigationEnabled() && | 911 (IsBrowserSideNavigationEnabled() && |
| 912 base::CommandLine::ForCurrentProcess()->HasSwitch( | 912 base::FeatureList::IsEnabled(features::kNetworkService))); |
| 913 switches::kEnableNetworkService))); | |
| 914 if (IsInstalled(status())) | 913 if (IsInstalled(status())) |
| 915 UMA_HISTOGRAM_BOOLEAN("ServiceWorker.ScriptLoadSuccess", true); | 914 UMA_HISTOGRAM_BOOLEAN("ServiceWorker.ScriptLoadSuccess", true); |
| 916 } | 915 } |
| 917 | 916 |
| 918 void ServiceWorkerVersion::OnScriptLoadFailed() { | 917 void ServiceWorkerVersion::OnScriptLoadFailed() { |
| 919 if (IsInstalled(status())) | 918 if (IsInstalled(status())) |
| 920 UMA_HISTOGRAM_BOOLEAN("ServiceWorker.ScriptLoadSuccess", false); | 919 UMA_HISTOGRAM_BOOLEAN("ServiceWorker.ScriptLoadSuccess", false); |
| 921 } | 920 } |
| 922 | 921 |
| 923 void ServiceWorkerVersion::OnRegisteredToDevToolsManager() { | 922 void ServiceWorkerVersion::OnRegisteredToDevToolsManager() { |
| (...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1855 | 1854 |
| 1856 void ServiceWorkerVersion::CleanUpExternalRequest( | 1855 void ServiceWorkerVersion::CleanUpExternalRequest( |
| 1857 const std::string& request_uuid, | 1856 const std::string& request_uuid, |
| 1858 ServiceWorkerStatusCode status) { | 1857 ServiceWorkerStatusCode status) { |
| 1859 if (status == SERVICE_WORKER_OK) | 1858 if (status == SERVICE_WORKER_OK) |
| 1860 return; | 1859 return; |
| 1861 external_request_uuid_to_request_id_.erase(request_uuid); | 1860 external_request_uuid_to_request_id_.erase(request_uuid); |
| 1862 } | 1861 } |
| 1863 | 1862 |
| 1864 } // namespace content | 1863 } // namespace content |
| OLD | NEW |