Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Unified Diff: third_party/libaddressinput/chromium/cpp/src/retriever.h

Issue 144353002: [rac] Use stale libaddressinput data if download fails (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: No else after return Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/libaddressinput/chromium/cpp/src/retriever.h
diff --git a/third_party/libaddressinput/chromium/cpp/src/retriever.h b/third_party/libaddressinput/chromium/cpp/src/retriever.h
index d30a76b5cf1c6dc104b335c41245720a21f4972b..4413f05f5979c5172ea9704020ff2d3f534bd38e 100644
--- a/third_party/libaddressinput/chromium/cpp/src/retriever.h
+++ b/third_party/libaddressinput/chromium/cpp/src/retriever.h
@@ -80,16 +80,23 @@ class Retriever {
// to the constructor.
bool IsValidationDataUrl(const std::string& url) const;
- // Looks up the callback for |key| in |requests_|, removes it from the map
- // and returns it. Assumes that |key| is in fact in |requests_|.
- scoped_ptr<Callback> GetCallbackForKey(const std::string& key);
+ // Looks up the callback for |key| in |requests_|, removes it from the map and
+ // invokes it with |key|, |success|, and |data| parameters.
+ void InvokeCallbackForKey(const std::string& key,
+ bool success,
+ const std::string& data);
const std::string validation_data_url_;
scoped_ptr<Downloader> downloader_;
scoped_ptr<Storage> storage_;
+
// Holds pending requests. The callback pointers are owned.
std::map<std::string, Callback*> requests_;
+ // Holds data from storage that has expired timestamps. If a download fails,
+ // then this data is used as fallback.
+ std::map<std::string, std::string> stale_data_;
+
DISALLOW_COPY_AND_ASSIGN(Retriever);
};

Powered by Google App Engine
This is Rietveld 408576698