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

Side by Side Diff: chrome/common/extensions/api/extension_api.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 "chrome/common/extensions/api/extension_api.h" 5 #include "chrome/common/extensions/api/extension_api.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 base::StringPiece ReadFromResource(int resource_id) { 63 base::StringPiece ReadFromResource(int resource_id) {
64 return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); 64 return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id);
65 } 65 }
66 66
67 scoped_ptr<ListValue> LoadSchemaList(const base::StringPiece& schema) { 67 scoped_ptr<ListValue> LoadSchemaList(const base::StringPiece& schema) {
68 std::string error_message; 68 std::string error_message;
69 scoped_ptr<Value> result( 69 scoped_ptr<Value> result(
70 base::JSONReader::ReadAndReturnError( 70 base::JSONReader::ReadAndReturnError(
71 schema.as_string(), 71 schema.as_string(),
72 base::JSON_PARSE_RFC, // options 72 base::JSON_PARSE_RFC | base::JSON_DETACHABLE_CHILDREN, // options
73 NULL, // error code 73 NULL, // error code
74 &error_message)); 74 &error_message));
75 CHECK(result.get()) << error_message; 75 CHECK(result.get()) << error_message;
76 CHECK(result->IsType(Value::TYPE_LIST)); 76 CHECK(result->IsType(Value::TYPE_LIST));
77 return scoped_ptr<ListValue>(static_cast<ListValue*>(result.release())); 77 return scoped_ptr<ListValue>(static_cast<ListValue*>(result.release()));
78 } 78 }
79 79
80 DictionaryValue* FindListItem(const ListValue* list, 80 DictionaryValue* FindListItem(const ListValue* list,
81 const std::string& property_name, 81 const std::string& property_name,
82 const std::string& property_value) { 82 const std::string& property_value) {
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 } 714 }
715 } 715 }
716 716
717 void ExtensionAPI::LoadAllSchemas() { 717 void ExtensionAPI::LoadAllSchemas() {
718 while (unloaded_schemas_.size()) { 718 while (unloaded_schemas_.size()) {
719 LoadSchema(unloaded_schemas_.begin()->second); 719 LoadSchema(unloaded_schemas_.begin()->second);
720 } 720 }
721 } 721 }
722 722
723 } // namespace extensions 723 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698