| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_WORKER_NATIVEWORKER_H_ | 5 #ifndef CHROME_WORKER_NATIVEWORKER_H_ |
| 6 #define CHROME_WORKER_NATIVEWORKER_H_ | 6 #define CHROME_WORKER_NATIVEWORKER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "webkit/api/public/WebWorker.h" | 9 #include "webkit/api/public/WebWorker.h" |
| 10 #include "webkit/api/public/WebWorkerClient.h" | 10 #include "webkit/api/public/WebWorkerClient.h" |
| 11 | 11 |
| 12 | 12 |
| 13 // Forward declaration for the listener thread pointer. | 13 // Forward declaration for the listener thread pointer. |
| 14 class NativeWebWorkerListenerThread; | 14 class NativeWebWorkerListenerThread; |
| 15 | 15 |
| 16 // This class is used by the worker process code to talk to the Native Client | 16 // This class is used by the worker process code to talk to the Native Client |
| 17 // worker implementation. | 17 // worker implementation. |
| 18 class NativeWebWorkerImpl : public WebKit::WebWorker { | 18 class NativeWebWorkerImpl : public WebKit::WebWorker { |
| 19 public: | 19 public: |
| 20 explicit NativeWebWorkerImpl(WebKit::WebWorkerClient* client); | 20 explicit NativeWebWorkerImpl(WebKit::WebWorkerClient* client); |
| 21 virtual ~NativeWebWorkerImpl(); | 21 virtual ~NativeWebWorkerImpl(); |
| 22 | 22 |
| 23 static WebWorker* NativeWebWorkerImpl::create( | 23 static WebWorker* create(WebKit::WebWorkerClient* client); |
| 24 WebKit::WebWorkerClient* client); | |
| 25 | 24 |
| 26 // WebWorker implementation. | 25 // WebWorker implementation. |
| 27 void startWorkerContext(const WebKit::WebURL& script_url, | 26 void startWorkerContext(const WebKit::WebURL& script_url, |
| 28 const WebKit::WebString& user_agent, | 27 const WebKit::WebString& user_agent, |
| 29 const WebKit::WebString& source_code); | 28 const WebKit::WebString& source_code); |
| 30 void terminateWorkerContext(); | 29 void terminateWorkerContext(); |
| 31 void postMessageToWorkerContext(const WebKit::WebString& message); | 30 void postMessageToWorkerContext(const WebKit::WebString& message); |
| 32 void workerObjectDestroyed(); | 31 void workerObjectDestroyed(); |
| 33 | 32 |
| 34 private: | 33 private: |
| 35 WebKit::WebWorkerClient* client_; | 34 WebKit::WebWorkerClient* client_; |
| 36 struct NaClApp* nap_; | 35 struct NaClApp* nap_; |
| 37 struct NaClSrpcChannel* channel_; | 36 struct NaClSrpcChannel* channel_; |
| 38 NativeWebWorkerListenerThread* upcall_thread_; | 37 NativeWebWorkerListenerThread* upcall_thread_; |
| 39 struct NaClDesc* descs_[2]; | 38 struct NaClDesc* descs_[2]; |
| 40 | 39 |
| 41 DISALLOW_COPY_AND_ASSIGN(NativeWebWorkerImpl); | 40 DISALLOW_COPY_AND_ASSIGN(NativeWebWorkerImpl); |
| 42 }; | 41 }; |
| 43 | 42 |
| 44 #endif // CHROME_WORKER_NATIVEWEBWORKER_H_ | 43 #endif // CHROME_WORKER_NATIVEWEBWORKER_H_ |
| OLD | NEW |