OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chromeos/system/statistics_provider.h" | 5 #include "chromeos/system/statistics_provider.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 private: | 127 private: |
128 DISALLOW_COPY_AND_ASSIGN(StatisticsProviderImpl); | 128 DISALLOW_COPY_AND_ASSIGN(StatisticsProviderImpl); |
129 }; | 129 }; |
130 | 130 |
131 bool StatisticsProviderImpl::WaitForStatisticsLoaded() { | 131 bool StatisticsProviderImpl::WaitForStatisticsLoaded() { |
132 CHECK(load_statistics_started_); | 132 CHECK(load_statistics_started_); |
133 if (on_statistics_loaded_.IsSignaled()) | 133 if (on_statistics_loaded_.IsSignaled()) |
134 return true; | 134 return true; |
135 | 135 |
136 // Block if the statistics are not loaded yet. Normally this shouldn't | 136 // Block if the statistics are not loaded yet. Normally this shouldn't |
137 // happen excpet during OOBE. | 137 // happen except during OOBE. |
138 base::Time start_time = base::Time::Now(); | 138 base::Time start_time = base::Time::Now(); |
139 base::ThreadRestrictions::ScopedAllowWait allow_wait; | 139 base::ThreadRestrictions::ScopedAllowWait allow_wait; |
140 on_statistics_loaded_.TimedWait(base::TimeDelta::FromSeconds(kTimeoutSecs)); | 140 on_statistics_loaded_.TimedWait(base::TimeDelta::FromSeconds(kTimeoutSecs)); |
141 | 141 |
142 base::TimeDelta dtime = base::Time::Now() - start_time; | 142 base::TimeDelta dtime = base::Time::Now() - start_time; |
143 if (on_statistics_loaded_.IsSignaled()) { | 143 if (on_statistics_loaded_.IsSignaled()) { |
144 LOG(ERROR) << "Statistics loaded after waiting " | 144 LOG(ERROR) << "Statistics loaded after waiting " |
145 << dtime.InMilliseconds() << "ms. "; | 145 << dtime.InMilliseconds() << "ms. "; |
146 return true; | 146 return true; |
147 } | 147 } |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 return StatisticsProviderImpl::GetInstance(); | 323 return StatisticsProviderImpl::GetInstance(); |
324 } | 324 } |
325 | 325 |
326 // static | 326 // static |
327 void StatisticsProvider::SetTestProvider(StatisticsProvider* test_provider) { | 327 void StatisticsProvider::SetTestProvider(StatisticsProvider* test_provider) { |
328 g_test_statistics_provider = test_provider; | 328 g_test_statistics_provider = test_provider; |
329 } | 329 } |
330 | 330 |
331 } // namespace system | 331 } // namespace system |
332 } // namespace chromeos | 332 } // namespace chromeos |
OLD | NEW |