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

Unified Diff: chrome/browser/safe_browsing/protocol_manager.cc

Issue 165434: Merge 22814 - Fix for an "update in progress" DCHECK.... (Closed) Base URL: svn://chrome-svn/chrome/branches/195/src/
Patch Set: Created 11 years, 4 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
« no previous file with comments | « chrome/browser/safe_browsing/protocol_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/protocol_manager.cc
===================================================================
--- chrome/browser/safe_browsing/protocol_manager.cc (revision 23280)
+++ chrome/browser/safe_browsing/protocol_manager.cc (working copy)
@@ -28,6 +28,9 @@
// Maximum time, in seconds, from start up before we must issue an update query.
static const int kSbTimerStartIntervalSec = 5 * 60;
+// The maximum time, in seconds, to wait for a response to an update request.
+static const int kSbMaxUpdateWaitSec = 10;
+
// Update URL for querying about the latest set of chunk updates.
static const char* const kSbUpdateUrl =
"http://safebrowsing.clients.google.com/safebrowsing/downloads?client=%s"
@@ -235,9 +238,19 @@
hash_requests_.erase(it);
} else {
// Update, chunk or key response.
- DCHECK(source == request_.get());
fetcher.reset(request_.release());
+ if (request_type_ == UPDATE_REQUEST) {
+ if (!fetcher.get()) {
+ // We've timed out waiting for an update response, so we've cancelled
+ // the update request and scheduled a new one. Ignore this response.
+ return;
+ }
+
+ // Cancel the update response timeout now that we have the response.
+ update_timer_.Stop();
+ }
+
if (response_code == 200) {
// We have data from the SafeBrowsing service.
parsed_ok = HandleServiceResponse(source->url(),
@@ -524,6 +537,7 @@
if (database_error) {
ScheduleNextUpdate(false);
+ UpdateFinished(false);
return;
}
@@ -566,8 +580,21 @@
request_->set_request_context(Profile::GetDefaultRequestContext());
request_->set_upload_data("text/plain", list_data);
request_->Start();
+
+ // Begin the update request timeout.
+ update_timer_.Start(TimeDelta::FromSeconds(kSbMaxUpdateWaitSec), this,
+ &SafeBrowsingProtocolManager::UpdateResponseTimeout);
}
+// If we haven't heard back from the server with an update response, this method
+// will run. Close the current update session and schedule another update.
+void SafeBrowsingProtocolManager::UpdateResponseTimeout() {
+ DCHECK(request_type_ == UPDATE_REQUEST);
+ request_.reset();
+ ScheduleNextUpdate(false);
+ UpdateFinished(false);
+}
+
void SafeBrowsingProtocolManager::OnChunkInserted() {
chunk_pending_to_write_ = false;
Property changes on: chrome\browser\safe_browsing\protocol_manager.cc
___________________________________________________________________
Added: svn:mergeinfo
Merged /trunk/src/chrome/browser/safe_browsing/protocol_manager.cc:r22814
Merged /branches/chrome_webkit_merge_branch/chrome/browser/safe_browsing/protocol_manager.cc:r69-2775
« no previous file with comments | « chrome/browser/safe_browsing/protocol_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698