| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 bool IsStarted(); | 46 bool IsStarted(); |
| 47 | 47 |
| 48 // Disconnects the worker (stops listening for incoming messages). | 48 // Disconnects the worker (stops listening for incoming messages). |
| 49 void Disconnect(); | 49 void Disconnect(); |
| 50 | 50 |
| 51 // Sends a message to the worker thread (forwarded via the RenderViewHost). | 51 // Sends a message to the worker thread (forwarded via the RenderViewHost). |
| 52 // If WorkerStarted() has not yet been called, message is queued. | 52 // If WorkerStarted() has not yet been called, message is queued. |
| 53 bool Send(IPC::Message*); | 53 bool Send(IPC::Message*); |
| 54 | 54 |
| 55 // Returns true if there are queued messages. | 55 // Returns true if there are queued messages. |
| 56 bool HasQueuedMessages() { return queued_messages_.size() != 0; } | 56 bool HasQueuedMessages() { return !queued_messages_.empty(); } |
| 57 | 57 |
| 58 // Sends any messages currently in the queue. | 58 // Sends any messages currently in the queue. |
| 59 void SendQueuedMessages(); | 59 void SendQueuedMessages(); |
| 60 | 60 |
| 61 protected: | 61 protected: |
| 62 WebWorkerBase(ChildThread* child_thread, | 62 WebWorkerBase(ChildThread* child_thread, |
| 63 unsigned long long document_id, | 63 unsigned long long document_id, |
| 64 int route_id, | 64 int route_id, |
| 65 int render_view_route_id, | 65 int render_view_route_id, |
| 66 int parent_appcache_host_id); | 66 int parent_appcache_host_id); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 90 unsigned long long document_id_; | 90 unsigned long long document_id_; |
| 91 | 91 |
| 92 // ID of our parent's appcache host, only valid for dedicated workers. | 92 // ID of our parent's appcache host, only valid for dedicated workers. |
| 93 int parent_appcache_host_id_; | 93 int parent_appcache_host_id_; |
| 94 | 94 |
| 95 // Stores messages that were sent before the StartWorkerContext message. | 95 // Stores messages that were sent before the StartWorkerContext message. |
| 96 std::vector<IPC::Message*> queued_messages_; | 96 std::vector<IPC::Message*> queued_messages_; |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 #endif // CHROME_RENDERER_WEBWORKER_BASE_H_ | 99 #endif // CHROME_RENDERER_WEBWORKER_BASE_H_ |
| OLD | NEW |