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

Side by Side Diff: content/public/browser/service_worker_context.h

Issue 2575523002: Prerender: Confirm ServiceWorkers are invoked for NoState Prefetch (Closed)
Patch Set: Check that SW runs rather than disabling Created 3 years, 11 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_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_
6 #define CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ 6 #define CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // specified |origin| via |callback|. 118 // specified |origin| via |callback|.
119 virtual void CountExternalRequestsForTest( 119 virtual void CountExternalRequestsForTest(
120 const GURL& origin, 120 const GURL& origin,
121 const CountExternalRequestsCallback& callback) = 0; 121 const CountExternalRequestsCallback& callback) = 0;
122 122
123 // Stops all running workers on the given |origin|. 123 // Stops all running workers on the given |origin|.
124 // 124 //
125 // This function can be called from any thread. 125 // This function can be called from any thread.
126 virtual void StopAllServiceWorkersForOrigin(const GURL& origin) = 0; 126 virtual void StopAllServiceWorkersForOrigin(const GURL& origin) = 0;
127 127
128 // As above, but |callback| is exectued when a running worker is stopped. If
pasko 2017/01/02 18:15:36 nit: s/exectued/executed/
mattcary 2017/01/03 09:00:03 Done.
129 // there is no running worker, |callback| will never be executed.
pasko 2017/01/02 18:15:36 My personal preference would be with _always_ invo
mattcary 2017/01/03 09:00:03 Given its current use in a test these semantics wo
130 virtual void StopAllServiceWorkersForOriginWithCallback(
131 const GURL& origin,
132 const base::Closure& callback) = 0;
133
128 // Stops all running service workers and unregisters all service worker 134 // Stops all running service workers and unregisters all service worker
129 // registrations. This method is used in LayoutTests to make sure that the 135 // registrations. This method is used in LayoutTests to make sure that the
130 // existing service worker will not affect the succeeding tests. 136 // existing service worker will not affect the succeeding tests.
131 // 137 //
132 // This function can be called from any thread, but the callback will always 138 // This function can be called from any thread, but the callback will always
133 // be called on the UI thread. 139 // be called on the UI thread.
134 virtual void ClearAllServiceWorkersForTest(const base::Closure& callback) = 0; 140 virtual void ClearAllServiceWorkersForTest(const base::Closure& callback) = 0;
135 141
136 // Starts a Service Worker for |document_url| for a navigation hint in the 142 // Starts a Service Worker for |document_url| for a navigation hint in the
137 // specified render process |render_process_id|. Must be called from the UI 143 // specified render process |render_process_id|. Must be called from the UI
138 // thread. The |callback| will always be called on the UI thread. 144 // thread. The |callback| will always be called on the UI thread.
139 // This method can fail if: 145 // This method can fail if:
140 // * No Service Worker was registered for |document_url|. 146 // * No Service Worker was registered for |document_url|.
141 // * The specified render process is not suitable for loading |document_url|. 147 // * The specified render process is not suitable for loading |document_url|.
142 virtual void StartServiceWorkerForNavigationHint( 148 virtual void StartServiceWorkerForNavigationHint(
143 const GURL& document_url, 149 const GURL& document_url,
144 blink::WebNavigationHintType type, 150 blink::WebNavigationHintType type,
145 int render_process_id, 151 int render_process_id,
146 const ResultCallback& callback) = 0; 152 const ResultCallback& callback) = 0;
147 153
148 protected: 154 protected:
149 ServiceWorkerContext() {} 155 ServiceWorkerContext() {}
150 virtual ~ServiceWorkerContext() {} 156 virtual ~ServiceWorkerContext() {}
151 }; 157 };
152 158
153 } // namespace content 159 } // namespace content
154 160
155 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ 161 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698