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

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

Issue 2211783003: Track input latency while starting a ServiceWorker for a navigation hint. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comment 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 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 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 void UpdateRegistration(const GURL& pattern); 181 void UpdateRegistration(const GURL& pattern);
182 void SetForceUpdateOnPageLoad(bool force_update_on_page_load); 182 void SetForceUpdateOnPageLoad(bool force_update_on_page_load);
183 void AddObserver(ServiceWorkerContextObserver* observer); 183 void AddObserver(ServiceWorkerContextObserver* observer);
184 void RemoveObserver(ServiceWorkerContextObserver* observer); 184 void RemoveObserver(ServiceWorkerContextObserver* observer);
185 185
186 bool is_incognito() const { return is_incognito_; } 186 bool is_incognito() const { return is_incognito_; }
187 187
188 // Must be called from the IO thread. 188 // Must be called from the IO thread.
189 bool OriginHasForeignFetchRegistrations(const GURL& origin); 189 bool OriginHasForeignFetchRegistrations(const GURL& origin);
190 190
191 // Must be called from the UI thread.
192 bool IsRunningNavigationHintTask(int render_process_id) const;
193
191 private: 194 private:
192 friend class BackgroundSyncManagerTest; 195 friend class BackgroundSyncManagerTest;
193 friend class base::RefCountedThreadSafe<ServiceWorkerContextWrapper>; 196 friend class base::RefCountedThreadSafe<ServiceWorkerContextWrapper>;
194 friend class EmbeddedWorkerTestHelper; 197 friend class EmbeddedWorkerTestHelper;
195 friend class EmbeddedWorkerBrowserTest; 198 friend class EmbeddedWorkerBrowserTest;
196 friend class ServiceWorkerDispatcherHost; 199 friend class ServiceWorkerDispatcherHost;
197 friend class ServiceWorkerInternalsUI; 200 friend class ServiceWorkerInternalsUI;
198 friend class ServiceWorkerNavigationHandleCore; 201 friend class ServiceWorkerNavigationHandleCore;
199 friend class ServiceWorkerProcessManager; 202 friend class ServiceWorkerProcessManager;
200 friend class ServiceWorkerRequestHandler; 203 friend class ServiceWorkerRequestHandler;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 blink::WebNavigationHintType type, 245 blink::WebNavigationHintType type,
243 int render_process_id, 246 int render_process_id,
244 const ResultCallback& callback, 247 const ResultCallback& callback,
245 ServiceWorkerStatusCode status, 248 ServiceWorkerStatusCode status,
246 scoped_refptr<ServiceWorkerRegistration> registration); 249 scoped_refptr<ServiceWorkerRegistration> registration);
247 250
248 void DidStartServiceWorkerForNavigationHint(const GURL& pattern, 251 void DidStartServiceWorkerForNavigationHint(const GURL& pattern,
249 int render_process_id, 252 int render_process_id,
250 const ResultCallback& callback, 253 const ResultCallback& callback,
251 ServiceWorkerStatusCode code); 254 ServiceWorkerStatusCode code);
255 void DidFinishNavigationHintTaskOnUI(int render_process_id,
256 const ResultCallback& callback,
257 bool result);
252 258
253 // The core context is only for use on the IO thread. 259 // The core context is only for use on the IO thread.
254 // Can be null before/during init, during/after shutdown, and after 260 // Can be null before/during init, during/after shutdown, and after
255 // DeleteAndStartOver fails. 261 // DeleteAndStartOver fails.
256 ServiceWorkerContextCore* context(); 262 ServiceWorkerContextCore* context();
257 263
258 const scoped_refptr<base::ObserverListThreadSafe< 264 const scoped_refptr<base::ObserverListThreadSafe<
259 ServiceWorkerContextObserver>> observer_list_; 265 ServiceWorkerContextObserver>> observer_list_;
260 const std::unique_ptr<ServiceWorkerProcessManager> process_manager_; 266 const std::unique_ptr<ServiceWorkerProcessManager> process_manager_;
261 // Cleared in ShutdownOnIO(): 267 // Cleared in ShutdownOnIO():
262 std::unique_ptr<ServiceWorkerContextCore> context_core_; 268 std::unique_ptr<ServiceWorkerContextCore> context_core_;
263 269
264 // Initialized in Init(); true if the user data directory is empty. 270 // Initialized in Init(); true if the user data directory is empty.
265 bool is_incognito_; 271 bool is_incognito_;
266 272
267 // Raw pointer to the StoragePartitionImpl owning |this|. 273 // Raw pointer to the StoragePartitionImpl owning |this|.
268 StoragePartitionImpl* storage_partition_; 274 StoragePartitionImpl* storage_partition_;
269 275
270 // The ResourceContext associated with this context. 276 // The ResourceContext associated with this context.
271 ResourceContext* resource_context_; 277 ResourceContext* resource_context_;
272 278
279 // Must be touched on the UI thread.
280 std::map<int, int> navigation_hint_task_count_per_process_;
281
273 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextWrapper); 282 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextWrapper);
274 }; 283 };
275 284
276 } // namespace content 285 } // namespace content
277 286
278 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ 287 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698