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 17 matching lines...) Expand all Loading... |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef WebServiceWorkerContextClient_h | 31 #ifndef WebServiceWorkerContextClient_h |
32 #define WebServiceWorkerContextClient_h | 32 #define WebServiceWorkerContextClient_h |
33 | 33 |
34 #include "WebWorkerPermissionClientProxy.h" | 34 #include "WebWorkerPermissionClientProxy.h" |
35 | 35 |
36 namespace blink { | 36 namespace blink { |
37 | 37 |
| 38 class WebDataSource; |
38 class WebString; | 39 class WebString; |
39 class WebServiceWorkerContextProxy; | 40 class WebServiceWorkerContextProxy; |
| 41 class WebServiceWorkerNetworkProvider; |
40 class WebServiceWorkerResponse; | 42 class WebServiceWorkerResponse; |
41 | 43 |
42 // This interface is implemented by the client. It is suppoed to be created | 44 // This interface is implemented by the client. It is supposed to be created |
43 // on the main thread and then passed on to the worker thread to be owned | 45 // on the main thread and then passed on to the worker thread to be owned |
44 // by a newly created WorkerGlobalScope. All methods of this class, except | 46 // by a newly created WorkerGlobalScope. All methods of this class, except |
45 // for workerContextFailedToStart(), are called on the worker thread. | 47 // for createServiceWorkerNetworkProvider() and workerContextFailedToStart(), |
| 48 // are called on the worker thread. |
46 // FIXME: Split this into EmbeddedWorkerContextClient and | 49 // FIXME: Split this into EmbeddedWorkerContextClient and |
47 // ServiceWorkerScriptContextClient when we decide to use EmbeddedWorker | 50 // ServiceWorkerScriptContextClient when we decide to use EmbeddedWorker |
48 // framework for other implementation (like SharedWorker). | 51 // framework for other implementation (like SharedWorker). |
49 class WebServiceWorkerContextClient { | 52 class WebServiceWorkerContextClient { |
50 public: | 53 public: |
51 virtual ~WebServiceWorkerContextClient() { } | 54 virtual ~WebServiceWorkerContextClient() { } |
52 | 55 |
53 // A new WorkerGlobalScope is created and started to run on the | 56 // A new WorkerGlobalScope is created and started to run on the |
54 // worker thread. | 57 // worker thread. |
55 // This also gives back a proxy to the client to talk to the | 58 // This also gives back a proxy to the client to talk to the |
(...skipping 21 matching lines...) Expand all Loading... |
77 // ServiceWorker specific method. Called after InstallEvent (dispatched | 80 // ServiceWorker specific method. Called after InstallEvent (dispatched |
78 // via WebServiceWorkerContextProxy) is handled by the ServiceWorker's | 81 // via WebServiceWorkerContextProxy) is handled by the ServiceWorker's |
79 // script context. | 82 // script context. |
80 virtual void didHandleInstallEvent(int installEventID) { } | 83 virtual void didHandleInstallEvent(int installEventID) { } |
81 | 84 |
82 // ServiceWorker specific methods. Called after FetchEvent is handled by the | 85 // ServiceWorker specific methods. Called after FetchEvent is handled by the |
83 // ServiceWorker's script context. When no response is provided, the browser | 86 // ServiceWorker's script context. When no response is provided, the browser |
84 // should fallback to native fetch. | 87 // should fallback to native fetch. |
85 virtual void didHandleFetchEvent(int fetchEventID) { } | 88 virtual void didHandleFetchEvent(int fetchEventID) { } |
86 virtual void didHandleFetchEvent(int fetchEventID, const WebServiceWorkerRes
ponse& response) { } | 89 virtual void didHandleFetchEvent(int fetchEventID, const WebServiceWorkerRes
ponse& response) { } |
| 90 |
| 91 // Ownership of the returned object is transferred to the caller. |
| 92 virtual WebServiceWorkerNetworkProvider* createServiceWorkerNetworkProvider(
blink::WebDataSource*) { return 0; } |
87 }; | 93 }; |
88 | 94 |
89 } // namespace blink | 95 } // namespace blink |
90 | 96 |
91 #endif // WebWorkerContextClient_h | 97 #endif // WebWorkerContextClient_h |
OLD | NEW |