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_WEBWORKER_STUB_BASE_H_ | 5 #ifndef CHROME_WORKER_WEBWORKER_STUB_BASE_H_ |
6 #define CHROME_WORKER_WEBWORKER_STUB_BASE_H_ | 6 #define CHROME_WORKER_WEBWORKER_STUB_BASE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
| 9 #include "base/scoped_ptr.h" |
9 #include "chrome/worker/webworkerclient_proxy.h" | 10 #include "chrome/worker/webworkerclient_proxy.h" |
10 #include "chrome/worker/worker_webapplicationcachehost_impl.h" | 11 #include "chrome/worker/worker_webapplicationcachehost_impl.h" |
11 #include "ipc/ipc_channel.h" | 12 #include "ipc/ipc_channel.h" |
12 | 13 |
13 // This class is the common base class for both WebWorkerStub and | 14 // This class is the common base class for both WebWorkerStub and |
14 // WebSharedWorkerStub and contains common setup/teardown functionality. | 15 // WebSharedWorkerStub and contains common setup/teardown functionality. |
15 class WebWorkerStubBase : public IPC::Channel::Listener { | 16 class WebWorkerStubBase : public IPC::Channel::Listener { |
16 public: | 17 public: |
17 WebWorkerStubBase(int route_id, | 18 WebWorkerStubBase(int route_id, |
18 const WorkerAppCacheInitInfo& appcache_init_info); | 19 const WorkerAppCacheInitInfo& appcache_init_info); |
19 virtual ~WebWorkerStubBase(); | 20 virtual ~WebWorkerStubBase(); |
20 | 21 |
21 // Invoked when the WebWorkerClientProxy is shutting down. | 22 // Invoked when the WebWorkerClientProxy is shutting down. |
22 void Shutdown(); | 23 void Shutdown(); |
23 | 24 |
24 // Called after terminating the worker context to make sure that the worker | 25 // Called after terminating the worker context to make sure that the worker |
25 // actually terminates (is not stuck in an infinite loop). | 26 // actually terminates (is not stuck in an infinite loop). |
26 void EnsureWorkerContextTerminates(); | 27 void EnsureWorkerContextTerminates(); |
27 | 28 |
28 WebWorkerClientProxy* client() { return &client_; } | 29 WebWorkerClientProxy* client() { return &client_; } |
29 | 30 |
30 const WorkerAppCacheInitInfo& appcache_init_info() const { | 31 const WorkerAppCacheInitInfo& appcache_init_info() const { |
31 return appcache_init_info_; | 32 return appcache_init_info_; |
32 } | 33 } |
| 34 |
| 35 // Returns the script url of this worker. |
| 36 virtual const GURL& url() const = 0; |
| 37 |
33 private: | 38 private: |
34 int route_id_; | 39 int route_id_; |
35 WorkerAppCacheInitInfo appcache_init_info_; | 40 WorkerAppCacheInitInfo appcache_init_info_; |
36 | 41 |
37 // WebWorkerClient that responds to outgoing API calls from the worker object. | 42 // WebWorkerClient that responds to outgoing API calls from the worker object. |
38 WebWorkerClientProxy client_; | 43 WebWorkerClientProxy client_; |
39 | 44 |
40 DISALLOW_COPY_AND_ASSIGN(WebWorkerStubBase); | 45 DISALLOW_COPY_AND_ASSIGN(WebWorkerStubBase); |
41 }; | 46 }; |
42 | 47 |
43 #endif // CHROME_WORKER_WEBWORKER_STUB_BASE_H_ | 48 #endif // CHROME_WORKER_WEBWORKER_STUB_BASE_H_ |
OLD | NEW |