| Index: chrome/browser/net/load_timing_observer.cc
|
| ===================================================================
|
| --- chrome/browser/net/load_timing_observer.cc (revision 66783)
|
| +++ 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),
|
| @@ -53,7 +53,7 @@
|
| }
|
|
|
| LoadTimingObserver::LoadTimingObserver()
|
| - : Observer(net::NetLog::LOG_BASIC),
|
| + : ThreadSafeObserver(net::NetLog::LOG_BASIC),
|
| last_connect_job_id_(net::NetLog::Source::kInvalidId) {
|
| }
|
|
|
| @@ -62,6 +62,8 @@
|
|
|
| LoadTimingObserver::URLRequestRecord*
|
| LoadTimingObserver::GetURLRequestRecord(uint32 source_id) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| +
|
| URLRequestToRecordMap::iterator it = url_request_to_record_.find(source_id);
|
| if (it != url_request_to_record_.end())
|
| return &it->second;
|
| @@ -73,6 +75,9 @@
|
| const net::NetLog::Source& source,
|
| net::NetLog::EventPhase phase,
|
| net::NetLog::EventParameters* params) {
|
| + // The events that the Observer is interested in only occur on the IO thread.
|
| + if (!BrowserThread::CurrentlyOn(BrowserThread::IO))
|
| + return;
|
| if (source.type == net::NetLog::SOURCE_URL_REQUEST)
|
| OnAddURLRequestEntry(type, time, source, phase, params);
|
| else if (source.type == net::NetLog::SOURCE_CONNECT_JOB)
|
| @@ -84,6 +89,7 @@
|
| // static
|
| void LoadTimingObserver::PopulateTimingInfo(URLRequest* request,
|
| ResourceResponse* response) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| if (!(request->load_flags() & net::LOAD_ENABLE_LOAD_TIMING))
|
| return;
|
|
|
| @@ -109,6 +115,8 @@
|
| const net::NetLog::Source& source,
|
| net::NetLog::EventPhase phase,
|
| net::NetLog::EventParameters* params) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| +
|
| bool is_begin = phase == net::NetLog::PHASE_BEGIN;
|
| bool is_end = phase == net::NetLog::PHASE_END;
|
|
|
| @@ -210,6 +218,8 @@
|
| const net::NetLog::Source& source,
|
| net::NetLog::EventPhase phase,
|
| net::NetLog::EventParameters* params) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| +
|
| bool is_begin = phase == net::NetLog::PHASE_BEGIN;
|
| bool is_end = phase == net::NetLog::PHASE_END;
|
|
|
| @@ -253,6 +263,8 @@
|
| const net::NetLog::Source& source,
|
| net::NetLog::EventPhase phase,
|
| net::NetLog::EventParameters* params) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| +
|
| bool is_begin = phase == net::NetLog::PHASE_BEGIN;
|
| bool is_end = phase == net::NetLog::PHASE_END;
|
|
|
|
|