OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WEBKIT_GLUE_WEBWORKER_IMPL_H_ |
| 6 #define WEBKIT_GLUE_WEBWORKER_IMPL_H_ |
| 7 |
| 8 #if ENABLE(WORKERS) |
| 9 |
| 10 #include "webkit/glue/webworker.h" |
| 11 |
| 12 #include "ScriptExecutionContext.h" |
| 13 #include "WorkerObjectProxy.h" |
| 14 |
| 15 // This class is used by the worker process code to talk to the WebCore::Worker |
| 16 // implementation. It can't use it directly since it uses WebKit types, so this |
| 17 // class converts the data types. When the WebCore::Worker object wants to call |
| 18 // WebCore::WorkerObjectProxy, this class will conver to Chrome data types first |
| 19 // and then call the supplied WebWorkerClient. |
| 20 class WebWorkerImpl: public WebCore::WorkerObjectProxy, |
| 21 public WebWorker { |
| 22 public: |
| 23 WebWorkerImpl(WebWorkerClient* client); |
| 24 virtual ~WebWorkerImpl(); |
| 25 |
| 26 // WebCore::WorkerObjectProxy implementation. |
| 27 void postMessageToWorkerObject(const WebCore::String& message); |
| 28 void postExceptionToWorkerObject(const WebCore::String& errorMessage, |
| 29 int lineNumber, |
| 30 const WebCore::String& sourceURL); |
| 31 void postConsoleMessageToWorkerObject(WebCore::MessageDestination destination, |
| 32 WebCore::MessageSource source, |
| 33 WebCore::MessageLevel level, |
| 34 const WebCore::String& message, |
| 35 int lineNumber, |
| 36 const WebCore::String& sourceURL); |
| 37 void confirmMessageFromWorkerObject(bool hasPendingActivity); |
| 38 void reportPendingActivity(bool hasPendingActivity); |
| 39 void workerContextDestroyed(); |
| 40 |
| 41 // WebWorker implementation. |
| 42 void StartWorkerContext(const GURL& script_url, |
| 43 const string16& user_agent, |
| 44 const string16& source_code); |
| 45 void TerminateWorkerContext(); |
| 46 void PostMessageToWorkerContext(const string16& message); |
| 47 void WorkerObjectDestroyed(); |
| 48 |
| 49 private: |
| 50 WebWorkerClient* client_; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(WebWorkerImpl); |
| 53 }; |
| 54 |
| 55 #endif |
| 56 |
| 57 #endif // WEBKIT_GLUE_WEBWORKER_IMPL_H_ |
OLD | NEW |