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

Side by Side Diff: chromecast/base/metrics/grouped_histogram.cc

Issue 2733283002: Require explicit selection of traits for LazyInstance (Closed)
Patch Set: l10n again Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromecast/base/metrics/grouped_histogram.h" 5 #include "chromecast/base/metrics/grouped_histogram.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 11 matching lines...) Expand all
22 namespace { 22 namespace {
23 23
24 const char kAppNameErrorNoApp[] = "ERROR_NO_APP_REGISTERED"; 24 const char kAppNameErrorNoApp[] = "ERROR_NO_APP_REGISTERED";
25 25
26 // Current app name guarded by lock. 26 // Current app name guarded by lock.
27 struct CurrentAppNameWithLock { 27 struct CurrentAppNameWithLock {
28 base::Lock lock; 28 base::Lock lock;
29 std::string app_name; 29 std::string app_name;
30 }; 30 };
31 31
32 base::LazyInstance<CurrentAppNameWithLock> g_current_app = 32 base::LazyInstance<CurrentAppNameWithLock>::DestructorAtExit g_current_app =
33 LAZY_INSTANCE_INITIALIZER; 33 LAZY_INSTANCE_INITIALIZER;
34 34
35 std::string GetAppName() { 35 std::string GetAppName() {
36 base::AutoLock lock(g_current_app.Get().lock); 36 base::AutoLock lock(g_current_app.Get().lock);
37 const std::string& app_name = g_current_app.Get().app_name; 37 const std::string& app_name = g_current_app.Get().app_name;
38 return app_name.empty() ? kAppNameErrorNoApp : app_name; 38 return app_name.empty() ? kAppNameErrorNoApp : app_name;
39 } 39 }
40 40
41 struct HistogramArgs { 41 struct HistogramArgs {
42 const char* name; 42 const char* name;
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 } 175 }
176 } 176 }
177 177
178 void TagAppStartForGroupedHistograms(const std::string& app_name) { 178 void TagAppStartForGroupedHistograms(const std::string& app_name) {
179 base::AutoLock lock(g_current_app.Get().lock); 179 base::AutoLock lock(g_current_app.Get().lock);
180 g_current_app.Get().app_name = app_name; 180 g_current_app.Get().app_name = app_name;
181 } 181 }
182 182
183 } // namespace metrics 183 } // namespace metrics
184 } // namespace chromecast 184 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/base/chromecast_config_android.cc ('k') | chromecast/common/media/cast_media_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698