OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_BROWSER_DEBUGGER_DEVTOOLS_NETLOG_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_DEBUGGER_DEVTOOLS_NETLOG_OBSERVER_H_ |
6 #define CHROME_BROWSER_DEBUGGER_DEVTOOLS_NETLOG_OBSERVER_H_ | 6 #define CHROME_BROWSER_DEBUGGER_DEVTOOLS_NETLOG_OBSERVER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/hash_tables.h" | 9 #include "base/hash_tables.h" |
10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
11 #include "chrome/browser/net/chrome_net_log.h" | 11 #include "chrome/browser/net/chrome_net_log.h" |
12 #include "webkit/glue/resource_loader_bridge.h" | 12 #include "webkit/glue/resource_loader_bridge.h" |
13 | 13 |
14 class IOThread; | 14 class IOThread; |
15 class URLRequest; | 15 class URLRequest; |
16 struct ResourceResponse; | 16 struct ResourceResponse; |
17 | 17 |
18 // DevToolsNetLogObserver watches the NetLog event stream and collects the | 18 // DevToolsNetLogObserver watches the NetLog event stream and collects the |
19 // stuff that may be of interest to DevTools. Currently, this only includes | 19 // stuff that may be of interest to DevTools. Currently, this only includes |
20 // actual HTTP/SPDY headers sent and received over the network. | 20 // actual HTTP/SPDY headers sent and received over the network. |
21 class DevToolsNetLogObserver: public ChromeNetLog::Observer { | 21 // |
| 22 // As DevToolsNetLogObserver shares live data with objects that live on the |
| 23 // IO Thread, it must also reside on the IO Thread. Only OnAddEntry can be |
| 24 // called from other threads. |
| 25 class DevToolsNetLogObserver: public ChromeNetLog::ThreadSafeObserver { |
22 typedef webkit_glue::ResourceDevToolsInfo ResourceInfo; | 26 typedef webkit_glue::ResourceDevToolsInfo ResourceInfo; |
23 | 27 |
24 public: | 28 public: |
25 // Observer implementation: | 29 // ThreadSafeObserver implementation: |
26 virtual void OnAddEntry(net::NetLog::EventType type, | 30 virtual void OnAddEntry(net::NetLog::EventType type, |
27 const base::TimeTicks& time, | 31 const base::TimeTicks& time, |
28 const net::NetLog::Source& source, | 32 const net::NetLog::Source& source, |
29 net::NetLog::EventPhase phase, | 33 net::NetLog::EventPhase phase, |
30 net::NetLog::EventParameters* params); | 34 net::NetLog::EventParameters* params); |
31 | 35 |
32 static void Attach(IOThread* thread); | 36 static void Attach(IOThread* thread); |
33 static void Detach(); | 37 static void Detach(); |
34 | 38 |
35 // Must be called on the IO thread. May return NULL if no observers | 39 // Must be called on the IO thread. May return NULL if no observers |
(...skipping 12 matching lines...) Expand all Loading... |
48 | 52 |
49 ResourceInfo* GetResourceInfo(uint32 id); | 53 ResourceInfo* GetResourceInfo(uint32 id); |
50 | 54 |
51 ChromeNetLog* chrome_net_log_; | 55 ChromeNetLog* chrome_net_log_; |
52 RequestToInfoMap request_to_info_; | 56 RequestToInfoMap request_to_info_; |
53 | 57 |
54 DISALLOW_COPY_AND_ASSIGN(DevToolsNetLogObserver); | 58 DISALLOW_COPY_AND_ASSIGN(DevToolsNetLogObserver); |
55 }; | 59 }; |
56 | 60 |
57 #endif // CHROME_BROWSER_DEBUGGER_DEVTOOLS_NETLOG_OBSERVER_H_ | 61 #endif // CHROME_BROWSER_DEBUGGER_DEVTOOLS_NETLOG_OBSERVER_H_ |
OLD | NEW |