Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(539)

Side by Side Diff: content/browser/debugger/devtools_netlog_observer.cc

Issue 7661009: base: Add Is* functions to Value class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tony review Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/test/webdriver/webdriver_session.cc ('k') | content/browser/geolocation/network_location_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698