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

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: 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
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 std::string& name, 67 scoped_ptr<ListValue> LoadSchemaList(const std::string& name,
68 const base::StringPiece& schema) { 68 const base::StringPiece& schema) {
69 std::string error_message; 69 std::string error_message;
70 scoped_ptr<Value> result( 70 scoped_ptr<Value> result(
71 base::JSONReader::ReadAndReturnError( 71 base::JSONReader::ReadAndReturnError(
72 schema.as_string(), 72 schema.as_string(),
73 base::JSON_PARSE_RFC, // options 73 base::JSON_PARSE_RFC | base::JSON_DETACHABLE_CHILDREN, // options
74 NULL, // error code 74 NULL, // error code
75 &error_message)); 75 &error_message));
76 76
77 // Tracking down http://crbug.com/121424 77 // Tracking down http://crbug.com/121424
78 char buf[128]; 78 char buf[128];
79 base::snprintf(buf, arraysize(buf), "%s: (%d) '%s'", 79 base::snprintf(buf, arraysize(buf), "%s: (%d) '%s'",
80 name.c_str(), 80 name.c_str(),
81 result.get() ? result->GetType() : -1, 81 result.get() ? result->GetType() : -1,
82 error_message.c_str()); 82 error_message.c_str());
83 83
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 797
798 void ExtensionAPI::LoadAllSchemas() { 798 void ExtensionAPI::LoadAllSchemas() {
799 while (unloaded_schemas_.size()) { 799 while (unloaded_schemas_.size()) {
800 std::map<std::string, base::StringPiece>::iterator it = 800 std::map<std::string, base::StringPiece>::iterator it =
801 unloaded_schemas_.begin(); 801 unloaded_schemas_.begin();
802 LoadSchema(it->first, it->second); 802 LoadSchema(it->first, it->second);
803 } 803 }
804 } 804 }
805 805
806 } // namespace extensions 806 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.cc ('k') | chrome/common/extensions/extension_l10n_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698