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_NETLOG_OBSERVER_H_ | 5 #ifndef CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_NETLOG_OBSERVER_H_ |
6 #define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_NETLOG_OBSERVER_H_ | 6 #define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_NETLOG_OBSERVER_H_ |
7 | 7 |
8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "content/public/common/resource_devtools_info.h" | 10 #include "content/public/common/resource_devtools_info.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 // actual HTTP/SPDY headers sent and received over the network. | 22 // actual HTTP/SPDY headers sent and received over the network. |
23 // | 23 // |
24 // As DevToolsNetLogObserver shares live data with objects that live on the | 24 // As DevToolsNetLogObserver shares live data with objects that live on the |
25 // IO Thread, it must also reside on the IO Thread. Only OnAddEntry can be | 25 // IO Thread, it must also reside on the IO Thread. Only OnAddEntry can be |
26 // called from other threads. | 26 // called from other threads. |
27 class DevToolsNetLogObserver : public net::NetLog::ThreadSafeObserver { | 27 class DevToolsNetLogObserver : public net::NetLog::ThreadSafeObserver { |
28 typedef ResourceDevToolsInfo ResourceInfo; | 28 typedef ResourceDevToolsInfo ResourceInfo; |
29 | 29 |
30 public: | 30 public: |
31 // net::NetLog::ThreadSafeObserver implementation: | 31 // net::NetLog::ThreadSafeObserver implementation: |
32 virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE; | 32 virtual void OnAddEntry(const net::NetLog::Entry& entry) override; |
33 | 33 |
34 void OnAddURLRequestEntry(const net::NetLog::Entry& entry); | 34 void OnAddURLRequestEntry(const net::NetLog::Entry& entry); |
35 | 35 |
36 static void Attach(); | 36 static void Attach(); |
37 static void Detach(); | 37 static void Detach(); |
38 | 38 |
39 // 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 |
40 // are active. | 40 // are active. |
41 static DevToolsNetLogObserver* GetInstance(); | 41 static DevToolsNetLogObserver* GetInstance(); |
42 static void PopulateResponseInfo(net::URLRequest*, | 42 static void PopulateResponseInfo(net::URLRequest*, |
43 ResourceResponse*); | 43 ResourceResponse*); |
44 | 44 |
45 private: | 45 private: |
46 static DevToolsNetLogObserver* instance_; | 46 static DevToolsNetLogObserver* instance_; |
47 | 47 |
48 DevToolsNetLogObserver(); | 48 DevToolsNetLogObserver(); |
49 virtual ~DevToolsNetLogObserver(); | 49 virtual ~DevToolsNetLogObserver(); |
50 | 50 |
51 ResourceInfo* GetResourceInfo(uint32 id); | 51 ResourceInfo* GetResourceInfo(uint32 id); |
52 | 52 |
53 typedef base::hash_map<uint32, scoped_refptr<ResourceInfo> > RequestToInfoMap; | 53 typedef base::hash_map<uint32, scoped_refptr<ResourceInfo> > RequestToInfoMap; |
54 RequestToInfoMap request_to_info_; | 54 RequestToInfoMap request_to_info_; |
55 | 55 |
56 DISALLOW_COPY_AND_ASSIGN(DevToolsNetLogObserver); | 56 DISALLOW_COPY_AND_ASSIGN(DevToolsNetLogObserver); |
57 }; | 57 }; |
58 | 58 |
59 } // namespace content | 59 } // namespace content |
60 | 60 |
61 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_NETLOG_OBSERVER_H_ | 61 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_NETLOG_OBSERVER_H_ |
OLD | NEW |