diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-21 01:46:44 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-21 01:46:44 +0000 |
commit | f597a330e1c21b0bdfdc516e5d766a367ab96d64 (patch) | |
tree | d5dffda9565e545efba396fda7b0b2b12d26e727 /third_party | |
parent | 4e36ab8517b625ebd3cd19af8cecfa11a394f173 (diff) | |
download | chromium_src-f597a330e1c21b0bdfdc516e5d766a367ab96d64.zip chromium_src-f597a330e1c21b0bdfdc516e5d766a367ab96d64.tar.gz chromium_src-f597a330e1c21b0bdfdc516e5d766a367ab96d64.tar.bz2 |
libaddressinput: convert json::Build to scoped_ptr
BUG=none
Review URL: https://codereview.chromium.org/104923013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242242 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
4 files changed, 14 insertions, 8 deletions
diff --git a/third_party/libaddressinput/chromium/cpp/src/util/json.cc b/third_party/libaddressinput/chromium/cpp/src/util/json.cc index 30daffc..871bae2 100644 --- a/third_party/libaddressinput/chromium/cpp/src/util/json.cc +++ b/third_party/libaddressinput/chromium/cpp/src/util/json.cc @@ -71,8 +71,8 @@ class Rapidjson : public Json { Json::~Json() {} // static -Json* Json::Build() { - return new Rapidjson; +scoped_ptr<Json> Json::Build() { + return scoped_ptr<Json>(new Rapidjson); } Json::Json() {} diff --git a/third_party/libaddressinput/chromium/cpp/src/util/json.h b/third_party/libaddressinput/chromium/cpp/src/util/json.h index 98a3b94..772dce4 100644 --- a/third_party/libaddressinput/chromium/cpp/src/util/json.h +++ b/third_party/libaddressinput/chromium/cpp/src/util/json.h @@ -15,6 +15,8 @@ #ifndef I18N_ADDRESSINPUT_UTIL_JSON_H_ #define I18N_ADDRESSINPUT_UTIL_JSON_H_ +#include <libaddressinput/util/scoped_ptr.h> + #include <string> namespace i18n { @@ -30,8 +32,8 @@ class Json { public: virtual ~Json(); - // Returns a new instanec of |Json| object. The caller owns the result. - static Json* Build(); + // Returns a new instance of |Json| object. + static scoped_ptr<Json> Build(); // Parses the |json| string and returns true if |json| is valid and it is an // object. diff --git a/third_party/libaddressinput/chromium/cpp/test/util/json_test.cc b/third_party/libaddressinput/chromium/cpp/test/util/json_test.cc index bd2776a..756149f 100644 --- a/third_party/libaddressinput/chromium/cpp/test/util/json_test.cc +++ b/third_party/libaddressinput/chromium/cpp/test/util/json_test.cc @@ -20,9 +20,10 @@ #include <gtest/gtest.h> -namespace { +namespace i18n { +namespace addressinput { -using i18n::addressinput::Json; +namespace { // Tests for Json object. class JsonTest : public testing::Test { @@ -109,3 +110,6 @@ TEST_F(JsonTest, NumberIsNotValid) { } } // namespace + +} // namespace addressinput +} // namespace i18n diff --git a/third_party/libaddressinput/chromium/json.cc b/third_party/libaddressinput/chromium/json.cc index 096f9ae..6723846 100644 --- a/third_party/libaddressinput/chromium/json.cc +++ b/third_party/libaddressinput/chromium/json.cc @@ -56,8 +56,8 @@ class ChromeJson : public Json { Json::~Json() {} // static -Json* Json::Build() { - return new ChromeJson; +scoped_ptr<Json> Json::Build() { + return scoped_ptr<Json>(new ChromeJson); } Json::Json() {} |