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

Unified Diff: chrome/browser/rlz/rlz.cc

Issue 13868016: Detect when chrome is shutting down and don't SendFinacialPing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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
« chrome/browser/rlz/rlz.h ('K') | « chrome/browser/rlz/rlz.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/rlz/rlz.cc
diff --git a/chrome/browser/rlz/rlz.cc b/chrome/browser/rlz/rlz.cc
index 12a820b0621dcef63b9b83b040f494b893f66d80..1fbee413c441b3c864aead08294e9e298529de1a 100644
--- a/chrome/browser/rlz/rlz.cc
+++ b/chrome/browser/rlz/rlz.cc
@@ -58,6 +58,8 @@ using content::NavigationEntry;
namespace {
+bool chrome_is_exiting = false;
+
// Maximum and minimum delay for financial ping we would allow to be set through
// master preferences. Somewhat arbitrary, may need to be adjusted in future.
const base::TimeDelta kMaxInitDelay = base::TimeDelta::FromSeconds(200);
@@ -138,6 +140,11 @@ void RecordProductEvents(bool first_run,
bool SendFinancialPing(const std::string& brand,
const string16& lang,
const string16& referral) {
+ // It's possible for the user to close Chrome just before the time that this
+ // ping is due to go out. Detect that condition and abort.
+ if (chrome_is_exiting)
+ return false;
+
rlz_lib::AccessPoint points[] = {RLZTracker::CHROME_OMNIBOX,
RLZTracker::CHROME_HOME_PAGE,
rlz_lib::NO_ACCESS_POINT};
@@ -587,3 +594,8 @@ void RLZTracker::CleanupRlz() {
void RLZTracker::EnableZeroDelayForTesting() {
GetInstance()->min_init_delay_ = base::TimeDelta();
}
+
+// static
+void RLZTracker::PostMainMessageLoopRun() {
+ chrome_is_exiting = true;
Roger Tawa OOO till Jul 10th 2013/04/29 16:56:45 Instead of a new global variable, I think we shoul
bcwhite 2013/04/29 19:21:34 The financial_ping code uses this value without ch
+}
« chrome/browser/rlz/rlz.h ('K') | « chrome/browser/rlz/rlz.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698