OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/metrics/variations/variations_http_header_provider.h" | 5 #include "chrome/browser/metrics/variations/variations_http_header_provider.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "chrome/browser/google/google_util.h" | 10 #include "chrome/browser/google/google_util.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 UpdateVariationIDsHeaderValue(); | 83 UpdateVariationIDsHeaderValue(); |
84 } | 84 } |
85 | 85 |
86 void VariationsHttpHeaderProvider::InitVariationIDsCacheIfNeeded() { | 86 void VariationsHttpHeaderProvider::InitVariationIDsCacheIfNeeded() { |
87 base::AutoLock scoped_lock(lock_); | 87 base::AutoLock scoped_lock(lock_); |
88 if (variation_ids_cache_initialized_) | 88 if (variation_ids_cache_initialized_) |
89 return; | 89 return; |
90 | 90 |
91 // Register for additional cache updates. This is done first to avoid a race | 91 // Register for additional cache updates. This is done first to avoid a race |
92 // that could cause registered FieldTrials to be missed. | 92 // that could cause registered FieldTrials to be missed. |
93 DCHECK(MessageLoop::current()); | 93 DCHECK(base::MessageLoop::current()); |
94 base::FieldTrialList::AddObserver(this); | 94 base::FieldTrialList::AddObserver(this); |
95 | 95 |
96 base::TimeTicks before_time = base::TimeTicks::Now(); | 96 base::TimeTicks before_time = base::TimeTicks::Now(); |
97 | 97 |
98 base::FieldTrial::ActiveGroups initial_groups; | 98 base::FieldTrial::ActiveGroups initial_groups; |
99 base::FieldTrialList::GetActiveFieldTrialGroups(&initial_groups); | 99 base::FieldTrialList::GetActiveFieldTrialGroups(&initial_groups); |
100 for (base::FieldTrial::ActiveGroups::const_iterator it = | 100 for (base::FieldTrial::ActiveGroups::const_iterator it = |
101 initial_groups.begin(); | 101 initial_groups.begin(); |
102 it != initial_groups.end(); ++it) { | 102 it != initial_groups.end(); ++it) { |
103 const VariationID id = | 103 const VariationID id = |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // if IDs are added as the header is recreated. The receiving servers are OK | 151 // if IDs are added as the header is recreated. The receiving servers are OK |
152 // with such descrepancies. | 152 // with such descrepancies. |
153 variation_ids_header_ = hashed; | 153 variation_ids_header_ = hashed; |
154 } else { | 154 } else { |
155 NOTREACHED() << "Failed to base64 encode Variation IDs value: " | 155 NOTREACHED() << "Failed to base64 encode Variation IDs value: " |
156 << serialized; | 156 << serialized; |
157 } | 157 } |
158 } | 158 } |
159 | 159 |
160 } // namespace chrome_variations | 160 } // namespace chrome_variations |
OLD | NEW |