| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // This program generates a user profile and history by randomly generating | 5 // This program generates a user profile and history by randomly generating |
| 6 // data and feeding it to the history service. | 6 // data and feeding it to the history service. |
| 7 | 7 |
| 8 #include "chrome/tools/profiles/thumbnail-inl.h" | 8 #include "chrome/tools/profiles/thumbnail-inl.h" |
| 9 | 9 |
| 10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
| 11 #include "base/icu_util.h" | 11 #include "base/icu_util.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/process_util.h" |
| 14 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 15 #include "base/time.h" | 16 #include "base/time.h" |
| 16 #include "chrome/browser/history/history.h" | 17 #include "chrome/browser/history/history.h" |
| 17 #include "chrome/common/jpeg_codec.h" | 18 #include "chrome/common/jpeg_codec.h" |
| 18 #include "chrome/common/thumbnail_score.h" | 19 #include "chrome/common/thumbnail_score.h" |
| 19 #include "SkBitmap.h" | 20 #include "SkBitmap.h" |
| 20 | 21 |
| 21 // Probabilities of different word lengths, as measured from Darin's profile. | 22 // Probabilities of different word lengths, as measured from Darin's profile. |
| 22 // kWordLengthProbabilities[n-1] = P(word of length n) | 23 // kWordLengthProbabilities[n-1] = P(word of length n) |
| 23 const float kWordLengthProbabilities[] = { 0.069f, 0.132f, 0.199f, | 24 const float kWordLengthProbabilities[] = { 0.069f, 0.132f, 0.199f, |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 172 } |
| 172 | 173 |
| 173 printf("Letting the history service catch up...\n"); | 174 printf("Letting the history service catch up...\n"); |
| 174 history_service->SetOnBackendDestroyTask(new MessageLoop::QuitTask); | 175 history_service->SetOnBackendDestroyTask(new MessageLoop::QuitTask); |
| 175 history_service->Cleanup(); | 176 history_service->Cleanup(); |
| 176 history_service = NULL; | 177 history_service = NULL; |
| 177 MessageLoop::current()->Run(); | 178 MessageLoop::current()->Run(); |
| 178 } | 179 } |
| 179 | 180 |
| 180 int main(int argc, const char* argv[]) { | 181 int main(int argc, const char* argv[]) { |
| 182 process_util::EnableTerminationOnHeapCorruption(); |
| 181 base::AtExitManager exit_manager; | 183 base::AtExitManager exit_manager; |
| 182 | 184 |
| 183 int next_arg = 1; | 185 int next_arg = 1; |
| 184 bool history_only = false; | 186 bool history_only = false; |
| 185 if (strcmp(argv[next_arg], "--history-only") == 0) { | 187 if (strcmp(argv[next_arg], "--history-only") == 0) { |
| 186 history_only = true; | 188 history_only = true; |
| 187 next_arg++; | 189 next_arg++; |
| 188 } | 190 } |
| 189 | 191 |
| 190 // We require two arguments: urlcount and profiledir. | 192 // We require two arguments: urlcount and profiledir. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 208 int page_id = 0; | 210 int page_id = 0; |
| 209 while (page_id < url_count) { | 211 while (page_id < url_count) { |
| 210 const int batch_size = std::min(kBatchSize, url_count - page_id); | 212 const int batch_size = std::min(kBatchSize, url_count - page_id); |
| 211 InsertURLBatch(profile_dir, page_id, batch_size, history_only); | 213 InsertURLBatch(profile_dir, page_id, batch_size, history_only); |
| 212 page_id += batch_size; | 214 page_id += batch_size; |
| 213 } | 215 } |
| 214 | 216 |
| 215 return 0; | 217 return 0; |
| 216 } | 218 } |
| 217 | 219 |
| OLD | NEW |