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

Side by Side Diff: content/browser/service_worker/service_worker_response_info.h

Issue 2684933011: M57: Add UseCounter for ServiceWorkerNavigationPreload. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_response_info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_RESPONSE_INFO_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_RESPONSE_INFO_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_RESPONSE_INFO_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_RESPONSE_INFO_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/supports_user_data.h" 10 #include "base/supports_user_data.h"
(...skipping 14 matching lines...) Expand all
25 : public base::SupportsUserData::Data { 25 : public base::SupportsUserData::Data {
26 public: 26 public:
27 static ServiceWorkerResponseInfo* ForRequest(net::URLRequest* request, 27 static ServiceWorkerResponseInfo* ForRequest(net::URLRequest* request,
28 bool create = false); 28 bool create = false);
29 static void ResetDataForRequest(net::URLRequest* request); 29 static void ResetDataForRequest(net::URLRequest* request);
30 30
31 ~ServiceWorkerResponseInfo() override; 31 ~ServiceWorkerResponseInfo() override;
32 32
33 void GetExtraResponseInfo(ResourceResponseInfo* response_info) const; 33 void GetExtraResponseInfo(ResourceResponseInfo* response_info) const;
34 void OnPrepareToRestart(base::TimeTicks service_worker_start_time, 34 void OnPrepareToRestart(base::TimeTicks service_worker_start_time,
35 base::TimeTicks service_worker_ready_time); 35 base::TimeTicks service_worker_ready_time,
36 bool did_navigation_preload);
36 void OnStartCompleted( 37 void OnStartCompleted(
37 bool was_fetched_via_service_worker, 38 bool was_fetched_via_service_worker,
38 bool was_fetched_via_foreign_fetch, 39 bool was_fetched_via_foreign_fetch,
39 bool was_fallback_required, 40 bool was_fallback_required,
40 const std::vector<GURL>& url_list_via_service_worker, 41 const std::vector<GURL>& url_list_via_service_worker,
41 blink::WebServiceWorkerResponseType response_type_via_service_worker, 42 blink::WebServiceWorkerResponseType response_type_via_service_worker,
42 base::TimeTicks service_worker_start_time, 43 base::TimeTicks service_worker_start_time,
43 base::TimeTicks service_worker_ready_time, 44 base::TimeTicks service_worker_ready_time,
44 bool response_is_in_cache_storage, 45 bool response_is_in_cache_storage,
45 const std::string& response_cache_storage_cache_name, 46 const std::string& response_cache_storage_cache_name,
46 const ServiceWorkerHeaderList& cors_exposed_header_names); 47 const ServiceWorkerHeaderList& cors_exposed_header_names,
48 bool did_navigation_preload);
47 void ResetData(); 49 void ResetData();
48 50
49 // Returns true if a service worker responded to the request. If the service 51 // Returns true if a service worker responded to the request. If the service
50 // worker received a fetch event and did not call respondWith(), or was 52 // worker received a fetch event and did not call respondWith(), or was
51 // bypassed due to absence of a fetch event handler, this function 53 // bypassed due to absence of a fetch event handler, this function
52 // typically returns false but returns true if "fallback to renderer" was 54 // typically returns false but returns true if "fallback to renderer" was
53 // required (however in this case the response is not an actual resource and 55 // required (however in this case the response is not an actual resource and
54 // the request will be reissued by the renderer). 56 // the request will be reissued by the renderer).
55 bool was_fetched_via_service_worker() const { 57 bool was_fetched_via_service_worker() const {
56 return was_fetched_via_service_worker_; 58 return was_fetched_via_service_worker_;
(...skipping 25 matching lines...) Expand all
82 } 84 }
83 base::TimeTicks service_worker_ready_time() const { 85 base::TimeTicks service_worker_ready_time() const {
84 return service_worker_ready_time_; 86 return service_worker_ready_time_;
85 } 87 }
86 bool response_is_in_cache_storage() const { 88 bool response_is_in_cache_storage() const {
87 return response_is_in_cache_storage_; 89 return response_is_in_cache_storage_;
88 } 90 }
89 const std::string& response_cache_storage_cache_name() const { 91 const std::string& response_cache_storage_cache_name() const {
90 return response_cache_storage_cache_name_; 92 return response_cache_storage_cache_name_;
91 } 93 }
94 bool did_navigation_preload() const { return did_navigation_preload_; }
92 95
93 private: 96 private:
94 ServiceWorkerResponseInfo(); 97 ServiceWorkerResponseInfo();
95 98
96 bool was_fetched_via_service_worker_ = false; 99 bool was_fetched_via_service_worker_ = false;
97 bool was_fetched_via_foreign_fetch_ = false; 100 bool was_fetched_via_foreign_fetch_ = false;
98 bool was_fallback_required_ = false; 101 bool was_fallback_required_ = false;
99 std::vector<GURL> url_list_via_service_worker_; 102 std::vector<GURL> url_list_via_service_worker_;
100 blink::WebServiceWorkerResponseType response_type_via_service_worker_ = 103 blink::WebServiceWorkerResponseType response_type_via_service_worker_ =
101 blink::WebServiceWorkerResponseTypeDefault; 104 blink::WebServiceWorkerResponseTypeDefault;
102 base::TimeTicks service_worker_start_time_; 105 base::TimeTicks service_worker_start_time_;
103 base::TimeTicks service_worker_ready_time_; 106 base::TimeTicks service_worker_ready_time_;
104 bool response_is_in_cache_storage_ = false; 107 bool response_is_in_cache_storage_ = false;
105 std::string response_cache_storage_cache_name_; 108 std::string response_cache_storage_cache_name_;
106 ServiceWorkerHeaderList cors_exposed_header_names_; 109 ServiceWorkerHeaderList cors_exposed_header_names_;
110 bool did_navigation_preload_ = false;
107 }; 111 };
108 112
109 } // namespace content 113 } // namespace content
110 114
111 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_RESPONSE_INFO_H_ 115 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_RESPONSE_INFO_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_response_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698