Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(376)

Side by Side Diff: chrome/browser/net/load_timing_observer.h

Issue 10399083: Make NetLog take in callbacks that return Values (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix merge error Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 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"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 LoadTimingObserver(); 63 LoadTimingObserver();
64 virtual ~LoadTimingObserver(); 64 virtual ~LoadTimingObserver();
65 65
66 // Starts observing specified NetLog. Must not already be watching a NetLog. 66 // Starts observing specified NetLog. Must not already be watching a NetLog.
67 // Separate from constructor to enforce thread safety. 67 // Separate from constructor to enforce thread safety.
68 void StartObserving(net::NetLog* net_log); 68 void StartObserving(net::NetLog* net_log);
69 69
70 URLRequestRecord* GetURLRequestRecord(uint32 source_id); 70 URLRequestRecord* GetURLRequestRecord(uint32 source_id);
71 71
72 // net::NetLog::ThreadSafeObserver implementation: 72 // net::NetLog::ThreadSafeObserver implementation:
73 virtual void OnAddEntry(net::NetLog::EventType type, 73 virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE;
74 const base::TimeTicks& time,
75 const net::NetLog::Source& source,
76 net::NetLog::EventPhase phase,
77 net::NetLog::EventParameters* params) OVERRIDE;
78 74
79 static void PopulateTimingInfo(net::URLRequest* request, 75 static void PopulateTimingInfo(net::URLRequest* request,
80 content::ResourceResponse* response); 76 content::ResourceResponse* response);
81 77
82 private: 78 private:
83 FRIEND_TEST_ALL_PREFIXES(LoadTimingObserverTest, 79 FRIEND_TEST_ALL_PREFIXES(LoadTimingObserverTest,
84 HTTPStreamJobRecord); 80 HTTPStreamJobRecord);
85 FRIEND_TEST_ALL_PREFIXES(LoadTimingObserverTest, 81 FRIEND_TEST_ALL_PREFIXES(LoadTimingObserverTest,
86 ConnectJobRecord); 82 ConnectJobRecord);
87 FRIEND_TEST_ALL_PREFIXES(LoadTimingObserverTest, 83 FRIEND_TEST_ALL_PREFIXES(LoadTimingObserverTest,
88 SocketRecord); 84 SocketRecord);
89 85
90 void OnAddURLRequestEntry(net::NetLog::EventType type, 86 void OnAddURLRequestEntry(const net::NetLog::Entry& entry);
91 const base::TimeTicks& time, 87 void OnAddHTTPStreamJobEntry(const net::NetLog::Entry& entry);
92 const net::NetLog::Source& source, 88 void OnAddConnectJobEntry(const net::NetLog::Entry& entry);
93 net::NetLog::EventPhase phase, 89 void OnAddSocketEntry(const net::NetLog::Entry& entry);
94 net::NetLog::EventParameters* params);
95
96 void OnAddHTTPStreamJobEntry(net::NetLog::EventType type,
97 const base::TimeTicks& time,
98 const net::NetLog::Source& source,
99 net::NetLog::EventPhase phase,
100 net::NetLog::EventParameters* params);
101
102 void OnAddConnectJobEntry(net::NetLog::EventType type,
103 const base::TimeTicks& time,
104 const net::NetLog::Source& source,
105 net::NetLog::EventPhase phase,
106 net::NetLog::EventParameters* params);
107
108 void OnAddSocketEntry(net::NetLog::EventType type,
109 const base::TimeTicks& time,
110 const net::NetLog::Source& source,
111 net::NetLog::EventPhase phase,
112 net::NetLog::EventParameters* params);
113 90
114 URLRequestRecord* CreateURLRequestRecord(uint32 source_id); 91 URLRequestRecord* CreateURLRequestRecord(uint32 source_id);
115 void DeleteURLRequestRecord(uint32 source_id); 92 void DeleteURLRequestRecord(uint32 source_id);
116 93
94 // Returns current time. Virtual for unit tests.
95 virtual base::TimeTicks GetCurrentTime() const;
96
117 typedef base::hash_map<uint32, URLRequestRecord> URLRequestToRecordMap; 97 typedef base::hash_map<uint32, URLRequestRecord> URLRequestToRecordMap;
118 typedef base::hash_map<uint32, HTTPStreamJobRecord> HTTPStreamJobToRecordMap; 98 typedef base::hash_map<uint32, HTTPStreamJobRecord> HTTPStreamJobToRecordMap;
119 typedef base::hash_map<uint32, ConnectJobRecord> ConnectJobToRecordMap; 99 typedef base::hash_map<uint32, ConnectJobRecord> ConnectJobToRecordMap;
120 typedef base::hash_map<uint32, SocketRecord> SocketToRecordMap; 100 typedef base::hash_map<uint32, SocketRecord> SocketToRecordMap;
121 URLRequestToRecordMap url_request_to_record_; 101 URLRequestToRecordMap url_request_to_record_;
122 HTTPStreamJobToRecordMap http_stream_job_to_record_; 102 HTTPStreamJobToRecordMap http_stream_job_to_record_;
123 ConnectJobToRecordMap connect_job_to_record_; 103 ConnectJobToRecordMap connect_job_to_record_;
124 SocketToRecordMap socket_to_record_; 104 SocketToRecordMap socket_to_record_;
125 uint32 last_connect_job_id_; 105 uint32 last_connect_job_id_;
126 ConnectJobRecord last_connect_job_record_; 106 ConnectJobRecord last_connect_job_record_;
127 107
128 DISALLOW_COPY_AND_ASSIGN(LoadTimingObserver); 108 DISALLOW_COPY_AND_ASSIGN(LoadTimingObserver);
129 }; 109 };
130 110
131 #endif // CHROME_BROWSER_NET_LOAD_TIMING_OBSERVER_H_ 111 #endif // CHROME_BROWSER_NET_LOAD_TIMING_OBSERVER_H_
OLDNEW
« no previous file with comments | « chrome/browser/net/chrome_net_log_unittest.cc ('k') | chrome/browser/net/load_timing_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698