| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 14 matching lines...) Expand all Loading... |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 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 WebWorkerClientImpl_h | 31 #ifndef WebWorkerClientImpl_h |
| 32 #define WebWorkerClientImpl_h | 32 #define WebWorkerClientImpl_h |
| 33 | 33 |
| 34 #include "core/dom/ScriptExecutionContext.h" | 34 #include "core/dom/ScriptExecutionContext.h" |
| 35 #include "core/workers/WorkerContextProxy.h" | 35 #include "core/workers/WorkerGlobalScopeProxy.h" |
| 36 #include "core/workers/WorkerLoaderProxy.h" | 36 #include "core/workers/WorkerLoaderProxy.h" |
| 37 #include "core/workers/WorkerMessagingProxy.h" | 37 #include "core/workers/WorkerMessagingProxy.h" |
| 38 #include "core/workers/WorkerObjectProxy.h" | 38 #include "core/workers/WorkerObjectProxy.h" |
| 39 | 39 |
| 40 #include "WebWorkerBase.h" | 40 #include "WebWorkerBase.h" |
| 41 #include "public/platform/WebFileSystem.h" | 41 #include "public/platform/WebFileSystem.h" |
| 42 #include "public/platform/WebFileSystemType.h" | 42 #include "public/platform/WebFileSystemType.h" |
| 43 #include <wtf/OwnPtr.h> | 43 #include <wtf/OwnPtr.h> |
| 44 #include <wtf/PassOwnPtr.h> | 44 #include <wtf/PassOwnPtr.h> |
| 45 #include <wtf/RefPtr.h> | 45 #include <wtf/RefPtr.h> |
| 46 | 46 |
| 47 | 47 |
| 48 namespace WebKit { | 48 namespace WebKit { |
| 49 class WebWorker; | 49 class WebWorker; |
| 50 class WebFrameImpl; | 50 class WebFrameImpl; |
| 51 | 51 |
| 52 // This class provides chromium implementation for WorkerContextProxy, WorkerObj
ectProxy amd WorkerLoaderProxy | 52 // This class provides chromium implementation for WorkerGlobalScopeProxy, Worke
rObjectProxy amd WorkerLoaderProxy |
| 53 // for in-proc dedicated workers. It also acts as a bridge for workers to chromi
um implementation of file systems, | 53 // for in-proc dedicated workers. It also acts as a bridge for workers to chromi
um implementation of file systems, |
| 54 // databases and other related functionality. | 54 // databases and other related functionality. |
| 55 // | 55 // |
| 56 // In essence, this class decorates WorkerMessagingProxy. | 56 // In essence, this class decorates WorkerMessagingProxy. |
| 57 // | 57 // |
| 58 // It is imperative that this class inherit from WorkerMessagingProxy rather tha
n delegate to an instance of | 58 // It is imperative that this class inherit from WorkerMessagingProxy rather tha
n delegate to an instance of |
| 59 // WorkerMessagingProxy, because that class tracks and reports its activity to o
utside callers, and manages | 59 // WorkerMessagingProxy, because that class tracks and reports its activity to o
utside callers, and manages |
| 60 // its own lifetime, via calls to workerObjectDestroyed, workerContextDestroyed,
workerContextClosed, etc. It | 60 // its own lifetime, via calls to workerObjectDestroyed, workerGlobalScopeDestro
yed, workerGlobalScopeClosed, etc. It |
| 61 // is basically impossible to correctly manage the lifetime of this class separa
tely from WorkerMessagingProxy. | 61 // is basically impossible to correctly manage the lifetime of this class separa
tely from WorkerMessagingProxy. |
| 62 class WebWorkerClientImpl : public WebCore::WorkerMessagingProxy | 62 class WebWorkerClientImpl : public WebCore::WorkerMessagingProxy |
| 63 , public WebWorkerBase | 63 , public WebWorkerBase |
| 64 , public WebCommonWorkerClient { | 64 , public WebCommonWorkerClient { |
| 65 public: | 65 public: |
| 66 // WebCore::WorkerContextProxy Factory. | 66 // WebCore::WorkerGlobalScopeProxy Factory. |
| 67 static WebCore::WorkerContextProxy* createWorkerContextProxy(WebCore::Worker
*); | 67 static WebCore::WorkerGlobalScopeProxy* createWorkerGlobalScopeProxy(WebCore
::Worker*); |
| 68 | 68 |
| 69 // WebCore::WorkerContextProxy methods: | 69 // WebCore::WorkerGlobalScopeProxy methods: |
| 70 // These are called on the thread that created the worker. In the renderer | 70 // These are called on the thread that created the worker. In the renderer |
| 71 // process, this will be the main WebKit thread. | 71 // process, this will be the main WebKit thread. |
| 72 virtual void terminateWorkerContext() OVERRIDE; | 72 virtual void terminateWorkerGlobalScope() OVERRIDE; |
| 73 | 73 |
| 74 // WebCore::WorkerLoaderProxy methods | 74 // WebCore::WorkerLoaderProxy methods |
| 75 virtual WebWorkerBase* toWebWorkerBase() OVERRIDE; | 75 virtual WebWorkerBase* toWebWorkerBase() OVERRIDE; |
| 76 | 76 |
| 77 // WebWorkerBase methods: | 77 // WebWorkerBase methods: |
| 78 virtual WebCore::WorkerLoaderProxy* workerLoaderProxy() OVERRIDE { return th
is; } | 78 virtual WebCore::WorkerLoaderProxy* workerLoaderProxy() OVERRIDE { return th
is; } |
| 79 virtual WebCommonWorkerClient* commonClient() OVERRIDE { return this; } | 79 virtual WebCommonWorkerClient* commonClient() OVERRIDE { return this; } |
| 80 virtual WebView* view() const OVERRIDE; | 80 virtual WebView* view() const OVERRIDE; |
| 81 | 81 |
| 82 // WebCommonWorkerClient methods: | 82 // WebCommonWorkerClient methods: |
| 83 virtual bool allowDatabase(WebFrame*, const WebString& name, const WebString
& displayName, unsigned long estimatedSize) OVERRIDE; | 83 virtual bool allowDatabase(WebFrame*, const WebString& name, const WebString
& displayName, unsigned long estimatedSize) OVERRIDE; |
| 84 virtual bool allowFileSystem(); | 84 virtual bool allowFileSystem(); |
| 85 virtual void openFileSystem(WebFileSystemType, long long size, bool create, | 85 virtual void openFileSystem(WebFileSystemType, long long size, bool create, |
| 86 WebFileSystemCallbacks*) OVERRIDE; | 86 WebFileSystemCallbacks*) OVERRIDE; |
| 87 virtual bool allowIndexedDB(const WebString& name) OVERRIDE; | 87 virtual bool allowIndexedDB(const WebString& name) OVERRIDE; |
| 88 virtual void queryUsageAndQuota(WebStorageQuotaType, WebStorageQuotaCallback
s*) OVERRIDE; | 88 virtual void queryUsageAndQuota(WebStorageQuotaType, WebStorageQuotaCallback
s*) OVERRIDE; |
| 89 | 89 |
| 90 private: | 90 private: |
| 91 WebWorkerClientImpl(WebCore::Worker*, WebFrameImpl*); | 91 WebWorkerClientImpl(WebCore::Worker*, WebFrameImpl*); |
| 92 virtual ~WebWorkerClientImpl(); | 92 virtual ~WebWorkerClientImpl(); |
| 93 | 93 |
| 94 WebFrameImpl* m_webFrame; | 94 WebFrameImpl* m_webFrame; |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 } // namespace WebKit; | 97 } // namespace WebKit; |
| 98 | 98 |
| 99 #endif | 99 #endif |
| OLD | NEW |