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_NET_LOAD_TIMING_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_NET_LOAD_TIMING_OBSERVER_H_ |
6 #define CHROME_BROWSER_NET_LOAD_TIMING_OBSERVER_H_ | 6 #define CHROME_BROWSER_NET_LOAD_TIMING_OBSERVER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
11 #include "base/time.h" | 11 #include "base/time.h" |
12 #include "chrome/browser/net/chrome_net_log.h" | 12 #include "chrome/browser/net/chrome_net_log.h" |
13 #include "net/base/net_log.h" | 13 #include "net/base/net_log.h" |
14 #include "webkit/glue/resource_loader_bridge.h" | 14 #include "webkit/glue/resource_loader_bridge.h" |
15 | 15 |
| 16 namespace net { |
16 class URLRequest; | 17 class URLRequest; |
| 18 } // namespace net |
| 19 |
17 struct ResourceResponse; | 20 struct ResourceResponse; |
18 | 21 |
19 // LoadTimingObserver watches the NetLog event stream and collects the network | 22 // LoadTimingObserver watches the NetLog event stream and collects the network |
20 // timing information. | 23 // timing information. |
21 class LoadTimingObserver : public ChromeNetLog::Observer { | 24 class LoadTimingObserver : public ChromeNetLog::Observer { |
22 public: | 25 public: |
23 struct URLRequestRecord { | 26 struct URLRequestRecord { |
24 URLRequestRecord(); | 27 URLRequestRecord(); |
25 | 28 |
26 webkit_glue::ResourceLoadTimingInfo timing; | 29 webkit_glue::ResourceLoadTimingInfo timing; |
(...skipping 18 matching lines...) Expand all Loading... |
45 | 48 |
46 URLRequestRecord* GetURLRequestRecord(uint32 source_id); | 49 URLRequestRecord* GetURLRequestRecord(uint32 source_id); |
47 | 50 |
48 // Observer implementation: | 51 // Observer implementation: |
49 virtual void OnAddEntry(net::NetLog::EventType type, | 52 virtual void OnAddEntry(net::NetLog::EventType type, |
50 const base::TimeTicks& time, | 53 const base::TimeTicks& time, |
51 const net::NetLog::Source& source, | 54 const net::NetLog::Source& source, |
52 net::NetLog::EventPhase phase, | 55 net::NetLog::EventPhase phase, |
53 net::NetLog::EventParameters* params); | 56 net::NetLog::EventParameters* params); |
54 | 57 |
55 static void PopulateTimingInfo(URLRequest* request, | 58 static void PopulateTimingInfo(net::URLRequest* request, |
56 ResourceResponse* response); | 59 ResourceResponse* response); |
57 | 60 |
58 private: | 61 private: |
59 FRIEND_TEST_ALL_PREFIXES(LoadTimingObserverTest, | 62 FRIEND_TEST_ALL_PREFIXES(LoadTimingObserverTest, |
60 ConnectJobRecord); | 63 ConnectJobRecord); |
61 FRIEND_TEST_ALL_PREFIXES(LoadTimingObserverTest, | 64 FRIEND_TEST_ALL_PREFIXES(LoadTimingObserverTest, |
62 SocketRecord); | 65 SocketRecord); |
63 | 66 |
64 void OnAddURLRequestEntry(net::NetLog::EventType type, | 67 void OnAddURLRequestEntry(net::NetLog::EventType type, |
65 const base::TimeTicks& time, | 68 const base::TimeTicks& time, |
(...skipping 22 matching lines...) Expand all Loading... |
88 URLRequestToRecordMap url_request_to_record_; | 91 URLRequestToRecordMap url_request_to_record_; |
89 ConnectJobToRecordMap connect_job_to_record_; | 92 ConnectJobToRecordMap connect_job_to_record_; |
90 SocketToRecordMap socket_to_record_; | 93 SocketToRecordMap socket_to_record_; |
91 uint32 last_connect_job_id_; | 94 uint32 last_connect_job_id_; |
92 ConnectJobRecord last_connect_job_record_; | 95 ConnectJobRecord last_connect_job_record_; |
93 | 96 |
94 DISALLOW_COPY_AND_ASSIGN(LoadTimingObserver); | 97 DISALLOW_COPY_AND_ASSIGN(LoadTimingObserver); |
95 }; | 98 }; |
96 | 99 |
97 #endif // CHROME_BROWSER_NET_LOAD_TIMING_OBSERVER_H_ | 100 #endif // CHROME_BROWSER_NET_LOAD_TIMING_OBSERVER_H_ |
OLD | NEW |