| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BROWSER_DEBUGGER_WORKER_DEVTOOLS_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_DEBUGGER_WORKER_DEVTOOLS_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_DEBUGGER_WORKER_DEVTOOLS_MANAGER_H_ | 6 #define CONTENT_BROWSER_DEBUGGER_WORKER_DEVTOOLS_MANAGER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/singleton.h" | 14 #include "base/memory/singleton.h" |
| 15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
| 16 #include "content/browser/worker_host/worker_service_observer.h" | 16 #include "content/browser/worker_host/worker_service_observer.h" |
| 17 | 17 |
| 18 class DevToolsAgentHost; | |
| 19 | |
| 20 namespace IPC { | 18 namespace IPC { |
| 21 class Message; | 19 class Message; |
| 22 } | 20 } |
| 23 | 21 |
| 22 namespace content { |
| 23 |
| 24 class DevToolsAgentHost; |
| 25 |
| 24 // All methods are supposed to be called on the IO thread. | 26 // All methods are supposed to be called on the IO thread. |
| 25 class WorkerDevToolsManager : private WorkerServiceObserver { | 27 class WorkerDevToolsManager : private WorkerServiceObserver { |
| 26 public: | 28 public: |
| 27 // Returns the WorkerDevToolsManager singleton. | 29 // Returns the WorkerDevToolsManager singleton. |
| 28 static WorkerDevToolsManager* GetInstance(); | 30 static WorkerDevToolsManager* GetInstance(); |
| 29 | 31 |
| 30 // Called on the UI thread. | 32 // Called on the UI thread. |
| 31 CONTENT_EXPORT static DevToolsAgentHost* GetDevToolsAgentHostForWorker( | 33 static DevToolsAgentHost* GetDevToolsAgentHostForWorker( |
| 32 int worker_process_id, | 34 int worker_process_id, |
| 33 int worker_route_id); | 35 int worker_route_id); |
| 34 | 36 |
| 35 void ForwardToDevToolsClient(int worker_process_id, | 37 void ForwardToDevToolsClient(int worker_process_id, |
| 36 int worker_route_id, | 38 int worker_route_id, |
| 37 const IPC::Message& message); | 39 const std::string& message); |
| 38 void SaveAgentRuntimeState(int worker_process_id, | 40 void SaveAgentRuntimeState(int worker_process_id, |
| 39 int worker_route_id, | 41 int worker_route_id, |
| 40 const std::string& state); | 42 const std::string& state); |
| 41 | 43 |
| 42 private: | 44 private: |
| 43 friend struct DefaultSingletonTraits<WorkerDevToolsManager>; | 45 friend struct DefaultSingletonTraits<WorkerDevToolsManager>; |
| 44 typedef std::pair<int, int> WorkerId; | 46 typedef std::pair<int, int> WorkerId; |
| 45 class AgentHosts; | 47 class AgentHosts; |
| 46 class DetachedClientHosts; | 48 class DetachedClientHosts; |
| 47 class WorkerDevToolsAgentHost; | 49 class WorkerDevToolsAgentHost; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 65 InspectedWorkersList::iterator FindInspectedWorker(int host_id, int route_id); | 67 InspectedWorkersList::iterator FindInspectedWorker(int host_id, int route_id); |
| 66 | 68 |
| 67 void RegisterDevToolsAgentHostForWorker(int worker_process_id, | 69 void RegisterDevToolsAgentHostForWorker(int worker_process_id, |
| 68 int worker_route_id); | 70 int worker_route_id); |
| 69 void ForwardToWorkerDevToolsAgent(int worker_process_host_id, | 71 void ForwardToWorkerDevToolsAgent(int worker_process_host_id, |
| 70 int worker_route_id, | 72 int worker_route_id, |
| 71 const IPC::Message& message); | 73 const IPC::Message& message); |
| 72 static void ForwardToDevToolsClientOnUIThread( | 74 static void ForwardToDevToolsClientOnUIThread( |
| 73 int worker_process_id, | 75 int worker_process_id, |
| 74 int worker_route_id, | 76 int worker_route_id, |
| 75 const IPC::Message& message); | 77 const std::string& message); |
| 76 static void SaveAgentRuntimeStateOnUIThread( | 78 static void SaveAgentRuntimeStateOnUIThread( |
| 77 int worker_process_id, | 79 int worker_process_id, |
| 78 int worker_route_id, | 80 int worker_route_id, |
| 79 const std::string& state); | 81 const std::string& state); |
| 80 static void NotifyWorkerDestroyedOnIOThread(int worker_process_id, | 82 static void NotifyWorkerDestroyedOnIOThread(int worker_process_id, |
| 81 int worker_route_id); | 83 int worker_route_id); |
| 82 static void NotifyWorkerDestroyedOnUIThread(int worker_process_id, | 84 static void NotifyWorkerDestroyedOnUIThread(int worker_process_id, |
| 83 int worker_route_id); | 85 int worker_route_id); |
| 84 static void SendResumeToWorker(const WorkerId& id); | 86 static void SendResumeToWorker(const WorkerId& id); |
| 85 | 87 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 103 // from this list in one of two cases: | 105 // from this list in one of two cases: |
| 104 // - DevTools client is closed on the UI thread, WorkerDevToolsManager was | 106 // - DevTools client is closed on the UI thread, WorkerDevToolsManager was |
| 105 // notified about that on the IO thread and sent "resume" message to the | 107 // notified about that on the IO thread and sent "resume" message to the |
| 106 // worker. | 108 // worker. |
| 107 // - Existing DevTools client was reattached to the new worker. | 109 // - Existing DevTools client was reattached to the new worker. |
| 108 PausedWorkers paused_workers_; | 110 PausedWorkers paused_workers_; |
| 109 | 111 |
| 110 DISALLOW_COPY_AND_ASSIGN(WorkerDevToolsManager); | 112 DISALLOW_COPY_AND_ASSIGN(WorkerDevToolsManager); |
| 111 }; | 113 }; |
| 112 | 114 |
| 115 } // namespace content |
| 116 |
| 113 #endif // CONTENT_BROWSER_DEBUGGER_WORKER_DEVTOOLS_MANAGER_H_ | 117 #endif // CONTENT_BROWSER_DEBUGGER_WORKER_DEVTOOLS_MANAGER_H_ |
| OLD | NEW |