| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/browser_thread.h" | 10 #include "content/browser/browser_thread.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 } | 218 } |
| 219 | 219 |
| 220 RequestToEncodedDataLengthMap::iterator encoded_data_length_it = | 220 RequestToEncodedDataLengthMap::iterator encoded_data_length_it = |
| 221 request_to_encoded_data_length_.find(request_id); | 221 request_to_encoded_data_length_.find(request_id); |
| 222 if (encoded_data_length_it == request_to_encoded_data_length_.end()) | 222 if (encoded_data_length_it == request_to_encoded_data_length_.end()) |
| 223 return; | 223 return; |
| 224 | 224 |
| 225 if (net::NetLog::TYPE_SOCKET_BYTES_RECEIVED == type) { | 225 if (net::NetLog::TYPE_SOCKET_BYTES_RECEIVED == type) { |
| 226 int byte_count = 0; | 226 int byte_count = 0; |
| 227 scoped_ptr<Value> value(params->ToValue()); | 227 scoped_ptr<Value> value(params->ToValue()); |
| 228 if (!value->IsType(Value::TYPE_DICTIONARY)) | 228 if (!value->IsDictionary()) |
| 229 return; | 229 return; |
| 230 | 230 |
| 231 DictionaryValue* dValue = static_cast<DictionaryValue*>(value.get()); | 231 DictionaryValue* dValue = static_cast<DictionaryValue*>(value.get()); |
| 232 if (!dValue->GetInteger("byte_count", &byte_count)) | 232 if (!dValue->GetInteger("byte_count", &byte_count)) |
| 233 return; | 233 return; |
| 234 | 234 |
| 235 encoded_data_length_it->second += byte_count; | 235 encoded_data_length_it->second += byte_count; |
| 236 } | 236 } |
| 237 } | 237 } |
| 238 | 238 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 | 286 |
| 287 RequestToEncodedDataLengthMap::iterator it = | 287 RequestToEncodedDataLengthMap::iterator it = |
| 288 dev_tools_net_log_observer->request_to_encoded_data_length_.find( | 288 dev_tools_net_log_observer->request_to_encoded_data_length_.find( |
| 289 source_id); | 289 source_id); |
| 290 if (it == dev_tools_net_log_observer->request_to_encoded_data_length_.end()) | 290 if (it == dev_tools_net_log_observer->request_to_encoded_data_length_.end()) |
| 291 return -1; | 291 return -1; |
| 292 int encoded_data_length = it->second; | 292 int encoded_data_length = it->second; |
| 293 it->second = 0; | 293 it->second = 0; |
| 294 return encoded_data_length; | 294 return encoded_data_length; |
| 295 } | 295 } |
| OLD | NEW |