Chromium Code Reviews| Index: chrome/browser/api/webdata/web_data_results.h |
| diff --git a/chrome/browser/api/webdata/web_data_results.h b/chrome/browser/api/webdata/web_data_results.h |
| index 7924e3f53f0f76fc91a2690654e452dc9f458b0d..45579f5aff9095ce5a95aabf1542dbd843d126a4 100644 |
| --- a/chrome/browser/api/webdata/web_data_results.h |
| +++ b/chrome/browser/api/webdata/web_data_results.h |
| @@ -40,27 +40,24 @@ typedef base::Callback<void(const WDTypedResult*)> DestroyCallback; |
| // |
| class WDTypedResult { |
| public: |
| - virtual ~WDTypedResult(); |
| + virtual ~WDTypedResult() { |
| + } |
| // Return the result type. |
| WDResultType GetType() const { |
| return type_; |
| } |
| - void Destroy() const { |
| - if (!callback_.is_null()) { |
| - callback_.Run(this); |
| - } |
| + virtual void Destroy() { |
| } |
| protected: |
| - explicit WDTypedResult(WDResultType type); |
| - |
| - WDTypedResult(WDResultType type, const DestroyCallback& callback); |
| + explicit WDTypedResult(WDResultType type) |
| + : type_(type) { |
| + } |
| private: |
| WDResultType type_; |
| - DestroyCallback callback_; |
| DISALLOW_COPY_AND_ASSIGN(WDTypedResult); |
| }; |
| @@ -71,10 +68,6 @@ template <class T> class WDResult : public WDTypedResult { |
| : WDTypedResult(type), value_(v) { |
| } |
| - WDResult(WDResultType type, const DestroyCallback& callback, const T& v) |
| - : WDTypedResult(type, callback), value_(v) { |
| - } |
| - |
| virtual ~WDResult() { |
| } |
| @@ -89,16 +82,41 @@ template <class T> class WDResult : public WDTypedResult { |
| DISALLOW_COPY_AND_ASSIGN(WDResult); |
| }; |
| +template <class T> class WDDestroyableResult : public WDTypedResult { |
| + public: |
| + WDDestroyableResult(WDResultType type, const T& v, |
| + const DestroyCallback& callback) |
|
erikwright (departed)
2013/01/28 20:01:05
indentation.
Cait (Slow)
2013/01/29 01:10:29
Done.
|
| + : WDTypedResult(type), value_(v), callback_(callback) { |
| + } |
| + |
| + virtual ~WDDestroyableResult() { |
| + } |
| + |
| + |
| + virtual void Destroy() OVERRIDE { |
| + if (!callback_.is_null()) { |
| + callback_.Run(this); |
| + } |
| + } |
| + |
| + // Return a single value result. |
| + T GetValue() const { |
| + return value_; |
| + } |
| + |
| + private: |
| + T value_; |
| + DestroyCallback callback_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(WDDestroyableResult); |
| +}; |
| + |
| template <class T> class WDObjectResult : public WDTypedResult { |
| public: |
| explicit WDObjectResult(WDResultType type) |
| : WDTypedResult(type) { |
| } |
| - WDObjectResult(WDResultType type, const DestroyCallback& callback) |
| - : WDTypedResult(type, callback) { |
| - } |
| - |
| T* GetValue() const { |
| return &value_; |
| } |