| 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 namespace net { | 14 namespace net { |
| 15 class URLRequest; | 15 class URLRequest; |
| 16 } // namespace net | 16 } // namespace net |
| 17 | 17 |
| 18 class IOThread; | 18 class IOThread; |
| 19 struct ResourceResponse; | 19 struct ResourceResponse; |
| 20 | 20 |
| 21 // DevToolsNetLogObserver watches the NetLog event stream and collects the | 21 // DevToolsNetLogObserver watches the NetLog event stream and collects the |
| 22 // stuff that may be of interest to DevTools. Currently, this only includes | 22 // stuff that may be of interest to DevTools. Currently, this only includes |
| 23 // actual HTTP/SPDY headers sent and received over the network. | 23 // actual HTTP/SPDY headers sent and received over the network. |
| 24 class DevToolsNetLogObserver: public ChromeNetLog::Observer { | 24 // |
| 25 // As DevToolsNetLogObserver shares live data with objects that live on the |
| 26 // IO Thread, it must also reside on the IO Thread. Only OnAddEntry can be |
| 27 // called from other threads. |
| 28 class DevToolsNetLogObserver: public ChromeNetLog::ThreadSafeObserver { |
| 25 typedef webkit_glue::ResourceDevToolsInfo ResourceInfo; | 29 typedef webkit_glue::ResourceDevToolsInfo ResourceInfo; |
| 26 | 30 |
| 27 public: | 31 public: |
| 28 // Observer implementation: | 32 // ThreadSafeObserver implementation: |
| 29 virtual void OnAddEntry(net::NetLog::EventType type, | 33 virtual void OnAddEntry(net::NetLog::EventType type, |
| 30 const base::TimeTicks& time, | 34 const base::TimeTicks& time, |
| 31 const net::NetLog::Source& source, | 35 const net::NetLog::Source& source, |
| 32 net::NetLog::EventPhase phase, | 36 net::NetLog::EventPhase phase, |
| 33 net::NetLog::EventParameters* params); | 37 net::NetLog::EventParameters* params); |
| 34 | 38 |
| 35 static void Attach(IOThread* thread); | 39 static void Attach(IOThread* thread); |
| 36 static void Detach(); | 40 static void Detach(); |
| 37 | 41 |
| 38 // Must be called on the IO thread. May return NULL if no observers | 42 // Must be called on the IO thread. May return NULL if no observers |
| (...skipping 12 matching lines...) Expand all Loading... |
| 51 | 55 |
| 52 ResourceInfo* GetResourceInfo(uint32 id); | 56 ResourceInfo* GetResourceInfo(uint32 id); |
| 53 | 57 |
| 54 ChromeNetLog* chrome_net_log_; | 58 ChromeNetLog* chrome_net_log_; |
| 55 RequestToInfoMap request_to_info_; | 59 RequestToInfoMap request_to_info_; |
| 56 | 60 |
| 57 DISALLOW_COPY_AND_ASSIGN(DevToolsNetLogObserver); | 61 DISALLOW_COPY_AND_ASSIGN(DevToolsNetLogObserver); |
| 58 }; | 62 }; |
| 59 | 63 |
| 60 #endif // CHROME_BROWSER_DEBUGGER_DEVTOOLS_NETLOG_OBSERVER_H_ | 64 #endif // CHROME_BROWSER_DEBUGGER_DEVTOOLS_NETLOG_OBSERVER_H_ |
| OLD | NEW |