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 26 matching lines...) Expand all Loading... |
37 #include "WebFrameClient.h" | 37 #include "WebFrameClient.h" |
38 | 38 |
39 namespace WebCore { | 39 namespace WebCore { |
40 class WorkerScriptLoader; | 40 class WorkerScriptLoader; |
41 class WorkerThread; | 41 class WorkerThread; |
42 } | 42 } |
43 | 43 |
44 namespace blink { | 44 namespace blink { |
45 | 45 |
46 class ServiceWorkerGlobalScopeProxy; | 46 class ServiceWorkerGlobalScopeProxy; |
| 47 class WebServiceWorkerNetworkProvider; |
47 class WebView; | 48 class WebView; |
48 | 49 |
49 class WebEmbeddedWorkerImpl FINAL : | 50 class WebEmbeddedWorkerImpl FINAL : |
50 public WebEmbeddedWorker, | 51 public WebEmbeddedWorker, |
51 public WebFrameClient { | 52 public WebFrameClient { |
52 WTF_MAKE_NONCOPYABLE(WebEmbeddedWorkerImpl); | 53 WTF_MAKE_NONCOPYABLE(WebEmbeddedWorkerImpl); |
53 public: | 54 public: |
54 WebEmbeddedWorkerImpl( | 55 WebEmbeddedWorkerImpl( |
55 PassOwnPtr<WebServiceWorkerContextClient>, | 56 PassOwnPtr<WebServiceWorkerContextClient>, |
56 PassOwnPtr<WebWorkerPermissionClientProxy>); | 57 PassOwnPtr<WebWorkerPermissionClientProxy>); |
57 virtual ~WebEmbeddedWorkerImpl(); | 58 virtual ~WebEmbeddedWorkerImpl(); |
58 | 59 |
59 // WebEmbeddedWorker overrides. | 60 // WebEmbeddedWorker overrides. |
60 virtual void startWorkerContext(const WebEmbeddedWorkerStartData&) OVERRIDE; | 61 virtual void startWorkerContext(const WebEmbeddedWorkerStartData&) OVERRIDE; |
61 virtual void terminateWorkerContext() OVERRIDE; | 62 virtual void terminateWorkerContext() OVERRIDE; |
62 | 63 |
63 private: | 64 private: |
64 class Loader; | 65 class Loader; |
65 class LoaderProxy; | 66 class LoaderProxy; |
66 | 67 |
67 void prepareShadowPageForLoader(); | 68 void prepareShadowPageForLoader(); |
68 | 69 |
69 // WebFrameClient overrides. | 70 // WebFrameClient overrides. |
| 71 virtual void willSendRequest( |
| 72 WebFrame*, unsigned identifier, WebURLRequest&, |
| 73 const WebURLResponse& redirectResponse) OVERRIDE; |
70 virtual void didFinishDocumentLoad(WebFrame*) OVERRIDE; | 74 virtual void didFinishDocumentLoad(WebFrame*) OVERRIDE; |
71 | 75 |
72 void onScriptLoaderFinished(); | 76 void onScriptLoaderFinished(); |
73 | 77 |
74 WebEmbeddedWorkerStartData m_workerStartData; | 78 WebEmbeddedWorkerStartData m_workerStartData; |
75 | 79 |
76 // These are kept until startWorkerContext is called, and then passed on | 80 // These are kept until startWorkerContext is called, and then passed on |
77 // to WorkerContext. | 81 // to WorkerContext. |
78 OwnPtr<WebServiceWorkerContextClient> m_workerContextClient; | 82 OwnPtr<WebServiceWorkerContextClient> m_workerContextClient; |
79 OwnPtr<WebWorkerPermissionClientProxy> m_permissionClient; | 83 OwnPtr<WebWorkerPermissionClientProxy> m_permissionClient; |
80 | 84 |
| 85 // We retain ownership of this one which is for use on the |
| 86 // main thread only. |
| 87 OwnPtr<WebServiceWorkerNetworkProvider> m_networkProvider; |
| 88 |
81 // Kept around only while main script loading is ongoing. | 89 // Kept around only while main script loading is ongoing. |
82 OwnPtr<Loader> m_mainScriptLoader; | 90 OwnPtr<Loader> m_mainScriptLoader; |
83 | 91 |
84 RefPtr<WebCore::WorkerThread> m_workerThread; | 92 RefPtr<WebCore::WorkerThread> m_workerThread; |
85 OwnPtr<LoaderProxy> m_loaderProxy; | 93 OwnPtr<LoaderProxy> m_loaderProxy; |
86 OwnPtr<ServiceWorkerGlobalScopeProxy> m_workerGlobalScopeProxy; | 94 OwnPtr<ServiceWorkerGlobalScopeProxy> m_workerGlobalScopeProxy; |
87 | 95 |
88 // 'shadow page' - created to proxy loading requests from the worker. | 96 // 'shadow page' - created to proxy loading requests from the worker. |
89 // Both WebView and WebFrame objects are close()'ed (where they're | 97 // Both WebView and WebFrame objects are close()'ed (where they're |
90 // deref'ed) when this EmbeddedWorkerImpl is destructed, therefore they | 98 // deref'ed) when this EmbeddedWorkerImpl is destructed, therefore they |
91 // are guaranteed to exist while this object is around. | 99 // are guaranteed to exist while this object is around. |
92 WebView* m_webView; | 100 WebView* m_webView; |
93 WebFrame* m_mainFrame; | 101 WebFrame* m_mainFrame; |
94 | 102 |
95 bool m_askedToTerminate; | 103 bool m_askedToTerminate; |
96 }; | 104 }; |
97 | 105 |
98 } // namespace blink | 106 } // namespace blink |
99 | 107 |
100 #endif // WebEmbeddedWorkerImpl_h | 108 #endif // WebEmbeddedWorkerImpl_h |
OLD | NEW |