Index: chrome/browser/debugger/devtools_netlog_observer.cc |
=================================================================== |
--- chrome/browser/debugger/devtools_netlog_observer.cc (revision 65207) |
+++ chrome/browser/debugger/devtools_netlog_observer.cc (working copy) |
@@ -14,6 +14,22 @@ |
#include "net/url_request/url_request_netlog_params.h" |
#include "webkit/glue/resource_loader_bridge.h" |
+namespace { |
+ |
+void AddEntryOnIOThread( |
+ DevToolsNetLogObserver* observer, |
+ net::NetLog::EventType type, |
+ const base::TimeTicks& time, |
+ const net::NetLog::Source& source, |
+ net::NetLog::EventPhase phase, |
+ scoped_refptr<net::NetLog::EventParameters> params) { |
+ if (observer == DevToolsNetLogObserver::GetInstance()) { |
+ observer->OnAddEntry(type, time, source, phase, params.get()); |
+ } |
+} |
+ |
+} // namespace |
+ |
const size_t kMaxNumEntries = 1000; |
DevToolsNetLogObserver* DevToolsNetLogObserver::instance_ = NULL; |
@@ -41,6 +57,16 @@ |
const net::NetLog::Source& source, |
net::NetLog::EventPhase phase, |
net::NetLog::EventParameters* params) { |
+ if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
+ BrowserThread::PostTask(BrowserThread::IO, |
eroman
2010/11/16 17:51:14
Can we instead just return immediately if we aren'
mmenke
2010/11/16 21:34:49
I'm not quite sure, actually. Do we care about th
|
+ FROM_HERE, |
+ NewRunnableFunction( |
+ AddEntryOnIOThread, |
+ this, type, time, source, phase, |
+ make_scoped_refptr(params))); |
+ return; |
+ } |
+ |
if (type == net::NetLog::TYPE_URL_REQUEST_START_JOB) { |
if (phase != net::NetLog::PHASE_BEGIN) |
return; |
@@ -100,7 +126,7 @@ |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
DCHECK(!instance_); |
- instance_ = new DevToolsNetLogObserver(io_thread->globals()->net_log.get()); |
+ instance_ = new DevToolsNetLogObserver(io_thread->net_log()); |
} |
void DevToolsNetLogObserver::Detach() { |