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

Unified Diff: chrome/browser/autofill/autofill_download.h

Issue 6366014: Fix for: Autofill should not ping the server again for the same form... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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: chrome/browser/autofill/autofill_download.h
===================================================================
--- chrome/browser/autofill/autofill_download.h (revision 72523)
+++ chrome/browser/autofill/autofill_download.h (working copy)
@@ -6,8 +6,10 @@
#define CHROME_BROWSER_AUTOFILL_AUTOFILL_DOWNLOAD_H_
#pragma once
+#include <list>
#include <map>
#include <string>
+#include <vector>
#include "base/scoped_vector.h"
#include "base/time.h"
@@ -106,6 +108,25 @@
bool StartRequest(const std::string& form_xml,
const FormRequestData& request_data);
+ // Each request is page visited. We store last |number_of_forms_to_cache|
+ // request, to avoid going over the wire. Set to 16 in constructor. Warning:
+ // the search is linear (newest first), so do not make the constant very big.
+ void set_number_of_forms_to_cache(size_t number_of_forms_to_cache) {
+ number_of_forms_to_cache_ = number_of_forms_to_cache;
+ }
+
+ // Caches query request. |forms_in_query| is a vector of form signatures in
+ // the query. |query_data| is the successfull data returned over the wire.
+ void CacheQueryRequest(std::vector<std::string> const& forms_in_query,
dhollowa 2011/01/25 23:33:02 |const| in front of argument type please. And els
GeorgeY 2011/01/25 23:51:30 Done.
+ std::string const& query_data);
+ // Returns true if query is in the cache, while filling |query_data|, false
+ // otherwise. |forms_in_query| is a vector of form signatures in the query.
+ bool CheckCacheForQueryRequest(std::vector<std::string> const& forms_in_query,
+ std::string* query_data) const;
+ // Concatenates |forms_in_query| into one signature.
+ std::string GetCombinedSignature(
+ std::vector<std::string> const& forms_in_query) const;
+
// URLFetcher::Delegate implementation:
virtual void OnURLFetchComplete(const URLFetcher* source,
const GURL& url,
@@ -123,6 +144,10 @@
std::map<URLFetcher*, FormRequestData> url_fetchers_;
AutoFillDownloadManager::Observer *observer_;
+ // Cached QUERY requests.
+ std::list<std::pair<std::string, std::string> > cached_forms_;
dhollowa 2011/01/25 23:33:02 Add a typedef for the cache type. It'll make iter
GeorgeY 2011/01/25 23:51:30 Sure, but as this used only in these two functions
+ size_t number_of_forms_to_cache_;
dhollowa 2011/01/25 23:33:02 This seems a bit verbose. How about |form_cache_s
GeorgeY 2011/01/25 23:51:30 Done.
+
// Time when next query/upload requests are allowed. If 50x HTTP received,
// exponential back off is initiated, so this times will be in the future
// for awhile.
« no previous file with comments | « no previous file | chrome/browser/autofill/autofill_download.cc » ('j') | chrome/browser/autofill/autofill_download.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698