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

Unified Diff: chrome/browser/metrics/variations_service.cc

Issue 10828106: Support serial number requests in variations service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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/metrics/variations_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/variations_service.cc
===================================================================
--- chrome/browser/metrics/variations_service.cc (revision 148913)
+++ chrome/browser/metrics/variations_service.cc (working copy)
@@ -98,12 +98,15 @@
} // namespace
VariationsService::VariationsService()
- : variations_server_url_(GetVariationsServerURL()) {
+ : variations_server_url_(GetVariationsServerURL()),
+ create_trials_from_seed_called_(false) {
}
VariationsService::~VariationsService() {}
bool VariationsService::CreateTrialsFromSeed(PrefService* local_prefs) {
+ create_trials_from_seed_called_ = true;
+
TrialsSeed seed;
if (!LoadTrialsSeedFromPref(local_prefs, &seed))
return false;
@@ -132,6 +135,10 @@
void VariationsService::StartRepeatedVariationsSeedFetch() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ // Check that |CreateTrialsFromSeed| was called, which is necessary to
+ // retrieve the serial number that will be sent to the server.
+ DCHECK(create_trials_from_seed_called_);
+
// Perform the first fetch.
FetchVariationsSeed();
@@ -157,6 +164,9 @@
pending_seed_request_->SetRequestContext(
g_browser_process->system_request_context());
pending_seed_request_->SetMaxRetries(kMaxRetrySeedFetch);
+ if (!variations_serial_number_.empty())
+ pending_seed_request_->AddExtraRequestHeader("If-Match:" +
+ variations_serial_number_);
SteveT 2012/08/02 17:31:51 nit: This spans two lines, so I believe we want to
Alexei Svitkine (slow) 2012/08/02 18:37:51 Done.
pending_seed_request_->Start();
}
@@ -169,9 +179,10 @@
DVLOG(1) << "Variations server request failed.";
return;
}
+
if (request->GetResponseCode() != 200) {
DVLOG(1) << "Variations server request returned non-200 response code: "
- << request->GetResponseCode();
+ << request->GetResponseCode();
return;
}
@@ -214,6 +225,7 @@
local_prefs->SetString(prefs::kVariationsSeed, base64_seed_data);
local_prefs->SetInt64(prefs::kVariationsSeedDate,
seed_date.ToInternalValue());
+ variations_serial_number_ = seed.serial_number();
return true;
}
@@ -415,6 +427,7 @@
local_prefs->ClearPref(prefs::kVariationsSeed);
return false;
}
+ variations_serial_number_ = seed->serial_number();
return true;
}
« no previous file with comments | « chrome/browser/metrics/variations_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698