Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: chrome/renderer/webworker_base.h

Issue 372047: Fixed worker startup issue (Closed)
Patch Set: Removed tests to a separate patch. Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 24 matching lines...) Expand all
35 // Returns true if the worker is running (can send messages to it). 35 // Returns true if the worker is running (can send messages to it).
36 bool IsStarted(); 36 bool IsStarted();
37 37
38 // Disconnects the worker (stops listening for incoming messages). 38 // Disconnects the worker (stops listening for incoming messages).
39 virtual void Disconnect(); 39 virtual void Disconnect();
40 40
41 // Sends a message to the worker thread (forwarded via the RenderViewHost). 41 // Sends a message to the worker thread (forwarded via the RenderViewHost).
42 // If WorkerStarted() has not yet been called, message is queued. 42 // If WorkerStarted() has not yet been called, message is queued.
43 bool Send(IPC::Message*); 43 bool Send(IPC::Message*);
44 44
45 // Returns true if there are queued messages.
46 bool HasQueuedMessages() { return queued_messages_.size() != 0; }
47
45 // Sends any messages currently in the queue. 48 // Sends any messages currently in the queue.
46 void SendQueuedMessages(); 49 void SendQueuedMessages();
47 50
48 protected: 51 protected:
49 // Routing id associated with this worker - used to receive messages from the 52 // Routing id associated with this worker - used to receive messages from the
50 // worker, and also to route messages to the worker (WorkerService contains 53 // worker, and also to route messages to the worker (WorkerService contains
51 // a map that maps between these renderer-side route IDs and worker-side 54 // a map that maps between these renderer-side route IDs and worker-side
52 // routing ids). 55 // routing ids).
53 int route_id_; 56 int route_id_;
54 57
55 // The routing id for the RenderView that created this worker. 58 // The routing id for the RenderView that created this worker.
56 int render_view_route_id_; 59 int render_view_route_id_;
57 60
58 ChildThread* child_thread_; 61 ChildThread* child_thread_;
59 62
60 private: 63 private:
61 // Stores messages that were sent before the StartWorkerContext message. 64 // Stores messages that were sent before the StartWorkerContext message.
62 std::vector<IPC::Message*> queued_messages_; 65 std::vector<IPC::Message*> queued_messages_;
63 }; 66 };
64 67
65 #endif // CHROME_RENDERER_WEBWORKER_BASE_H_ 68 #endif // CHROME_RENDERER_WEBWORKER_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698