OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 29 matching lines...) Expand all Loading... |
40 #include "public/platform/WebServiceWorkerSkipWaitingCallbacks.h" | 40 #include "public/platform/WebServiceWorkerSkipWaitingCallbacks.h" |
41 #include "public/platform/WebURL.h" | 41 #include "public/platform/WebURL.h" |
42 | 42 |
43 namespace blink { | 43 namespace blink { |
44 | 44 |
45 struct WebCrossOriginServiceWorkerClient; | 45 struct WebCrossOriginServiceWorkerClient; |
46 class WebDataSource; | 46 class WebDataSource; |
47 class WebServiceWorkerCacheStorage; | 47 class WebServiceWorkerCacheStorage; |
48 class WebServiceWorkerContextProxy; | 48 class WebServiceWorkerContextProxy; |
49 class WebServiceWorkerNetworkProvider; | 49 class WebServiceWorkerNetworkProvider; |
| 50 class WebServiceWorkerProvider; |
50 class WebServiceWorkerResponse; | 51 class WebServiceWorkerResponse; |
51 class WebString; | 52 class WebString; |
52 | 53 |
53 // This interface is implemented by the client. It is supposed to be created | 54 // This interface is implemented by the client. It is supposed to be created |
54 // on the main thread and then passed on to the worker thread. | 55 // on the main thread and then passed on to the worker thread by a newly |
55 // by a newly created WorkerGlobalScope. All methods of this class, except | 56 // created WorkerGlobalScope. Unless otherwise noted, all methods of this class |
56 // for createServiceWorkerNetworkProvider() and workerContextFailedToStart(), | |
57 // are called on the worker thread. | 57 // are called on the worker thread. |
| 58 // |
58 // FIXME: Split this into EmbeddedWorkerContextClient and | 59 // FIXME: Split this into EmbeddedWorkerContextClient and |
59 // ServiceWorkerScriptContextClient when we decide to use EmbeddedWorker | 60 // ServiceWorkerScriptContextClient when we decide to use EmbeddedWorker |
60 // framework for other implementation (like SharedWorker). | 61 // framework for other implementation (like SharedWorker). |
61 class WebServiceWorkerContextClient { | 62 class WebServiceWorkerContextClient { |
62 public: | 63 public: |
63 virtual ~WebServiceWorkerContextClient() { } | 64 virtual ~WebServiceWorkerContextClient() { } |
64 | 65 |
65 // ServiceWorker specific method. | 66 // ServiceWorker specific method. |
66 virtual WebServiceWorkerCacheStorage* cacheStorage() { return 0; } | 67 virtual WebServiceWorkerCacheStorage* cacheStorage() { return nullptr; } |
67 | 68 |
68 // ServiceWorker specific method. Called when script accesses the | 69 // ServiceWorker specific method. Called when script accesses the |
69 // the |scope| attribute of the ServiceWorkerGlobalScope. Immutable per spec
. | 70 // the |scope| attribute of the ServiceWorkerGlobalScope. Immutable per spec
. |
70 virtual WebURL scope() const { return WebURL(); } | 71 virtual WebURL scope() const { return WebURL(); } |
71 | 72 |
72 // If the worker was started with WebEmbeddedWorkerStartData indicating to p
ause | 73 // If the worker was started with WebEmbeddedWorkerStartData indicating to p
ause |
73 // after download, this method is called after the main script resource has
been | 74 // after download, this method is called after the main script resource has
been |
74 // downloaded. The scope will not be created and the script will not be load
ed until | 75 // downloaded. The scope will not be created and the script will not be load
ed until |
75 // WebEmbeddedWorker.resumeAfterDownload() is invoked. | 76 // WebEmbeddedWorker.resumeAfterDownload() is invoked. |
76 virtual void didPauseAfterDownload() { } | 77 virtual void didPauseAfterDownload() { } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 // WebServiceWorkerContextProxy) is handled by the ServiceWorker's script | 140 // WebServiceWorkerContextProxy) is handled by the ServiceWorker's script |
140 // context. | 141 // context. |
141 virtual void didHandleSyncEvent(int syncEventID) { } | 142 virtual void didHandleSyncEvent(int syncEventID) { } |
142 | 143 |
143 // ServiceWorker specific method. Called after CrossOriginConnectEvent | 144 // ServiceWorker specific method. Called after CrossOriginConnectEvent |
144 // (dispatched via WebServiceWorkerContextProxy) is handled by the | 145 // (dispatched via WebServiceWorkerContextProxy) is handled by the |
145 // ServiceWorker's script context. | 146 // ServiceWorker's script context. |
146 virtual void didHandleCrossOriginConnectEvent(int connectEventID, bool accep
tConnect) { } | 147 virtual void didHandleCrossOriginConnectEvent(int connectEventID, bool accep
tConnect) { } |
147 | 148 |
148 // Ownership of the returned object is transferred to the caller. | 149 // Ownership of the returned object is transferred to the caller. |
149 virtual WebServiceWorkerNetworkProvider* createServiceWorkerNetworkProvider(
WebDataSource*) { return 0; } | 150 // This is called on the main thread. |
| 151 virtual WebServiceWorkerNetworkProvider* createServiceWorkerNetworkProvider(
WebDataSource*) { return nullptr; } |
| 152 |
| 153 // Ownership of the returned object is transferred to the caller. |
| 154 // This is called on the main thread. |
| 155 virtual WebServiceWorkerProvider* createServiceWorkerProvider() { return nul
lptr; } |
150 | 156 |
151 // Ownership of the passed callbacks is transferred to the callee, callee | 157 // Ownership of the passed callbacks is transferred to the callee, callee |
152 // should delete the callbacks after calling either onSuccess or onError. | 158 // should delete the callbacks after calling either onSuccess or onError. |
153 // WebServiceWorkerClientsInfo and WebServiceWorkerError ownerships are | 159 // WebServiceWorkerClientsInfo and WebServiceWorkerError ownerships are |
154 // passed to the WebServiceWorkerClientsCallbacks implementation. | 160 // passed to the WebServiceWorkerClientsCallbacks implementation. |
155 virtual void getClients(WebServiceWorkerClientsCallbacks*) { BLINK_ASSERT_NO
T_REACHED(); } | 161 virtual void getClients(WebServiceWorkerClientsCallbacks*) { BLINK_ASSERT_NO
T_REACHED(); } |
156 | 162 |
157 // Ownership of the passed callbacks is transferred to the callee, callee | 163 // Ownership of the passed callbacks is transferred to the callee, callee |
158 // should delete the callbacks after calling either onSuccess or onError. | 164 // should delete the callbacks after calling either onSuccess or onError. |
159 // WebServiceWorkerClientInfo and WebServiceWorkerError ownerships are | 165 // WebServiceWorkerClientInfo and WebServiceWorkerError ownerships are |
(...skipping 22 matching lines...) Expand all Loading... |
182 virtual void focus(int clientID, WebServiceWorkerClientFocusCallback*) { BLI
NK_ASSERT_NOT_REACHED(); } | 188 virtual void focus(int clientID, WebServiceWorkerClientFocusCallback*) { BLI
NK_ASSERT_NOT_REACHED(); } |
183 | 189 |
184 // Ownership of the passed callbacks is transferred to the callee, callee | 190 // Ownership of the passed callbacks is transferred to the callee, callee |
185 // should delete the callback after calling either onSuccess or onError. | 191 // should delete the callback after calling either onSuccess or onError. |
186 virtual void focus(int cliendID, WebServiceWorkerClientCallbacks*) { BLINK_A
SSERT_NOT_REACHED(); } | 192 virtual void focus(int cliendID, WebServiceWorkerClientCallbacks*) { BLINK_A
SSERT_NOT_REACHED(); } |
187 }; | 193 }; |
188 | 194 |
189 } // namespace blink | 195 } // namespace blink |
190 | 196 |
191 #endif // WebServiceWorkerContextClient_h | 197 #endif // WebServiceWorkerContextClient_h |
OLD | NEW |