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/process_util.h" |
15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
16 #include "base/time.h" | 16 #include "base/time.h" |
17 #include "chrome/browser/history/history.h" | 17 #include "chrome/browser/history/history.h" |
18 #include "chrome/common/jpeg_codec.h" | 18 #include "chrome/common/jpeg_codec.h" |
19 #include "chrome/common/thumbnail_score.h" | 19 #include "chrome/common/thumbnail_score.h" |
20 #include "SkBitmap.h" | 20 #include "SkBitmap.h" |
21 | 21 |
| 22 using base::Time; |
| 23 |
22 // Probabilities of different word lengths, as measured from Darin's profile. | 24 // Probabilities of different word lengths, as measured from Darin's profile. |
23 // kWordLengthProbabilities[n-1] = P(word of length n) | 25 // kWordLengthProbabilities[n-1] = P(word of length n) |
24 const float kWordLengthProbabilities[] = { 0.069f, 0.132f, 0.199f, | 26 const float kWordLengthProbabilities[] = { 0.069f, 0.132f, 0.199f, |
25 0.137f, 0.088f, 0.115f, 0.081f, 0.055f, 0.034f, 0.021f, 0.019f, 0.018f, | 27 0.137f, 0.088f, 0.115f, 0.081f, 0.055f, 0.034f, 0.021f, 0.019f, 0.018f, |
26 0.007f, 0.007f, 0.005f, 0.004f, 0.003f, 0.003f, 0.003f }; | 28 0.007f, 0.007f, 0.005f, 0.004f, 0.003f, 0.003f, 0.003f }; |
27 | 29 |
28 // Return a float uniformly in [0,1]. | 30 // Return a float uniformly in [0,1]. |
29 // Useful for making probabilistic decisions. | 31 // Useful for making probabilistic decisions. |
30 float RandomFloat() { | 32 float RandomFloat() { |
31 return rand() / static_cast<float>(RAND_MAX); | 33 return rand() / static_cast<float>(RAND_MAX); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 const int kBatchSize = 2000; | 211 const int kBatchSize = 2000; |
210 int page_id = 0; | 212 int page_id = 0; |
211 while (page_id < url_count) { | 213 while (page_id < url_count) { |
212 const int batch_size = std::min(kBatchSize, url_count - page_id); | 214 const int batch_size = std::min(kBatchSize, url_count - page_id); |
213 InsertURLBatch(profile_dir, page_id, batch_size, history_only); | 215 InsertURLBatch(profile_dir, page_id, batch_size, history_only); |
214 page_id += batch_size; | 216 page_id += batch_size; |
215 } | 217 } |
216 | 218 |
217 return 0; | 219 return 0; |
218 } | 220 } |
219 | |
OLD | NEW |