blob: 910fd400e6bc4c9bafa20b63f4c05cb33260a9c3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_DEVTOOLS_WORKER_DEVTOOLS_MANAGER_H_
#define CONTENT_BROWSER_DEVTOOLS_WORKER_DEVTOOLS_MANAGER_H_
#include <map>
#include <vector>
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "content/common/content_export.h"
namespace content {
class DevToolsAgentHost;
class DevToolsAgentHostImpl;
class WorkerDevToolsAgentHost;
// A base class of SharedWorkerDevToolsManager and ServiceWorkerDevToolsManager,
// provides common default implementation for them.
// This class lives on UI thread.
class CONTENT_EXPORT WorkerDevToolsManager {
public:
typedef std::pair<int, int> WorkerId;
DevToolsAgentHostImpl* GetDevToolsAgentHostForWorker(int worker_process_id,
int worker_route_id);
void AddAllAgentHosts(std::vector<scoped_refptr<DevToolsAgentHost>>* result);
void WorkerReadyForInspection(int worker_process_id, int worker_route_id);
void WorkerDestroyed(int worker_process_id, int worker_route_id);
protected:
typedef std::map<WorkerId, WorkerDevToolsAgentHost*> AgentHostMap;
friend class SharedWorkerDevToolsManagerTest;
WorkerDevToolsManager();
virtual ~WorkerDevToolsManager();
void RemoveInspectedWorkerData(WorkerId id);
void WorkerRestarted(const WorkerId& id, const AgentHostMap::iterator& it);
AgentHostMap& workers() { return workers_; }
private:
AgentHostMap workers_;
DISALLOW_COPY_AND_ASSIGN(WorkerDevToolsManager);
};
} // namespace content
#endif // CONTENT_BROWSER_DEVTOOLS_WORKER_DEVTOOLS_MANAGER_H_
|