Chromium Code Reviews| Index: chrome/browser/net/load_timing_observer.cc |
| =================================================================== |
| --- chrome/browser/net/load_timing_observer.cc (revision 65207) |
| +++ chrome/browser/net/load_timing_observer.cc (working copy) |
| @@ -44,7 +44,7 @@ |
| (time_ticks - record->base_ticks).InMillisecondsRoundedUp()); |
| } |
| -} |
| +} // namespace |
| LoadTimingObserver::URLRequestRecord::URLRequestRecord() |
| : connect_job_id(net::NetLog::Source::kInvalidId), |
| @@ -60,25 +60,21 @@ |
| LoadTimingObserver::~LoadTimingObserver() { |
| } |
| -LoadTimingObserver::URLRequestRecord* |
| -LoadTimingObserver::GetURLRequestRecord(uint32 source_id) { |
| - URLRequestToRecordMap::iterator it = url_request_to_record_.find(source_id); |
| - if (it != url_request_to_record_.end()) |
| - return &it->second; |
| - return NULL; |
| -} |
| - |
| void LoadTimingObserver::OnAddEntry(net::NetLog::EventType type, |
| const base::TimeTicks& time, |
| const net::NetLog::Source& source, |
| net::NetLog::EventPhase phase, |
| net::NetLog::EventParameters* params) { |
| - if (source.type == net::NetLog::SOURCE_URL_REQUEST) |
| + if (source.type == net::NetLog::SOURCE_URL_REQUEST) { |
| + AutoLock lock(lock_); |
|
eroman
2010/11/16 17:51:14
I don't believe we need any locking in this class.
mmenke
2010/11/16 21:34:49
You're right, this is just me being paranoid about
|
| OnAddURLRequestEntry(type, time, source, phase, params); |
| - else if (source.type == net::NetLog::SOURCE_CONNECT_JOB) |
| + } else if (source.type == net::NetLog::SOURCE_CONNECT_JOB) { |
| + AutoLock lock(lock_); |
| OnAddConnectJobEntry(type, time, source, phase, params); |
| - else if (source.type == net::NetLog::SOURCE_SOCKET) |
| + } else if (source.type == net::NetLog::SOURCE_SOCKET) { |
| + AutoLock lock(lock_); |
| OnAddSocketEntry(type, time, source, phase, params); |
| + } |
| } |
| // static |
| @@ -94,6 +90,8 @@ |
| uint32 source_id = request->net_log().source().id; |
| LoadTimingObserver* observer = chrome_net_log->load_timing_observer(); |
| + |
| + AutoLock(observer->lock_); |
| LoadTimingObserver::URLRequestRecord* record = |
| observer->GetURLRequestRecord(source_id); |
| if (record) { |
| @@ -285,3 +283,11 @@ |
| it->second.ssl_end = time; |
| } |
| } |
| + |
| +LoadTimingObserver::URLRequestRecord* |
| +LoadTimingObserver::GetURLRequestRecord(uint32 source_id) { |
| + URLRequestToRecordMap::iterator it = url_request_to_record_.find(source_id); |
| + if (it != url_request_to_record_.end()) |
| + return &it->second; |
| + return NULL; |
| +} |