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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/rand_util.h" | 7 #include "base/rand_util.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "chrome/browser/apps/ephemeral_app_service.h" | 10 #include "chrome/browser/apps/ephemeral_app_service.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 // Generate X app launch times, N days before the reference time. | 88 // Generate X app launch times, N days before the reference time. |
89 // If |generated_ids| is not NULL, the generated app IDs will be added | 89 // If |generated_ids| is not NULL, the generated app IDs will be added |
90 // to the set. | 90 // to the set. |
91 void GenerateLaunchTimes(const base::Time& reference_time, | 91 void GenerateLaunchTimes(const base::Time& reference_time, |
92 int days_before, | 92 int days_before, |
93 int count, | 93 int count, |
94 LaunchTimeAppMap* launch_times, | 94 LaunchTimeAppMap* launch_times, |
95 std::set<std::string>* generated_ids = NULL) { | 95 std::set<std::string>* generated_ids = NULL) { |
96 for (int i = 0; i < count; ++i) { | 96 for (int i = 0; i < count; ++i) { |
97 std::string app_id = base::IntToString(launch_times->size()); | 97 std::string app_id = base::SizeTToString(launch_times->size()); |
98 launch_times->insert(std::make_pair( | 98 launch_times->insert(std::make_pair( |
99 GetPastTime(reference_time, days_before, true), | 99 GetPastTime(reference_time, days_before, true), |
100 app_id)); | 100 app_id)); |
101 | 101 |
102 if (generated_ids) | 102 if (generated_ids) |
103 generated_ids->insert(app_id); | 103 generated_ids->insert(app_id); |
104 } | 104 } |
105 } | 105 } |
106 | 106 |
107 // Add inactive apps that should always be removed by garbage collection. | 107 // Add inactive apps that should always be removed by garbage collection. |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 const int kRunningApps = 3; | 257 const int kRunningApps = 3; |
258 AddIntermediateApps( | 258 AddIntermediateApps( |
259 time_now, | 259 time_now, |
260 EphemeralAppService::kMaxEphemeralAppsCount, | 260 EphemeralAppService::kMaxEphemeralAppsCount, |
261 &launch_times); // overflow | 261 &launch_times); // overflow |
262 RunTestCheckLRU( | 262 RunTestCheckLRU( |
263 launch_times.size() + kRunningApps, | 263 launch_times.size() + kRunningApps, |
264 launch_times, | 264 launch_times, |
265 kRunningApps); | 265 kRunningApps); |
266 } | 266 } |
OLD | NEW |