Index: base/prefs/pref_service.cc |
diff --git a/base/prefs/pref_service.cc b/base/prefs/pref_service.cc |
index a8e56d0b370680f9400e8432014d08b357fc4179..eaeb28b6b8c237f471d5229d7ee3715524ea7882 100644 |
--- a/base/prefs/pref_service.cc |
+++ b/base/prefs/pref_service.cc |
@@ -16,7 +16,6 @@ |
#include "base/prefs/pref_registry.h" |
#include "base/prefs/pref_value_store.h" |
#include "base/stl_util.h" |
-#include "base/strings/string_number_conversions.h" |
#include "base/strings/string_util.h" |
#include "base/value_conversions.h" |
#include "build/build_config.h" |
@@ -146,6 +145,36 @@ std::string PrefService::GetString(const char* path) const { |
return result; |
} |
+int64 PrefService::GetInt64(const char* path) const { |
+ DCHECK(CalledOnValidThread()); |
+ |
+ int64 result = 0; |
+ |
+ const base::Value* value = GetPreferenceValue(path); |
+ if (!value) { |
+ NOTREACHED() << "Trying to read an unregistered pref: " << path; |
+ return result; |
+ } |
+ bool rv = value->GetAsInt64(&result); |
+ DCHECK(rv); |
+ return result; |
+} |
+ |
+uint64 PrefService::GetUint64(const char* path) const { |
+ DCHECK(CalledOnValidThread()); |
+ |
+ uint64 result = 0; |
+ |
+ const base::Value* value = GetPreferenceValue(path); |
+ if (!value) { |
+ NOTREACHED() << "Trying to read an unregistered pref: " << path; |
+ return result; |
+ } |
+ bool rv = value->GetAsUint64(&result); |
+ DCHECK(rv); |
+ return result; |
+} |
+ |
base::FilePath PrefService::GetFilePath(const char* path) const { |
DCHECK(CalledOnValidThread()); |
@@ -353,50 +382,16 @@ void PrefService::SetString(const char* path, const std::string& value) { |
SetUserPrefValue(path, new base::StringValue(value)); |
} |
-void PrefService::SetFilePath(const char* path, const base::FilePath& value) { |
- SetUserPrefValue(path, base::CreateFilePathValue(value)); |
-} |
- |
void PrefService::SetInt64(const char* path, int64 value) { |
- SetUserPrefValue(path, new base::StringValue(base::Int64ToString(value))); |
-} |
- |
-int64 PrefService::GetInt64(const char* path) const { |
- DCHECK(CalledOnValidThread()); |
- |
- const base::Value* value = GetPreferenceValue(path); |
- if (!value) { |
- NOTREACHED() << "Trying to read an unregistered pref: " << path; |
- return 0; |
- } |
- std::string result("0"); |
- bool rv = value->GetAsString(&result); |
- DCHECK(rv); |
- |
- int64 val; |
- base::StringToInt64(result, &val); |
- return val; |
+ SetUserPrefValue(path, new base::StringValue(value)); |
} |
void PrefService::SetUint64(const char* path, uint64 value) { |
- SetUserPrefValue(path, new base::StringValue(base::Uint64ToString(value))); |
+ SetUserPrefValue(path, new base::StringValue(value)); |
} |
-uint64 PrefService::GetUint64(const char* path) const { |
- DCHECK(CalledOnValidThread()); |
- |
- const base::Value* value = GetPreferenceValue(path); |
- if (!value) { |
- NOTREACHED() << "Trying to read an unregistered pref: " << path; |
- return 0; |
- } |
- std::string result("0"); |
- bool rv = value->GetAsString(&result); |
- DCHECK(rv); |
- |
- uint64 val; |
- base::StringToUint64(result, &val); |
- return val; |
+void PrefService::SetFilePath(const char* path, const base::FilePath& value) { |
+ SetUserPrefValue(path, base::CreateFilePathValue(value)); |
} |
base::Value* PrefService::GetMutableUserPref(const char* path, |