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.
5 #ifndef CONTENT_BROWSER_DEVTOOLS_SHARED_WORKER_DEVTOOLS_MANAGER_H_
6 #define CONTENT_BROWSER_DEVTOOLS_SHARED_WORKER_DEVTOOLS_MANAGER_H_
8 #include "base/basictypes.h"
9 #include "base/gtest_prod_util.h"
10 #include "base/memory/singleton.h"
11 #include "content/browser/devtools/worker_devtools_manager.h"
15 class SharedWorkerDevToolsAgentHost
;
16 class SharedWorkerInstance
;
18 // Manages WorkerDevToolsAgentHost's for Shared Workers.
19 // This class lives on UI thread.
20 class CONTENT_EXPORT SharedWorkerDevToolsManager
21 : public WorkerDevToolsManager
{
23 // Returns the SharedWorkerDevToolsManager singleton.
24 static SharedWorkerDevToolsManager
* GetInstance();
26 // Returns true when the worker must be paused on start because a DevTool
27 // window for the same former SharedWorkerInstance is still opened.
28 bool WorkerCreated(int worker_process_id
,
30 const SharedWorkerInstance
& instance
);
33 friend struct DefaultSingletonTraits
<SharedWorkerDevToolsManager
>;
34 friend class SharedWorkerDevToolsAgentHost
;
35 friend class SharedWorkerDevToolsManagerTest
;
36 FRIEND_TEST_ALL_PREFIXES(SharedWorkerDevToolsManagerTest
, BasicTest
);
37 FRIEND_TEST_ALL_PREFIXES(SharedWorkerDevToolsManagerTest
, AttachTest
);
39 SharedWorkerDevToolsManager();
40 ~SharedWorkerDevToolsManager() override
;
42 AgentHostMap::iterator
FindExistingWorkerAgentHost(
43 const SharedWorkerInstance
& instance
);
45 // Resets to its initial state as if newly created.
46 void ResetForTesting();
48 DISALLOW_COPY_AND_ASSIGN(SharedWorkerDevToolsManager
);
51 } // namespace content
53 #endif // CONTENT_BROWSER_DEVTOOLS_SHARED_WORKER_DEVTOOLS_MANAGER_H_