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

Side by Side Diff: net/test/base_test_server.cc

Issue 10035042: Rewrite base::JSONReader to be 35-40% faster, depending on the input string. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 8 years, 8 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) 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 "net/test/base_test_server.h" 5 #include "net/test/base_test_server.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 // This method shouldn't get called twice. 247 // This method shouldn't get called twice.
248 DCHECK(certificates_dir_.empty()); 248 DCHECK(certificates_dir_.empty());
249 document_root_ = document_root; 249 document_root_ = document_root;
250 certificates_dir_ = certificates_dir; 250 certificates_dir_ = certificates_dir;
251 DCHECK(!certificates_dir_.empty()); 251 DCHECK(!certificates_dir_.empty());
252 } 252 }
253 253
254 bool BaseTestServer::ParseServerData(const std::string& server_data) { 254 bool BaseTestServer::ParseServerData(const std::string& server_data) {
255 VLOG(1) << "Server data: " << server_data; 255 VLOG(1) << "Server data: " << server_data;
256 base::JSONReader json_reader; 256 base::JSONReader json_reader;
257 scoped_ptr<Value> value(json_reader.JsonToValue(server_data, true, false)); 257 scoped_ptr<Value> value(json_reader.ReadToValue(server_data));
258 if (!value.get() || !value->IsType(Value::TYPE_DICTIONARY)) { 258 if (!value.get() || !value->IsType(Value::TYPE_DICTIONARY)) {
259 LOG(ERROR) << "Could not parse server data: " 259 LOG(ERROR) << "Could not parse server data: "
260 << json_reader.GetErrorMessage(); 260 << json_reader.GetErrorMessage();
261 return false; 261 return false;
262 } 262 }
263 263
264 server_data_.reset(static_cast<DictionaryValue*>(value.release())); 264 server_data_.reset(static_cast<DictionaryValue*>(value.release()));
265 int port = 0; 265 int port = 0;
266 if (!server_data_->GetInteger("port", &port)) { 266 if (!server_data_->GetInteger("port", &port)) {
267 LOG(ERROR) << "Could not find port value"; 267 LOG(ERROR) << "Could not find port value";
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 GetCiphersList(https_options_.bulk_ciphers, bulk_cipher_values.get()); 373 GetCiphersList(https_options_.bulk_ciphers, bulk_cipher_values.get());
374 if (bulk_cipher_values->GetSize()) 374 if (bulk_cipher_values->GetSize())
375 arguments->Set("ssl-bulk-cipher", bulk_cipher_values.release()); 375 arguments->Set("ssl-bulk-cipher", bulk_cipher_values.release());
376 if (https_options_.record_resume) 376 if (https_options_.record_resume)
377 arguments->Set("https-record-resume", base::Value::CreateNullValue()); 377 arguments->Set("https-record-resume", base::Value::CreateNullValue());
378 } 378 }
379 return true; 379 return true;
380 } 380 }
381 381
382 } // namespace net 382 } // namespace net
OLDNEW
« base/json/json_parser_unittest.cc ('K') | « chrome/test/base/ui_test_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698