| 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" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 const int redir_count = RandomInt(1, 4); | 145 const int redir_count = RandomInt(1, 4); |
| 146 for (int i = 0; i < redir_count; ++i) | 146 for (int i = 0; i < redir_count; ++i) |
| 147 redirects.push_back(ConstructRandomURL()); | 147 redirects.push_back(ConstructRandomURL()); |
| 148 redirects.push_back(url); | 148 redirects.push_back(url); |
| 149 } | 149 } |
| 150 | 150 |
| 151 // Add all of this information to the history service. | 151 // Add all of this information to the history service. |
| 152 history_service->AddPage(url, | 152 history_service->AddPage(url, |
| 153 id_scope, page_id, | 153 id_scope, page_id, |
| 154 previous_url, transition, | 154 previous_url, transition, |
| 155 redirects); | 155 redirects, true); |
| 156 ThumbnailScore score(0.75, false, false); | 156 ThumbnailScore score(0.75, false, false); |
| 157 history_service->SetPageTitle(url, ConstructRandomTitle()); | 157 history_service->SetPageTitle(url, ConstructRandomTitle()); |
| 158 if (!history_only) { | 158 if (!history_only) { |
| 159 history_service->SetPageContents(url, ConstructRandomPage()); | 159 history_service->SetPageContents(url, ConstructRandomPage()); |
| 160 if (RandomInt(0, 2) == 0) { | 160 if (RandomInt(0, 2) == 0) { |
| 161 scoped_ptr<SkBitmap> bitmap( | 161 scoped_ptr<SkBitmap> bitmap( |
| 162 JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail))); | 162 JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail))); |
| 163 history_service->SetPageThumbnail(url, *bitmap, score); | 163 history_service->SetPageThumbnail(url, *bitmap, score); |
| 164 } else { | 164 } else { |
| 165 scoped_ptr<SkBitmap> bitmap( | 165 scoped_ptr<SkBitmap> bitmap( |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 const int kBatchSize = 2000; | 212 const int kBatchSize = 2000; |
| 213 int page_id = 0; | 213 int page_id = 0; |
| 214 while (page_id < url_count) { | 214 while (page_id < url_count) { |
| 215 const int batch_size = std::min(kBatchSize, url_count - page_id); | 215 const int batch_size = std::min(kBatchSize, url_count - page_id); |
| 216 InsertURLBatch(profile_dir, page_id, batch_size, history_only); | 216 InsertURLBatch(profile_dir, page_id, batch_size, history_only); |
| 217 page_id += batch_size; | 217 page_id += batch_size; |
| 218 } | 218 } |
| 219 | 219 |
| 220 return 0; | 220 return 0; |
| 221 } | 221 } |
| OLD | NEW |