Codebase list mozc / 18eff78
Optimize usage stats scheduler for Android This CL reduces the frequency of usage stats scheduler on Android not to wake Android OS. BUG= TEST= REF_BUG= REF_CL=109032105 Hiroshi Sumita 8 years ago
4 changed file(s) with 15 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
00 MAJOR=2
11 MINOR=17
2 BUILD=2396
2 BUILD=2397
33 REVISION=102
44 # NACL_DICTIONARY_VERSION is the target version of the system dictionary to be
55 # downloaded by NaCl Mozc.
7373 session_handler_->AddObserver(usage_observer_.get());
7474
7575 // start usage stats timer
76 // send usage stats within 5 min later
77 // attempt to send every 5 min -- 2 hours.
76 // send usage stats within 6 min later
7877 Scheduler::AddJob(Scheduler::JobSetting(
7978 "UsageStatsTimer",
8079 UsageStatsUploader::kDefaultScheduleInterval,
5454 namespace {
5555 Mutex g_stats_cache_mutex; // NOLINT
5656 const char kStatsJobName[] = "SaveCachedStats";
57 #ifndef OS_ANDROID
5758 const uint32 kSaveCacheStatsInterval = 10 * 60 * 1000; // 10 min
59 #else // !OS_ANDROID
60 // Reduce the frequency to save battery.
61 const uint32 kSaveCacheStatsInterval = 2 * 60 * 60 * 1000; // 2 hours
62 #endif // !OS_ANDROID
5863
5964 const size_t kMaxSession = 64;
6065
234234 const uint32 UsageStatsUploader::kDefaultSchedulerDelay = 60*1000;
235235 // 5 min
236236 const uint32 UsageStatsUploader::kDefaultSchedulerRandomDelay = 5*60*1000;
237 #ifndef OS_ANDROID
237238 // 5 min
238239 const uint32 UsageStatsUploader::kDefaultScheduleInterval = 5*60*1000;
239240 // 2 hours
240241 const uint32 UsageStatsUploader::kDefaultScheduleMaxInterval = 2*60*60*1000;
242 #else // !OS_ANDROID
243 // Reduce the frequency to save battery.
244 // 8 hours
245 const uint32 UsageStatsUploader::kDefaultScheduleInterval = 8*60*60*1000;
246 // 8 hours
247 const uint32 UsageStatsUploader::kDefaultScheduleMaxInterval = 8*60*60*1000;
248 #endif // !OS_ANDROID
241249
242250 void UsageStatsUploader::SetClientIdHandler(
243251 ClientIdInterface *client_id_handler) {