OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_DEVTOOLS_DEVTOOLS_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_H_ |
6 #define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_H_ | 6 #define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 virtual ~DevToolsManager(); | 47 virtual ~DevToolsManager(); |
48 | 48 |
49 DevToolsManagerDelegate* delegate() const { return delegate_.get(); } | 49 DevToolsManagerDelegate* delegate() const { return delegate_.get(); } |
50 | 50 |
51 void AddObserver(Observer* observer); | 51 void AddObserver(Observer* observer); |
52 void RemoveObserver(Observer* observer); | 52 void RemoveObserver(Observer* observer); |
53 | 53 |
54 void RenderViewCreated(WebContents* web_contents, RenderViewHost* rvh); | 54 void RenderViewCreated(WebContents* web_contents, RenderViewHost* rvh); |
55 void AgentHostChanged(scoped_refptr<DevToolsAgentHost> agent_host); | 55 void AgentHostChanged(scoped_refptr<DevToolsAgentHost> agent_host); |
56 | 56 |
57 static void SetObserverThrottleIntervalForTest(base::TimeDelta interval); | 57 typedef base::Callback<void(base::Closure)> Scheduler; |
| 58 void SetSchedulerForTest(Scheduler scheduler); |
58 | 59 |
59 private: | 60 private: |
60 friend struct DefaultSingletonTraits<DevToolsManager>; | 61 friend struct DefaultSingletonTraits<DevToolsManager>; |
61 | 62 |
62 void UpdateTargetList(); | 63 void UpdateTargetList(); |
63 void UpdateTargetListThrottled(); | 64 void UpdateTargetListThrottled(); |
64 void NotifyTargetListChanged(const Observer::TargetList& targets); | 65 void NotifyTargetListChanged(const Observer::TargetList& targets); |
65 | 66 |
66 scoped_ptr<DevToolsManagerDelegate> delegate_; | 67 scoped_ptr<DevToolsManagerDelegate> delegate_; |
67 ObserverList<Observer> observer_list_; | 68 ObserverList<Observer> observer_list_; |
68 std::set<DevToolsAgentHost*> attached_hosts_; | 69 std::set<DevToolsAgentHost*> attached_hosts_; |
69 bool update_target_list_required_; | 70 bool update_target_list_required_; |
70 bool update_target_list_scheduled_; | 71 bool update_target_list_scheduled_; |
71 base::CancelableClosure update_target_list_callback_; | 72 base::CancelableClosure update_target_list_callback_; |
72 | 73 Scheduler scheduler_; |
73 static base::TimeDelta observer_throttle_interval_; | |
74 | 74 |
75 DISALLOW_COPY_AND_ASSIGN(DevToolsManager); | 75 DISALLOW_COPY_AND_ASSIGN(DevToolsManager); |
76 }; | 76 }; |
77 | 77 |
78 } // namespace content | 78 } // namespace content |
79 | 79 |
80 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_H_ | 80 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_H_ |
OLD | NEW |