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

Side by Side Diff: content/browser/debugger/worker_devtools_manager.h

Issue 11630004: DevTools: rename debugger/ to devtools/, move DevTools files into content/renderer/devtools. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: For landing Created 8 years 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
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_DEBUGGER_WORKER_DEVTOOLS_MANAGER_H_
6 #define CONTENT_BROWSER_DEBUGGER_WORKER_DEVTOOLS_MANAGER_H_
7
8 #include <list>
9 #include <map>
10 #include <string>
11
12 #include "base/basictypes.h"
13 #include "base/memory/singleton.h"
14 #include "content/common/content_export.h"
15 #include "content/browser/worker_host/worker_process_host.h"
16
17 namespace content {
18
19 class DevToolsAgentHost;
20
21 // All methods are supposed to be called on the IO thread.
22 class WorkerDevToolsManager {
23 public:
24 // Returns the WorkerDevToolsManager singleton.
25 static WorkerDevToolsManager* GetInstance();
26
27 // Called on the UI thread.
28 static DevToolsAgentHost* GetDevToolsAgentHostForWorker(
29 int worker_process_id,
30 int worker_route_id);
31
32 void ForwardToDevToolsClient(int worker_process_id,
33 int worker_route_id,
34 const std::string& message);
35 void SaveAgentRuntimeState(int worker_process_id,
36 int worker_route_id,
37 const std::string& state);
38
39 // Called on the IO thread.
40 void WorkerCreated(
41 WorkerProcessHost* process,
42 const WorkerProcessHost::WorkerInstance& instance);
43 void WorkerDestroyed(WorkerProcessHost* process, int worker_route_id);
44 void WorkerContextStarted(WorkerProcessHost* process, int worker_route_id);
45
46 private:
47 friend struct DefaultSingletonTraits<WorkerDevToolsManager>;
48 typedef std::pair<int, int> WorkerId;
49 class AgentHosts;
50 class DetachedClientHosts;
51 class WorkerDevToolsAgentHost;
52 struct InspectedWorker;
53 typedef std::list<InspectedWorker> InspectedWorkersList;
54
55 WorkerDevToolsManager();
56 virtual ~WorkerDevToolsManager();
57
58 void RemoveInspectedWorkerData(const WorkerId& id);
59 InspectedWorkersList::iterator FindInspectedWorker(int host_id, int route_id);
60
61 void RegisterDevToolsAgentHostForWorker(int worker_process_id,
62 int worker_route_id);
63 void ForwardToWorkerDevToolsAgent(int worker_process_host_id,
64 int worker_route_id,
65 const IPC::Message& message);
66 static void ForwardToDevToolsClientOnUIThread(
67 int worker_process_id,
68 int worker_route_id,
69 const std::string& message);
70 static void SaveAgentRuntimeStateOnUIThread(
71 int worker_process_id,
72 int worker_route_id,
73 const std::string& state);
74 static void NotifyWorkerDestroyedOnIOThread(int worker_process_id,
75 int worker_route_id);
76 static void NotifyWorkerDestroyedOnUIThread(int worker_process_id,
77 int worker_route_id);
78 static void SendResumeToWorker(const WorkerId& id);
79
80 InspectedWorkersList inspected_workers_;
81
82 struct TerminatedInspectedWorker;
83 typedef std::list<TerminatedInspectedWorker> TerminatedInspectedWorkers;
84 // List of terminated workers for which there may be a devtools client on
85 // the UI thread. Worker entry is added into this list when inspected worker
86 // is terminated and will be removed in one of two cases:
87 // - shared worker with the same URL and name is started(in wich case we will
88 // try to reattach existing DevTools client to the new worker).
89 // - DevTools client which was inspecting terminated worker is closed on the
90 // UI thread and and WorkerDevToolsManager is notified about that on the IO
91 // thread.
92 TerminatedInspectedWorkers terminated_workers_;
93
94 typedef std::map<WorkerId, WorkerId> PausedWorkers;
95 // Map from old to new worker id for the inspected workers that have been
96 // terminated and started again in paused state. Worker data will be removed
97 // from this list in one of two cases:
98 // - DevTools client is closed on the UI thread, WorkerDevToolsManager was
99 // notified about that on the IO thread and sent "resume" message to the
100 // worker.
101 // - Existing DevTools client was reattached to the new worker.
102 PausedWorkers paused_workers_;
103
104 DISALLOW_COPY_AND_ASSIGN(WorkerDevToolsManager);
105 };
106
107 } // namespace content
108
109 #endif // CONTENT_BROWSER_DEBUGGER_WORKER_DEVTOOLS_MANAGER_H_
OLDNEW
« no previous file with comments | « content/browser/debugger/render_view_devtools_agent_host.cc ('k') | content/browser/debugger/worker_devtools_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698