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_RENDERER_WEBWORKER_BASE_H_ | 5 #ifndef CHROME_RENDERER_WEBWORKER_BASE_H_ |
6 #define CHROME_RENDERER_WEBWORKER_BASE_H_ | 6 #define CHROME_RENDERER_WEBWORKER_BASE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "ipc/ipc_channel.h" | 11 #include "ipc/ipc_channel.h" |
12 | 12 |
13 class ChildThread; | 13 class ChildThread; |
14 class GURL; | 14 class GURL; |
15 | 15 |
16 // WebWorkerBase is the common base class used by both WebWorkerProxy and | 16 // WebWorkerBase is the common base class used by both WebWorkerProxy and |
17 // WebSharedWorker. It contains logic to support starting up both dedicated | 17 // WebSharedWorker. It contains logic to support starting up both dedicated |
18 // and shared workers, and handling message queueing while waiting for the | 18 // and shared workers, and handling message queueing while waiting for the |
19 // worker process to start. | 19 // worker process to start. |
20 class WebWorkerBase : public IPC::Channel::Listener { | 20 class WebWorkerBase : public IPC::Channel::Listener { |
21 public: | 21 public: |
22 WebWorkerBase(ChildThread* child_thread, | 22 WebWorkerBase(ChildThread* child_thread, |
| 23 unsigned long long document_id, |
23 int route_id, | 24 int route_id, |
24 int render_view_route_id); | 25 int render_view_route_id); |
25 | 26 |
26 virtual ~WebWorkerBase(); | 27 virtual ~WebWorkerBase(); |
27 | 28 |
28 // Creates and initializes a new worker context. | 29 // Creates and initializes a new worker context. |
29 void CreateWorkerContext(const GURL& script_url, | 30 void CreateWorkerContext(const GURL& script_url, |
30 bool is_shared, | 31 bool is_shared, |
31 const string16& name, | 32 const string16& name, |
32 const string16& user_agent, | 33 const string16& user_agent, |
(...skipping 21 matching lines...) Expand all Loading... |
54 // a map that maps between these renderer-side route IDs and worker-side | 55 // a map that maps between these renderer-side route IDs and worker-side |
55 // routing ids). | 56 // routing ids). |
56 int route_id_; | 57 int route_id_; |
57 | 58 |
58 // The routing id for the RenderView that created this worker. | 59 // The routing id for the RenderView that created this worker. |
59 int render_view_route_id_; | 60 int render_view_route_id_; |
60 | 61 |
61 ChildThread* child_thread_; | 62 ChildThread* child_thread_; |
62 | 63 |
63 private: | 64 private: |
| 65 // ID of our parent document (used to shutdown workers when the parent |
| 66 // document is detached). |
| 67 unsigned long long document_id_; |
| 68 |
64 // Stores messages that were sent before the StartWorkerContext message. | 69 // Stores messages that were sent before the StartWorkerContext message. |
65 std::vector<IPC::Message*> queued_messages_; | 70 std::vector<IPC::Message*> queued_messages_; |
66 }; | 71 }; |
67 | 72 |
68 #endif // CHROME_RENDERER_WEBWORKER_BASE_H_ | 73 #endif // CHROME_RENDERER_WEBWORKER_BASE_H_ |
OLD | NEW |