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

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

Issue 6990059: DevTools: devtools message plumbing between worker and page processes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 months 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 | Annotate | Revision Log
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 CONTENT_RENDERER_WEBWORKER_BASE_H_ 5 #ifndef CONTENT_RENDERER_WEBWORKER_BASE_H_
6 #define CONTENT_RENDERER_WEBWORKER_BASE_H_ 6 #define CONTENT_RENDERER_WEBWORKER_BASE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/basictypes.h" 12 #include "base/basictypes.h"
12 #include "ipc/ipc_channel.h" 13 #include "ipc/ipc_channel.h"
13 14
14 class ChildThread; 15 class ChildThread;
15 class GURL; 16 class GURL;
16 17
17 // WebWorkerBase is the common base class used by both WebWorkerProxy and 18 // WebWorkerBase is the common base class used by both WebWorkerProxy and
18 // WebSharedWorker. It contains logic to support starting up both dedicated 19 // WebSharedWorker. It contains logic to support starting up both dedicated
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // Sends a message to the worker thread (forwarded via the RenderViewHost). 52 // Sends a message to the worker thread (forwarded via the RenderViewHost).
52 // If WorkerStarted() has not yet been called, message is queued. 53 // If WorkerStarted() has not yet been called, message is queued.
53 bool Send(IPC::Message*); 54 bool Send(IPC::Message*);
54 55
55 // Returns true if there are queued messages. 56 // Returns true if there are queued messages.
56 bool HasQueuedMessages() { return !queued_messages_.empty(); } 57 bool HasQueuedMessages() { return !queued_messages_.empty(); }
57 58
58 // Sends any messages currently in the queue. 59 // Sends any messages currently in the queue.
59 void SendQueuedMessages(); 60 void SendQueuedMessages();
60 61
62 class DevToolsDelegate {
63 public:
64 virtual void WorkerProxyDestroyed() = 0;
65 virtual void SetRouteId(int route_id) = 0;
66 virtual bool OnMessageReceived(const IPC::Message& message) = 0;
67
68 virtual void AttachDevTools() = 0;
69 virtual void DetachDevTools() = 0;
70 virtual void SendDevToolsMessage(const std::string&) = 0;
71 };
72 void set_devtools_delegate(DevToolsDelegate*);
73
61 protected: 74 protected:
62 WebWorkerBase(ChildThread* child_thread, 75 WebWorkerBase(ChildThread* child_thread,
63 unsigned long long document_id, 76 unsigned long long document_id,
64 int route_id, 77 int route_id,
65 int render_view_route_id, 78 int render_view_route_id,
66 int parent_appcache_host_id); 79 int parent_appcache_host_id);
67 80
68 // Routing id associated with this worker - used to receive messages from the 81 // Routing id associated with this worker - used to receive messages from the
69 // worker, and also to route messages to the worker (WorkerService contains 82 // worker, and also to route messages to the worker (WorkerService contains
70 // a map that maps between these renderer-side route IDs and worker-side 83 // a map that maps between these renderer-side route IDs and worker-side
71 // routing ids). 84 // routing ids).
72 int route_id_; 85 int route_id_;
73 86
74 // The routing id for the RenderView that created this worker. 87 // The routing id for the RenderView that created this worker.
75 int render_view_route_id_; 88 int render_view_route_id_;
76 89
77 ChildThread* child_thread_; 90 ChildThread* child_thread_;
78 91
92 DevToolsDelegate* devtools_delegate_;
93
79 private: 94 private:
80 void CreateWorkerContext(const GURL& script_url, 95 void CreateWorkerContext(const GURL& script_url,
81 bool is_shared, 96 bool is_shared,
82 const string16& name, 97 const string16& name,
83 const string16& user_agent, 98 const string16& user_agent,
84 const string16& source_code, 99 const string16& source_code,
85 int pending_route_id, 100 int pending_route_id,
86 int64 script_resource_appcache_id); 101 int64 script_resource_appcache_id);
87 102
88 // ID of our parent document (used to shutdown workers when the parent 103 // ID of our parent document (used to shutdown workers when the parent
89 // document is detached). 104 // document is detached).
90 unsigned long long document_id_; 105 unsigned long long document_id_;
91 106
92 // ID of our parent's appcache host, only valid for dedicated workers. 107 // ID of our parent's appcache host, only valid for dedicated workers.
93 int parent_appcache_host_id_; 108 int parent_appcache_host_id_;
94 109
95 // Stores messages that were sent before the StartWorkerContext message. 110 // Stores messages that were sent before the StartWorkerContext message.
96 std::vector<IPC::Message*> queued_messages_; 111 std::vector<IPC::Message*> queued_messages_;
97 }; 112 };
98 113
99 #endif // CONTENT_RENDERER_WEBWORKER_BASE_H_ 114 #endif // CONTENT_RENDERER_WEBWORKER_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698