summaryrefslogtreecommitdiffstats
path: root/base/json/json_reader.cc
Commit message (Collapse)AuthorAgeFilesLines
* Clarify the interface of JSONStringValueSerializer::Deserialize which can ↵gab@chromium.org2013-11-211-0/+4
| | | | | | | | | | only return JSONParseError codes as an error_code. Also make sure JsonParseError codes do not go beyond JsonFileError codes which are used in conjunction for JSONFileValueSerializer. Review URL: https://codereview.chromium.org/71653002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236445 0039d316-1c4b-4281-b951-d872f2087c98
* Update JSONReader to take base::StringPiece instead of std::stringmitchellwrosen@chromium.org2012-06-021-3/+3
| | | | | | | | | | | | | I also went through the source tree and fixed any now-unnecessary conversions from base::StringPiece to std::string BUG=114785 TEST=Manual Review URL: https://chromiumcodereview.appspot.com/10003001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140177 0039d316-1c4b-4281-b951-d872f2087c98
* Rewrite base::JSONReader to be 35-40% faster, depending on the input string.rsesek@chromium.org2012-05-161-652/+28
| | | | | | | | | | | | | | | | This change does the following: * Parses the input string and generates the object representation in O(n) time. * Optimizes string decoding by using StringPiece where possible, which also introduces the JSON_DETACHABLE_CHILDREN parser option. * Makes JSONReader a simpler interface by hiding the parser details in an internal JSONParser class. BUG=49212,111581,121469 TEST=Hopefully covered by all test suites. New tests added for edge cases. Review URL: https://chromiumcodereview.appspot.com/10035042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137430 0039d316-1c4b-4281-b951-d872f2087c98
* Modify the base::JSONReader interface to take a set of options rather than a ↵rsesek@chromium.org2012-04-111-4/+10
| | | | | | | | | | | | | | boolean flag. This is just prep work for a large CL that rewrites the JSON parser. Splitting out this interface change will make it easier to review the other CL. BUG=121469 TEST=No functional change. Review URL: https://chromiumcodereview.appspot.com/9960077 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131680 0039d316-1c4b-4281-b951-d872f2087c98
* Fix some grammatical errors in base/gavinp@chromium.org2012-04-021-1/+1
| | | | | | | | | BUG=None Review URL: http://codereview.chromium.org/9854040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130117 0039d316-1c4b-4281-b951-d872f2087c98
* Fix handling of Unicode BOMs in JSONReader.rsesek@chromium.org2012-03-281-2/+3
| | | | | | | | | | | | | Because |char| is signed, the upper bits of the BOM bytes were getting interpreted as the sign bit. Cast to |uint8| to preserve them for proper comparison. BUG=119975 TEST=Try to install the Gmail extension. Do not get JSON error when unpacking. Review URL: http://codereview.chromium.org/9860035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129373 0039d316-1c4b-4281-b951-d872f2087c98
* Improve JSONReader performance by up to 55% by using std::string instead of ↵rsesek@chromium.org2012-03-241-47/+108
| | | | | | | | | | | | | | | | | | | | | | | | wstring. Before this change, JSONReader would: 1. Take std::string input 2. Convert it to wstring 3. Parse 4. Decode strings for the object representation, converting wstring to string16 5. Create a base::Value with a string16, which internally converts back to std::string After this change, JSONReader does: 1. Take std::string input 2. Parse 3. Create a base::Value with a std::string BUG=111581 TEST=Covered by unittests. Review URL: http://codereview.chromium.org/9801007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128678 0039d316-1c4b-4281-b951-d872f2087c98
* base/json: Collapse a condition in ReadHexDigits into a single if clause.tfarina@chromium.org2011-10-181-3/+1
| | | | | | | | | TEST=base_unittests --gtest_filter=JSON* R=tony@chromium.org Review URL: http://codereview.chromium.org/8312004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106096 0039d316-1c4b-4281-b951-d872f2087c98
* base/json: Use IsAsciiDigit in JSONReader::ReadInt() function.tfarina@chromium.org2011-10-141-2/+2
| | | | | | | | | | TEST=base_unittests --gtest_filter=JSON* R=tony@chromium.org Review URL: http://codereview.chromium.org/8276004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105586 0039d316-1c4b-4281-b951-d872f2087c98
* base/json: Make ReadHexDigits easier to read by using IsHexDigit() function.tfarina@chromium.org2011-09-061-3/+1
| | | | | | | | | | TEST=base_unittests --gtest_filter=JSON* R=tony@chromium.org Review URL: http://codereview.chromium.org/7833020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99774 0039d316-1c4b-4281-b951-d872f2087c98
* base/json: Get rid of static initializer in JSONReader.tfarina@chromium.org2011-09-011-23/+21
| | | | | | | | | | | | | | | Convert kInvalidToken to a static function in Token class called CreateInvalidToken(). This should get rid of the problem with the static initialization. BUG=94925 TEST=base_unittests --gtest_filter=JSON* R=tony@chromium.org Review URL: http://codereview.chromium.org/7756022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99200 0039d316-1c4b-4281-b951-d872f2087c98
* base/json: Don't use static variables of user-defined type (i.e, std::wstring).tfarina@chromium.org2011-08-191-18/+16
| | | | | | | | | | | | | Instead use plain wchar_t array. BUG=83856 TEST=None R=tony@chromium.org Review URL: http://codereview.chromium.org/7624057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97458 0039d316-1c4b-4281-b951-d872f2087c98
* iwyu: Include stringprintf.h where appropriate, part 1.jhawkins@chromium.org2011-05-101-2/+3
| | | | | | | | | | | BUG=82098 TEST=none R=thakis@chromium.org Review URL: http://codereview.chromium.org/6997006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84754 0039d316-1c4b-4281-b951-d872f2087c98
* Move some files from base to base/memory.levin@chromium.org2011-03-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | raw_scoped_refptr_mismatch_checker.h ref_counted.cc ref_counted.h ref_counted_memory.cc ref_counted_memory.h ref_counted_unittest.cc scoped_callback_factory.h scoped_comptr_win.h scoped_handle.h scoped_native_library.cc scoped_native_library.h scoped_native_library_unittest.cc scoped_nsobject.h scoped_open_process.h scoped_ptr.h scoped_ptr_unittest.cc scoped_temp_dir.cc scoped_temp_dir.h scoped_temp_dir_unittest.cc scoped_vector.h singleton.h singleton_objc.h singleton_unittest.cc linked_ptr.h linked_ptr_unittest.cc weak_ptr.cc weak_ptr.h weak_ptr_unittest.cc BUG=None TEST=Compile Review URL: http://codereview.chromium.org/6714032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79524 0039d316-1c4b-4281-b951-d872f2087c98
* Rename Real* to Double* in values.* and dependent filesarv@chromium.org2011-02-011-1/+1
| | | | | | | | | BUG=None TEST=Compiles and passes all tests Review URL: http://codereview.chromium.org/6248026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73232 0039d316-1c4b-4281-b951-d872f2087c98
* Order function definitions in base/ according to the header.erg@google.com2011-01-111-25/+25
| | | | | | | | | BUG=68682 TEST=compiles Review URL: http://codereview.chromium.org/6085015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70975 0039d316-1c4b-4281-b951-d872f2087c98
* Remove (deprecated) wstring version of Value::CreateStringValue().viettrungluu@chromium.org2010-08-151-1/+1
| | | | | | | | | BUG=23581 TEST=builds and passes tests Review URL: http://codereview.chromium.org/3136012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56170 0039d316-1c4b-4281-b951-d872f2087c98
* Remove deprecated wstring DictionaryValue::SetWithoutPathExpansion().viettrungluu@chromium.org2010-08-141-1/+1
| | | | | | | | | BUG=23581 TEST=builds and passes tests Review URL: http://codereview.chromium.org/3121017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56128 0039d316-1c4b-4281-b951-d872f2087c98
* base: Add HexDigitToInt function to string_util.htfarina@chromium.org2010-07-311-19/+7
| | | | | | | | | | | | | Removed duplicated HexToInt functions and converted the callers along the way. BUG=None TEST=trybots and out/Debug/base_unittests --gtest_filter=StringUtilTest.HexDigitToInt Signed-off-by: Thiago Farina <tfarina@chromium.org> Review URL: http://codereview.chromium.org/2836069 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54473 0039d316-1c4b-4281-b951-d872f2087c98
* Move the number conversions from string_util to a new file.brettw@chromium.org2010-07-301-2/+3
| | | | | | | | | | | | | Use the base namespace in the new file. Update callers. I removed all wstring variants and also the string->number ones that ignore the return value. That encourages people to write code and forget about error handling. TEST=included unit tests BUG=none Review URL: http://codereview.chromium.org/3056029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54355 0039d316-1c4b-4281-b951-d872f2087c98
* detect preferences errorserikkay@chromium.org2010-04-061-24/+65
| | | | | | | | | BUG=38352 TEST=none Review URL: http://codereview.chromium.org/1120006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43715 0039d316-1c4b-4281-b951-d872f2087c98
* Many changes to DictionaryValues:pkasting@chromium.org2009-11-251-1/+2
| | | | | | | | | | | | | | | | | * Add support for keys with "." in them via new XXXWithoutPathExpansion() APIs. * Use these APIs with all key iterator usage. * SetXXX() calls cannot fail, so change them from bool to void. * Change GetSize() to size() since it's cheap, and add empty(). Other: * Use standard for loop format in more places (e.g. instead of while loops when they're really doing a for loop). * Shorten a few bits of code. BUG=567 TEST=none Review URL: http://codereview.chromium.org/441008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33109 0039d316-1c4b-4281-b951-d872f2087c98
* Move the json-related files into a separate json directory. This hopefully alsobrettw@chromium.org2009-10-231-0/+642
makes the naming of string_escape more clear (it's actually JSON-specific). Move the files into the base namespace. TEST=none BUG=none Review URL: http://codereview.chromium.org/316016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29934 0039d316-1c4b-4281-b951-d872f2087c98