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

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: Really fix Windows, address comments Created 8 years, 7 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
« no previous file with comments | « chrome/test/base/ui_test_utils.cc ('k') | net/test/spawner_communicator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // This method shouldn't get called twice. 249 // This method shouldn't get called twice.
250 DCHECK(certificates_dir_.empty()); 250 DCHECK(certificates_dir_.empty());
251 document_root_ = document_root; 251 document_root_ = document_root;
252 certificates_dir_ = certificates_dir; 252 certificates_dir_ = certificates_dir;
253 DCHECK(!certificates_dir_.empty()); 253 DCHECK(!certificates_dir_.empty());
254 } 254 }
255 255
256 bool BaseTestServer::ParseServerData(const std::string& server_data) { 256 bool BaseTestServer::ParseServerData(const std::string& server_data) {
257 VLOG(1) << "Server data: " << server_data; 257 VLOG(1) << "Server data: " << server_data;
258 base::JSONReader json_reader; 258 base::JSONReader json_reader;
259 scoped_ptr<Value> value(json_reader.JsonToValue(server_data, true, false)); 259 scoped_ptr<Value> value(json_reader.ReadToValue(server_data));
260 if (!value.get() || !value->IsType(Value::TYPE_DICTIONARY)) { 260 if (!value.get() || !value->IsType(Value::TYPE_DICTIONARY)) {
261 LOG(ERROR) << "Could not parse server data: " 261 LOG(ERROR) << "Could not parse server data: "
262 << json_reader.GetErrorMessage(); 262 << json_reader.GetErrorMessage();
263 return false; 263 return false;
264 } 264 }
265 265
266 server_data_.reset(static_cast<DictionaryValue*>(value.release())); 266 server_data_.reset(static_cast<DictionaryValue*>(value.release()));
267 int port = 0; 267 int port = 0;
268 if (!server_data_->GetInteger("port", &port)) { 268 if (!server_data_->GetInteger("port", &port)) {
269 LOG(ERROR) << "Could not find port value"; 269 LOG(ERROR) << "Could not find port value";
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 arguments->Set("ssl-bulk-cipher", bulk_cipher_values.release()); 377 arguments->Set("ssl-bulk-cipher", bulk_cipher_values.release());
378 if (https_options_.record_resume) 378 if (https_options_.record_resume)
379 arguments->Set("https-record-resume", base::Value::CreateNullValue()); 379 arguments->Set("https-record-resume", base::Value::CreateNullValue());
380 if (https_options_.tls_intolerant) 380 if (https_options_.tls_intolerant)
381 arguments->Set("tls-intolerant", base::Value::CreateNullValue()); 381 arguments->Set("tls-intolerant", base::Value::CreateNullValue());
382 } 382 }
383 return true; 383 return true;
384 } 384 }
385 385
386 } // namespace net 386 } // namespace net
OLDNEW
« no previous file with comments | « chrome/test/base/ui_test_utils.cc ('k') | net/test/spawner_communicator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698