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

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

Issue 2045153003: Speculatively launch Service Workers on mouse/touch events. [4/5] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add test Created 4 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_METRICS_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 EXISTING_PROCESS, 129 EXISTING_PROCESS,
130 NEW_PROCESS 130 NEW_PROCESS
131 }; 131 };
132 132
133 // Not used for UMA. 133 // Not used for UMA.
134 enum class LoadSource { NETWORK, HTTP_CACHE, SERVICE_WORKER_STORAGE }; 134 enum class LoadSource { NETWORK, HTTP_CACHE, SERVICE_WORKER_STORAGE };
135 135
136 // Converts an event type to a string. Used for tracing. 136 // Converts an event type to a string. Used for tracing.
137 static const char* EventTypeToString(EventType event_type); 137 static const char* EventTypeToString(EventType event_type);
138 138
139 // Returns true when the event is for a navigation hint.
140 static bool IsNavigationHintEvent(EventType event_type);
141
139 // Excludes NTP scope from UMA for now as it tends to dominate the stats and 142 // Excludes NTP scope from UMA for now as it tends to dominate the stats and
140 // makes the results largely skewed. Some metrics don't follow this policy 143 // makes the results largely skewed. Some metrics don't follow this policy
141 // and hence don't call this function. 144 // and hence don't call this function.
142 static bool ShouldExcludeSiteFromHistogram(Site site); 145 static bool ShouldExcludeSiteFromHistogram(Site site);
143 static bool ShouldExcludeURLFromHistogram(const GURL& url); 146 static bool ShouldExcludeURLFromHistogram(const GURL& url);
144 147
145 // Used for ServiceWorkerDiskCache. 148 // Used for ServiceWorkerDiskCache.
146 static void CountInitDiskCacheResult(bool result); 149 static void CountInitDiskCacheResult(bool result);
147 static void CountReadResponseResult(ReadResponseResult result); 150 static void CountReadResponseResult(ReadResponseResult result);
148 static void CountWriteResponseResult(WriteResponseResult result); 151 static void CountWriteResponseResult(WriteResponseResult result);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 static void RecordActivateEventStatus(ServiceWorkerStatusCode status, 194 static void RecordActivateEventStatus(ServiceWorkerStatusCode status,
192 bool is_shutdown); 195 bool is_shutdown);
193 static void RecordInstallEventStatus(ServiceWorkerStatusCode status); 196 static void RecordInstallEventStatus(ServiceWorkerStatusCode status);
194 197
195 // Records how much of dispatched events are handled while a Service 198 // Records how much of dispatched events are handled while a Service
196 // Worker is awake (i.e. after it is woken up until it gets stopped). 199 // Worker is awake (i.e. after it is woken up until it gets stopped).
197 static void RecordEventHandledRatio(EventType event, 200 static void RecordEventHandledRatio(EventType event,
198 size_t handled_events, 201 size_t handled_events,
199 size_t fired_events); 202 size_t fired_events);
200 203
204 // Records the precision of the speculative launch of Service Workers for
205 // each navigation hint type when the worker is stopped. If there was no
206 // event fetched to the worker, |event_fired| is false. This means that the
nhiroki 2016/07/28 05:38:37 fetched to -> fired on?
horo 2016/07/28 08:15:48 Done.
207 // speculative launch was meaningless.
nhiroki 2016/07/28 05:38:37 'meaningless' sounds somewhat negative. How about
horo 2016/07/28 08:15:48 Done.
208 static void RecordNavigationHintPrecision(EventType start_worker_purpose,
209 bool event_fired);
210
201 // Records how often a dispatched event times out. 211 // Records how often a dispatched event times out.
202 static void RecordEventTimeout(EventType event); 212 static void RecordEventTimeout(EventType event);
203 213
204 // Records the amount of time spent handling an event. 214 // Records the amount of time spent handling an event.
205 static void RecordEventDuration(EventType event, 215 static void RecordEventDuration(EventType event,
206 base::TimeDelta time, 216 base::TimeDelta time,
207 bool was_handled); 217 bool was_handled);
208 218
209 // Records the result of dispatching a fetch event to a service worker. 219 // Records the result of dispatching a fetch event to a service worker.
210 static void RecordFetchEventStatus(bool is_main_resource, 220 static void RecordFetchEventStatus(bool is_main_resource,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 static void RecordStartStatusAfterFailure(int failure_count, 262 static void RecordStartStatusAfterFailure(int failure_count,
253 ServiceWorkerStatusCode status); 263 ServiceWorkerStatusCode status);
254 264
255 private: 265 private:
256 DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceWorkerMetrics); 266 DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceWorkerMetrics);
257 }; 267 };
258 268
259 } // namespace content 269 } // namespace content
260 270
261 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_ 271 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698