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 22 matching lines...) Expand all Loading... |
33 | 33 |
34 #include "WebWorkerPermissionClientProxy.h" | 34 #include "WebWorkerPermissionClientProxy.h" |
35 #include "public/platform/WebMessagePortChannel.h" | 35 #include "public/platform/WebMessagePortChannel.h" |
36 #include "public/platform/WebServiceWorkerClientsInfo.h" | 36 #include "public/platform/WebServiceWorkerClientsInfo.h" |
37 #include "public/platform/WebServiceWorkerEventResult.h" | 37 #include "public/platform/WebServiceWorkerEventResult.h" |
38 #include "public/platform/WebURL.h" | 38 #include "public/platform/WebURL.h" |
39 | 39 |
40 namespace blink { | 40 namespace blink { |
41 | 41 |
42 class WebDataSource; | 42 class WebDataSource; |
| 43 class WebServiceWorkerCacheStorage; |
43 class WebServiceWorkerContextProxy; | 44 class WebServiceWorkerContextProxy; |
44 class WebServiceWorkerNetworkProvider; | 45 class WebServiceWorkerNetworkProvider; |
45 class WebServiceWorkerResponse; | 46 class WebServiceWorkerResponse; |
46 class WebString; | 47 class WebString; |
47 | 48 |
48 // This interface is implemented by the client. It is supposed to be created | 49 // This interface is implemented by the client. It is supposed to be created |
49 // on the main thread and then passed on to the worker thread. | 50 // on the main thread and then passed on to the worker thread. |
50 // by a newly created WorkerGlobalScope. All methods of this class, except | 51 // by a newly created WorkerGlobalScope. All methods of this class, except |
51 // for createServiceWorkerNetworkProvider() and workerContextFailedToStart(), | 52 // for createServiceWorkerNetworkProvider() and workerContextFailedToStart(), |
52 // are called on the worker thread. | 53 // are called on the worker thread. |
53 // FIXME: Split this into EmbeddedWorkerContextClient and | 54 // FIXME: Split this into EmbeddedWorkerContextClient and |
54 // ServiceWorkerScriptContextClient when we decide to use EmbeddedWorker | 55 // ServiceWorkerScriptContextClient when we decide to use EmbeddedWorker |
55 // framework for other implementation (like SharedWorker). | 56 // framework for other implementation (like SharedWorker). |
56 class WebServiceWorkerContextClient { | 57 class WebServiceWorkerContextClient { |
57 public: | 58 public: |
58 virtual ~WebServiceWorkerContextClient() { } | 59 virtual ~WebServiceWorkerContextClient() { } |
59 | 60 |
| 61 // ServiceWorker specific method. |
| 62 virtual WebServiceWorkerCacheStorage* cacheStorage() { return 0; } |
| 63 |
60 // ServiceWorker specific method. Called when script accesses the | 64 // ServiceWorker specific method. Called when script accesses the |
61 // the |scope| attribute of the ServiceWorkerGlobalScope. Immutable per spec
. | 65 // the |scope| attribute of the ServiceWorkerGlobalScope. Immutable per spec
. |
62 virtual WebURL scope() const { return WebURL(); } | 66 virtual WebURL scope() const { return WebURL(); } |
63 | 67 |
64 // If the worker was started with WebEmbeddedWorkerStartData indicating to p
ause | 68 // If the worker was started with WebEmbeddedWorkerStartData indicating to p
ause |
65 // after download, this method is called after the main script resource has
been | 69 // after download, this method is called after the main script resource has
been |
66 // downloaded. The scope will not be created and the script will not be load
ed until | 70 // downloaded. The scope will not be created and the script will not be load
ed until |
67 // WebEmbeddedWorker.resumeAfterDownload() is invoked. | 71 // WebEmbeddedWorker.resumeAfterDownload() is invoked. |
68 virtual void didPauseAfterDownload() { } | 72 virtual void didPauseAfterDownload() { } |
69 | 73 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // passed to the WebServiceWorkerClientsCallbacks implementation. | 129 // passed to the WebServiceWorkerClientsCallbacks implementation. |
126 virtual void getClients(WebServiceWorkerClientsCallbacks*) { BLINK_ASSERT_NO
T_REACHED(); } | 130 virtual void getClients(WebServiceWorkerClientsCallbacks*) { BLINK_ASSERT_NO
T_REACHED(); } |
127 | 131 |
128 // Callee receives ownership of the passed vector. | 132 // Callee receives ownership of the passed vector. |
129 // FIXME: Blob refs should be passed to maintain ref counts. crbug.com/35175
3 | 133 // FIXME: Blob refs should be passed to maintain ref counts. crbug.com/35175
3 |
130 virtual void postMessageToClient(int clientID, const WebString&, WebMessageP
ortChannelArray*) { BLINK_ASSERT_NOT_REACHED(); } | 134 virtual void postMessageToClient(int clientID, const WebString&, WebMessageP
ortChannelArray*) { BLINK_ASSERT_NOT_REACHED(); } |
131 }; | 135 }; |
132 | 136 |
133 } // namespace blink | 137 } // namespace blink |
134 | 138 |
135 #endif // WebWorkerContextClient_h | 139 #endif // WebServiceWorkerContextClient_h |
OLD | NEW |