| OLD | NEW |
| 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 #include "content/browser/debugger/devtools_netlog_observer.h" | 5 #include "content/browser/debugger/devtools_netlog_observer.h" |
| 6 | 6 |
| 7 #include "base/string_tokenizer.h" | 7 #include "base/string_tokenizer.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 } | 39 } |
| 40 | 40 |
| 41 void DevToolsNetLogObserver::OnAddEntry(net::NetLog::EventType type, | 41 void DevToolsNetLogObserver::OnAddEntry(net::NetLog::EventType type, |
| 42 const base::TimeTicks& time, | 42 const base::TimeTicks& time, |
| 43 const net::NetLog::Source& source, | 43 const net::NetLog::Source& source, |
| 44 net::NetLog::EventPhase phase, | 44 net::NetLog::EventPhase phase, |
| 45 net::NetLog::EventParameters* params) { | 45 net::NetLog::EventParameters* params) { |
| 46 // The events that the Observer is interested in only occur on the IO thread. | 46 // The events that the Observer is interested in only occur on the IO thread. |
| 47 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) | 47 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) |
| 48 return; | 48 return; |
| 49 | |
| 50 // The events that the Observer is interested in only occur on the IO thread. | |
| 51 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) | |
| 52 return; | |
| 53 if (source.type == net::NetLog::SOURCE_URL_REQUEST) | 49 if (source.type == net::NetLog::SOURCE_URL_REQUEST) |
| 54 OnAddURLRequestEntry(type, time, source, phase, params); | 50 OnAddURLRequestEntry(type, time, source, phase, params); |
| 55 else if (source.type == net::NetLog::SOURCE_HTTP_STREAM_JOB) | 51 else if (source.type == net::NetLog::SOURCE_HTTP_STREAM_JOB) |
| 56 OnAddHTTPStreamJobEntry(type, time, source, phase, params); | 52 OnAddHTTPStreamJobEntry(type, time, source, phase, params); |
| 57 else if (source.type == net::NetLog::SOURCE_SOCKET) | 53 else if (source.type == net::NetLog::SOURCE_SOCKET) |
| 58 OnAddSocketEntry(type, time, source, phase, params); | 54 OnAddSocketEntry(type, time, source, phase, params); |
| 59 } | 55 } |
| 60 | 56 |
| 61 void DevToolsNetLogObserver::OnAddURLRequestEntry( | 57 void DevToolsNetLogObserver::OnAddURLRequestEntry( |
| 62 net::NetLog::EventType type, | 58 net::NetLog::EventType type, |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 | 287 |
| 292 RequestToEncodedDataLengthMap::iterator it = | 288 RequestToEncodedDataLengthMap::iterator it = |
| 293 dev_tools_net_log_observer->request_to_encoded_data_length_.find( | 289 dev_tools_net_log_observer->request_to_encoded_data_length_.find( |
| 294 source_id); | 290 source_id); |
| 295 if (it == dev_tools_net_log_observer->request_to_encoded_data_length_.end()) | 291 if (it == dev_tools_net_log_observer->request_to_encoded_data_length_.end()) |
| 296 return -1; | 292 return -1; |
| 297 int encoded_data_length = it->second; | 293 int encoded_data_length = it->second; |
| 298 it->second = 0; | 294 it->second = 0; |
| 299 return encoded_data_length; | 295 return encoded_data_length; |
| 300 } | 296 } |
| OLD | NEW |