Chromium Code Reviews| Index: net/disk_cache/blockfile/histogram_macros_v3.h |
| diff --git a/net/disk_cache/blockfile/histogram_macros_v3.h b/net/disk_cache/blockfile/histogram_macros_v3.h |
| index e992a7c3f6950d6d8dfb82dfc39b2fa97e3371b3..5b23d420c2e5cda14b0955f71be9af057f04a4fc 100644 |
| --- a/net/disk_cache/blockfile/histogram_macros_v3.h |
| +++ b/net/disk_cache/blockfile/histogram_macros_v3.h |
| @@ -17,11 +17,14 @@ |
| // whenever the name changes (the experiment group changes), the histrogram |
| // object is re-created. |
| // Note: These macros are only run on one thread, so the declarations of |
|
gavinp
2014/03/17 15:06:28
Nit: I would just eliminate this entire comment he
|
| -// |counter| was made static (i.e., there will be no race for reinitialization). |
| +// |counter| could be static (since there will be no race for reinitialization), |
| +// but as they are used (with new names every time) in CACHE_UMA that |
| +// would not work and if CACHE_UMA is made to have one instance for every |
| +// cache, they will generate too much non-reusable machine code. |
| #define CACHE_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, bucket_count) \ |
| do { \ |
| - static base::HistogramBase* counter(NULL); \ |
| + base::HistogramBase* counter(NULL); \ |
| if (!counter || name != counter->histogram_name()) \ |
| counter = base::Histogram::FactoryGet( \ |
| name, min, max, bucket_count, \ |
| @@ -40,7 +43,7 @@ |
| #define CACHE_HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) \ |
| do { \ |
| - static base::HistogramBase* counter(NULL); \ |
| + base::HistogramBase* counter(NULL); \ |
| if (!counter || name != counter->histogram_name()) \ |
| counter = base::Histogram::FactoryTimeGet( \ |
| name, min, max, bucket_count, \ |
| @@ -53,7 +56,7 @@ |
| base::TimeDelta::FromSeconds(10), 50) |
| #define CACHE_HISTOGRAM_ENUMERATION(name, sample, boundary_value) do { \ |
| - static base::HistogramBase* counter(NULL); \ |
| + base::HistogramBase* counter(NULL); \ |
| if (!counter || name != counter->histogram_name()) \ |
| counter = base::LinearHistogram::FactoryGet( \ |
| name, 1, boundary_value, boundary_value + 1, \ |
| @@ -95,25 +98,7 @@ |
| #define CACHE_UMA(type, name, sample) {\ |
| const std::string my_name =\ |
| CACHE_UMA_BACKEND_IMPL_OBJ->HistogramName(name);\ |
| - switch (CACHE_UMA_BACKEND_IMPL_OBJ->cache_type()) {\ |
| - case net::DISK_CACHE:\ |
| - CACHE_HISTOGRAM_##type(my_name.data(), sample);\ |
| - break;\ |
| - case net::MEDIA_CACHE:\ |
| - CACHE_HISTOGRAM_##type(my_name.data(), sample);\ |
| - break;\ |
| - case net::APP_CACHE:\ |
| - CACHE_HISTOGRAM_##type(my_name.data(), sample);\ |
| - break;\ |
| - case net::SHADER_CACHE:\ |
| - CACHE_HISTOGRAM_##type(my_name.data(), sample);\ |
| - break;\ |
| - case net::PNACL_CACHE:\ |
| - CACHE_HISTOGRAM_##type(my_name.data(), sample);\ |
| - break;\ |
| - default:\ |
| - break;\ |
| - }\ |
| + CACHE_HISTOGRAM_##type(my_name.data(), sample);\ |
| } |
| #endif // NET_DISK_CACHE_BLOCKFILE_HISTOGRAM_MACROS_V3_H_ |