| 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_NATIVEWEBWORKER_IMPL_H_ | 5 #ifndef CHROME_WORKER_NATIVEWEBWORKER_IMPL_H_ |
| 6 #define CHROME_WORKER_NATIVEWEBWORKER_IMPL_H_ | 6 #define CHROME_WORKER_NATIVEWEBWORKER_IMPL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "third_party/WebKit/WebKit/chromium/public/WebWorker.h" | 10 #include "third_party/WebKit/WebKit/chromium/public/WebWorker.h" |
| 11 #include "third_party/WebKit/WebKit/chromium/public/WebWorkerClient.h" | 11 #include "third_party/WebKit/WebKit/chromium/public/WebWorkerClient.h" |
| 12 | 12 |
| 13 | 13 |
| 14 // Forward declaration for the listener thread pointer. | 14 // Forward declaration for the listener thread pointer. |
| 15 class NativeWebWorkerListenerThread; | 15 class NativeWebWorkerListenerThread; |
| 16 | 16 |
| 17 // This class is used by the worker process code to talk to the Native Client | 17 // This class is used by the worker process code to talk to the Native Client |
| 18 // worker implementation. | 18 // worker implementation. |
| 19 class NativeWebWorkerImpl : public WebKit::WebWorker { | 19 class NativeWebWorkerImpl : public WebKit::WebWorker { |
| 20 public: | 20 public: |
| 21 explicit NativeWebWorkerImpl(WebKit::WebWorkerClient* client); | 21 explicit NativeWebWorkerImpl(WebKit::WebWorkerClient* client); |
| 22 virtual ~NativeWebWorkerImpl(); | 22 virtual ~NativeWebWorkerImpl(); |
| 23 | 23 |
| 24 static WebWorker* create(WebKit::WebWorkerClient* client); | 24 static WebWorker* create(WebKit::WebWorkerClient* client); |
| 25 | 25 |
| 26 // WebWorker implementation. | 26 // WebWorker implementation. |
| 27 void startWorkerContext(const WebKit::WebURL& script_url, | 27 virtual void startWorkerContext(const WebKit::WebURL& script_url, |
| 28 const WebKit::WebString& user_agent, | 28 const WebKit::WebString& user_agent, |
| 29 const WebKit::WebString& source_code); | 29 const WebKit::WebString& source_code); |
| 30 void terminateWorkerContext(); | 30 virtual void terminateWorkerContext(); |
| 31 void postMessageToWorkerContext( | 31 virtual void postMessageToWorkerContext( |
| 32 const WebKit::WebString& message, | 32 const WebKit::WebString& message, |
| 33 const WebKit::WebMessagePortChannelArray& channels); | 33 const WebKit::WebMessagePortChannelArray& channels); |
| 34 void workerObjectDestroyed(); | 34 virtual void workerObjectDestroyed(); |
| 35 void clientDestroyed(); | 35 virtual void clientDestroyed(); |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 WebKit::WebWorkerClient* client_; | 38 WebKit::WebWorkerClient* client_; |
| 39 struct NaClApp* nap_; | 39 struct NaClApp* nap_; |
| 40 struct NaClSrpcChannel* channel_; | 40 struct NaClSrpcChannel* channel_; |
| 41 NativeWebWorkerListenerThread* upcall_thread_; | 41 NativeWebWorkerListenerThread* upcall_thread_; |
| 42 struct NaClDesc* descs_[2]; | 42 struct NaClDesc* descs_[2]; |
| 43 | 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(NativeWebWorkerImpl); | 44 DISALLOW_COPY_AND_ASSIGN(NativeWebWorkerImpl); |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 #endif // CHROME_WORKER_NATIVEWEBWORKER_IMPL_H_ | 47 #endif // CHROME_WORKER_NATIVEWEBWORKER_IMPL_H_ |
| OLD | NEW |