| 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_DEBUGGER_DEVTOOLS_NETLOG_OBSERVER_H_ | 5 #ifndef CONTENT_BROWSER_DEBUGGER_DEVTOOLS_NETLOG_OBSERVER_H_ |
| 6 #define CONTENT_BROWSER_DEBUGGER_DEVTOOLS_NETLOG_OBSERVER_H_ | 6 #define CONTENT_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/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // actual HTTP/SPDY headers sent and received over the network. | 24 // actual HTTP/SPDY headers sent and received over the network. |
| 25 // | 25 // |
| 26 // As DevToolsNetLogObserver shares live data with objects that live on the | 26 // As DevToolsNetLogObserver shares live data with objects that live on the |
| 27 // IO Thread, it must also reside on the IO Thread. Only OnAddEntry can be | 27 // IO Thread, it must also reside on the IO Thread. Only OnAddEntry can be |
| 28 // called from other threads. | 28 // called from other threads. |
| 29 class DevToolsNetLogObserver : public net::NetLog::ThreadSafeObserver { | 29 class DevToolsNetLogObserver : public net::NetLog::ThreadSafeObserver { |
| 30 typedef webkit_glue::ResourceDevToolsInfo ResourceInfo; | 30 typedef webkit_glue::ResourceDevToolsInfo ResourceInfo; |
| 31 | 31 |
| 32 public: | 32 public: |
| 33 // net::NetLog::ThreadSafeObserver implementation: | 33 // net::NetLog::ThreadSafeObserver implementation: |
| 34 virtual void OnAddEntry(net::NetLog::EventType type, | 34 virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE; |
| 35 const base::TimeTicks& time, | |
| 36 const net::NetLog::Source& source, | |
| 37 net::NetLog::EventPhase phase, | |
| 38 net::NetLog::EventParameters* params) OVERRIDE; | |
| 39 | 35 |
| 40 void OnAddURLRequestEntry(net::NetLog::EventType type, | 36 void OnAddURLRequestEntry(const net::NetLog::Entry& entry); |
| 41 const base::TimeTicks& time, | 37 void OnAddHTTPStreamJobEntry(const net::NetLog::Entry& entry); |
| 42 const net::NetLog::Source& source, | 38 void OnAddSocketEntry(const net::NetLog::Entry& entry); |
| 43 net::NetLog::EventPhase phase, | |
| 44 net::NetLog::EventParameters* params); | |
| 45 | |
| 46 void OnAddHTTPStreamJobEntry(net::NetLog::EventType type, | |
| 47 const base::TimeTicks& time, | |
| 48 const net::NetLog::Source& source, | |
| 49 net::NetLog::EventPhase phase, | |
| 50 net::NetLog::EventParameters* params); | |
| 51 | |
| 52 void OnAddSocketEntry(net::NetLog::EventType type, | |
| 53 const base::TimeTicks& time, | |
| 54 const net::NetLog::Source& source, | |
| 55 net::NetLog::EventPhase phase, | |
| 56 net::NetLog::EventParameters* params); | |
| 57 | 39 |
| 58 static void Attach(); | 40 static void Attach(); |
| 59 static void Detach(); | 41 static void Detach(); |
| 60 | 42 |
| 61 // Must be called on the IO thread. May return NULL if no observers | 43 // Must be called on the IO thread. May return NULL if no observers |
| 62 // are active. | 44 // are active. |
| 63 static DevToolsNetLogObserver* GetInstance(); | 45 static DevToolsNetLogObserver* GetInstance(); |
| 64 static void PopulateResponseInfo(net::URLRequest*, | 46 static void PopulateResponseInfo(net::URLRequest*, |
| 65 content::ResourceResponse*); | 47 content::ResourceResponse*); |
| 66 static int GetAndResetEncodedDataLength(net::URLRequest* request); | 48 static int GetAndResetEncodedDataLength(net::URLRequest* request); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 79 typedef base::hash_map<uint32, uint32> SocketToRequestMap; | 61 typedef base::hash_map<uint32, uint32> SocketToRequestMap; |
| 80 RequestToInfoMap request_to_info_; | 62 RequestToInfoMap request_to_info_; |
| 81 RequestToEncodedDataLengthMap request_to_encoded_data_length_; | 63 RequestToEncodedDataLengthMap request_to_encoded_data_length_; |
| 82 HTTPStreamJobToSocketMap http_stream_job_to_socket_; | 64 HTTPStreamJobToSocketMap http_stream_job_to_socket_; |
| 83 SocketToRequestMap socket_to_request_; | 65 SocketToRequestMap socket_to_request_; |
| 84 | 66 |
| 85 DISALLOW_COPY_AND_ASSIGN(DevToolsNetLogObserver); | 67 DISALLOW_COPY_AND_ASSIGN(DevToolsNetLogObserver); |
| 86 }; | 68 }; |
| 87 | 69 |
| 88 #endif // CONTENT_BROWSER_DEBUGGER_DEVTOOLS_NETLOG_OBSERVER_H_ | 70 #endif // CONTENT_BROWSER_DEBUGGER_DEVTOOLS_NETLOG_OBSERVER_H_ |
| OLD | NEW |