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

Side by Side Diff: content/browser/devtools/shared_worker_devtools_manager.h

Issue 223583002: Revert of Make DevTools support for the embedded SharedWorker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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
« no previous file with comments | « no previous file | content/browser/devtools/shared_worker_devtools_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 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_DEVTOOLS_SHARED_WORKER_DEVTOOLS_MANAGER_H_
6 #define CONTENT_BROWSER_DEVTOOLS_SHARED_WORKER_DEVTOOLS_MANAGER_H_
7
8 #include "base/basictypes.h"
9 #include "base/containers/scoped_ptr_hash_map.h"
10 #include "base/gtest_prod_util.h"
11 #include "base/memory/scoped_vector.h"
12 #include "base/memory/singleton.h"
13 #include "base/strings/string16.h"
14 #include "content/browser/shared_worker/shared_worker_instance.h"
15 #include "content/common/content_export.h"
16
17 class GURL;
18
19 namespace content {
20 class DevToolsAgentHost;
21
22 // SharedWorkerDevToolsManager is used instead of WorkerDevToolsManager when
23 // "enable-embedded-shared-worker" flag is set.
24 // This class lives on UI thread.
25 class CONTENT_EXPORT SharedWorkerDevToolsManager {
26 public:
27 typedef std::pair<int, int> WorkerId;
28 class SharedWorkerDevToolsAgentHost;
29
30 // Returns the SharedWorkerDevToolsManager singleton.
31 static SharedWorkerDevToolsManager* GetInstance();
32
33 DevToolsAgentHost* GetDevToolsAgentHostForWorker(int worker_process_id,
34 int worker_route_id);
35
36 // Returns true when the worker must be paused on start.
37 bool WorkerCreated(int worker_process_id,
38 int worker_route_id,
39 const SharedWorkerInstance& instance);
40 void WorkerDestroyed(int worker_process_id, int worker_route_id);
41 void WorkerContextStarted(int worker_process_id, int worker_route_id);
42
43 private:
44 friend struct DefaultSingletonTraits<SharedWorkerDevToolsManager>;
45 friend class SharedWorkerDevToolsManagerTest;
46 FRIEND_TEST_ALL_PREFIXES(SharedWorkerDevToolsManagerTest, BasicTest);
47 FRIEND_TEST_ALL_PREFIXES(SharedWorkerDevToolsManagerTest, AttachTest);
48
49 enum WorkerState {
50 WORKER_UNINSPECTED,
51 WORKER_INSPECTED,
52 WORKER_TERMINATED,
53 WORKER_PAUSED,
54 };
55
56 class WorkerInfo {
57 public:
58 explicit WorkerInfo(const SharedWorkerInstance& instance)
59 : instance_(instance), state_(WORKER_UNINSPECTED), agent_host_(NULL) {}
60
61 const SharedWorkerInstance& instance() const { return instance_; }
62 WorkerState state() { return state_; }
63 void set_state(WorkerState new_state) { state_ = new_state; }
64 SharedWorkerDevToolsAgentHost* agent_host() { return agent_host_; }
65 void set_agent_host(SharedWorkerDevToolsAgentHost* agent_host) {
66 agent_host_ = agent_host;
67 }
68
69 private:
70 const SharedWorkerInstance instance_;
71 WorkerState state_;
72 SharedWorkerDevToolsAgentHost* agent_host_;
73 };
74
75 typedef base::ScopedPtrHashMap<WorkerId, WorkerInfo> WorkerInfoMap;
76
77 SharedWorkerDevToolsManager();
78 virtual ~SharedWorkerDevToolsManager();
79
80 void RemoveInspectedWorkerData(SharedWorkerDevToolsAgentHost* agent_host);
81
82 WorkerInfoMap::iterator FindExistingWorkerInfo(
83 const SharedWorkerInstance& instance);
84
85 // Resets to its initial state as if newly created.
86 void ResetForTesting();
87
88 WorkerInfoMap workers_;
89
90 DISALLOW_COPY_AND_ASSIGN(SharedWorkerDevToolsManager);
91 };
92
93 } // namespace content
94
95 #endif // CONTENT_BROWSER_DEVTOOLS_SHARED_WORKER_DEVTOOLS_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/devtools/shared_worker_devtools_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698