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

Unified Diff: chrome/browser/google/google_update_settings_posix.cc

Issue 8573021: chrome: Remove 14 exit time destructors and 2 static initializers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Hopefully fix problems seen on the bots Created 9 years, 1 month 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/google/google_update_settings_posix.cc
diff --git a/chrome/browser/google/google_update_settings_posix.cc b/chrome/browser/google/google_update_settings_posix.cc
index 242407c8696d31a157652df9410f74beb1d5e657..7d2a8260c1e2628c2a6bd83c162a035a9b545058 100644
--- a/chrome/browser/google/google_update_settings_posix.cc
+++ b/chrome/browser/google/google_update_settings_posix.cc
@@ -10,9 +10,14 @@
#include "chrome/common/chrome_paths.h"
namespace google_update {
-std::string posix_guid;
+
+static std::string& posix_guid() {
joth 2011/11/18 01:16:37 nit: non-const reference not allowed in style guid
+ CR_DEFINE_STATIC_LOCAL(std::string, guid, ());
+ return guid;
}
+} // namespace google_update
+
// File name used in the user data dir to indicate consent.
static const char kConsentToSendStats[] = "Consent To Send Stats";
@@ -24,7 +29,7 @@ bool GoogleUpdateSettings::GetCollectStatsConsent() {
std::string tmp_guid;
bool consented = file_util::ReadFileToString(consent_file, &tmp_guid);
if (consented)
- google_update::posix_guid.assign(tmp_guid);
+ google_update::posix_guid().assign(tmp_guid);
return consented;
}
@@ -39,13 +44,13 @@ bool GoogleUpdateSettings::SetCollectStatsConsent(bool consented) {
if (consented) {
if ((!file_util::PathExists(consent_file)) ||
(file_util::PathExists(consent_file) &&
- !google_update::posix_guid.empty())) {
- const char* c_str = google_update::posix_guid.c_str();
- int size = google_update::posix_guid.size();
+ !google_update::posix_guid().empty())) {
+ const char* c_str = google_update::posix_guid().c_str();
+ int size = google_update::posix_guid().size();
return file_util::WriteFile(consent_file, c_str, size) == size;
}
} else {
- google_update::posix_guid.clear();
+ google_update::posix_guid().clear();
return file_util::Delete(consent_file, false);
}
return true;
@@ -60,7 +65,7 @@ bool GoogleUpdateSettings::SetMetricsId(const std::wstring& client_id) {
return false;
// Since user has consented, write the metrics id to the file.
- google_update::posix_guid = WideToASCII(client_id);
+ google_update::posix_guid() = WideToASCII(client_id);
return GoogleUpdateSettings::SetCollectStatsConsent(true);
}
« no previous file with comments | « chrome/browser/content_settings/tab_specific_content_settings.cc ('k') | chrome/browser/metrics/thread_watcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698