| Index: components/webdata/common/web_data_results.h
|
| diff --git a/components/webdata/common/web_data_results.h b/components/webdata/common/web_data_results.h
|
| index 8f04c7f0cd0e890bc3d103de65e242f178fc6a98..b6d01461769c58050090bec5cd5e91876f7527f9 100644
|
| --- a/components/webdata/common/web_data_results.h
|
| +++ b/components/webdata/common/web_data_results.h
|
| @@ -17,6 +17,7 @@ class WDTypedResult;
|
| //
|
| // Result types for WebDataService.
|
| //
|
| +// clang-format off
|
| typedef enum {
|
| BOOL_RESULT = 1, // WDResult<bool>
|
| KEYWORDS_RESULT, // WDResult<WDKeywordsResult>
|
| @@ -29,13 +30,13 @@ typedef enum {
|
| AUTOFILL_VALUE_RESULT, // WDResult<std::vector<base::string16>>
|
| AUTOFILL_CHANGES, // WDResult<std::vector<AutofillChange>>
|
| AUTOFILL_PROFILE_RESULT, // WDResult<AutofillProfile>
|
| - AUTOFILL_PROFILES_RESULT, // WDResult<std::vector<AutofillProfile*>>
|
| + AUTOFILL_PROFILES_RESULT, // WDResult<std::vector<
|
| + // std::unique_ptr<AutofillProfile>>>
|
| AUTOFILL_CREDITCARD_RESULT, // WDResult<CreditCard>
|
| - AUTOFILL_CREDITCARDS_RESULT, // WDResult<std::vector<CreditCard*>>
|
| + AUTOFILL_CREDITCARDS_RESULT, // WDResult<std::vector<
|
| + // std::unique_ptr<CreditCard>>>
|
| } WDResultType;
|
| -
|
| -
|
| -typedef base::Callback<void(const WDTypedResult*)> DestroyCallback;
|
| +// clang-format on
|
|
|
| //
|
| // The top level class for a result.
|
| @@ -50,9 +51,6 @@ class WEBDATA_EXPORT WDTypedResult {
|
| return type_;
|
| }
|
|
|
| - virtual void Destroy() {
|
| - }
|
| -
|
| protected:
|
| explicit WDTypedResult(WDResultType type)
|
| : type_(type) {
|
| @@ -66,17 +64,15 @@ class WEBDATA_EXPORT WDTypedResult {
|
| // A result containing one specific pointer or literal value.
|
| template <class T> class WDResult : public WDTypedResult {
|
| public:
|
| - WDResult(WDResultType type, const T& v)
|
| - : WDTypedResult(type), value_(v) {
|
| - }
|
| + WDResult(WDResultType type, const T& v) : WDTypedResult(type), value_(v) {}
|
| + WDResult(WDResultType type, T&& v)
|
| + : WDTypedResult(type), value_(std::move(v)) {}
|
|
|
| - ~WDResult() override {
|
| - }
|
| + ~WDResult() override {}
|
|
|
| // Return a single value result.
|
| - T GetValue() const {
|
| - return value_;
|
| - }
|
| + const T& GetValue() const { return value_; }
|
| + T& GetValue() { return value_; }
|
|
|
| private:
|
| T value_;
|
| @@ -84,29 +80,4 @@ template <class T> class WDResult : public WDTypedResult {
|
| DISALLOW_COPY_AND_ASSIGN(WDResult);
|
| };
|
|
|
| -template <class T> class WDDestroyableResult : public WDResult<T> {
|
| - public:
|
| - WDDestroyableResult(
|
| - WDResultType type,
|
| - const T& v,
|
| - const DestroyCallback& callback)
|
| - : WDResult<T>(type, v),
|
| - callback_(callback) {
|
| - }
|
| -
|
| - ~WDDestroyableResult() override {
|
| - }
|
| -
|
| - void Destroy() override {
|
| - if (!callback_.is_null()) {
|
| - callback_.Run(this);
|
| - }
|
| - }
|
| -
|
| - private:
|
| - DestroyCallback callback_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(WDDestroyableResult);
|
| -};
|
| -
|
| #endif // COMPONENTS_WEBDATA_COMMON_WEB_DATA_RESULTS_H_
|
|
|