summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryongsheng.zhu@intel.com <yongsheng.zhu@intel.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-23 03:42:38 +0000
committeryongsheng.zhu@intel.com <yongsheng.zhu@intel.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-23 03:42:38 +0000
commit72059f1c9374518d2894e9efc2f0da7e66438b19 (patch)
tree48c377accc0dbc49d3cd55bf1a0c7a15e57277f8
parent6f087ad8c60823e0b79005e8cdc84ae8d2b70b27 (diff)
downloadchromium_src-72059f1c9374518d2894e9efc2f0da7e66438b19.zip
chromium_src-72059f1c9374518d2894e9efc2f0da7e66438b19.tar.gz
chromium_src-72059f1c9374518d2894e9efc2f0da7e66438b19.tar.bz2
Fix the failed case ValueStoreTest.DotsInKeyNamesWithDicts for Android
Json parser uses a stack-based input copy string and the parsed result 'Value' references the internal pointer of the input copy string. To make the references valid, 'Value' has one member std::string to swap its content with the input copy string. On other platforms, the member std::string can get the internal pointer of the input copy string. However, on Android, std::string just swaps the content of two strings instead of swapping their internal pointers. This makes the pointer reference of value invalid. Fix this by forcing options |= JSON_DETACHABLE_CHILDREN for Android so disable this optimization. BUG=139434 TEST=run_tests.py -s unit_tests Review URL: https://chromiumcodereview.appspot.com/10831322 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152944 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/json/json_parser.cc5
-rw-r--r--build/android/gtest_filter/unit_tests_disabled3
2 files changed, 4 insertions, 4 deletions
diff --git a/base/json/json_parser.cc b/base/json/json_parser.cc
index 0cb59ee..00a6a63 100644
--- a/base/json/json_parser.cc
+++ b/base/json/json_parser.cc
@@ -208,7 +208,10 @@ JSONParser::~JSONParser() {
Value* JSONParser::Parse(const StringPiece& input) {
// TODO(rsesek): Windows has problems with StringPiece/hidden roots. Fix
// <http://crbug.com/126107> when my Windows box arrives.
-#if defined(OS_WIN)
+ // For Android, swapping string doesn't mean swapping internal pointers
+ // but swapping contents. Since it can't provide the performance gain,
+ // set the below flag to disable the optimization and make it work.
+#if defined(OS_WIN) || defined(OS_ANDROID)
options_ |= JSON_DETACHABLE_CHILDREN;
#endif
diff --git a/build/android/gtest_filter/unit_tests_disabled b/build/android/gtest_filter/unit_tests_disabled
index 189d54a..3d18c4d 100644
--- a/build/android/gtest_filter/unit_tests_disabled
+++ b/build/android/gtest_filter/unit_tests_disabled
@@ -43,9 +43,6 @@ CreditCardTest.SetInfoExpirationMonth
# crbug.com/139398
DownloadItemModelTest.InterruptTooltip
-# crbug.com/139434
-LeveldbValueStore/ValueStoreTest.DotsInKeyNamesWithDicts/0
-
# Tests crashing in the APK
# DEATH test, forking and doing bad stuff, not supported yet.
IncognitoModePrefsDeathTest.GetAvailabilityBadValue