Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: chrome/tools/profiles/generate_profile.cc

Issue 243076: Move the JPEG and PNG codecs from base/gfx to app/gfx/codec. Move the classes... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "app/gfx/codec/jpeg_codec.h"
10 #include "base/at_exit.h" 11 #include "base/at_exit.h"
11 #include "base/file_path.h" 12 #include "base/file_path.h"
12 #include "base/gfx/jpeg_codec.h"
13 #include "base/icu_util.h" 13 #include "base/icu_util.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "base/path_service.h" 15 #include "base/path_service.h"
16 #include "base/process_util.h" 16 #include "base/process_util.h"
17 #include "base/string_util.h" 17 #include "base/string_util.h"
18 #include "base/time.h" 18 #include "base/time.h"
19 #include "chrome/browser/history/history.h" 19 #include "chrome/browser/history/history.h"
20 #include "chrome/common/thumbnail_score.h" 20 #include "chrome/common/thumbnail_score.h"
21 #include "third_party/skia/include/core/SkBitmap.h" 21 #include "third_party/skia/include/core/SkBitmap.h"
22 22
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, true); 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 gfx::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(
166 JPEGCodec::Decode(kWeewarThumbnail, sizeof(kWeewarThumbnail))); 166 gfx::JPEGCodec::Decode(kWeewarThumbnail, sizeof(kWeewarThumbnail)));
167 history_service->SetPageThumbnail(url, *bitmap, score); 167 history_service->SetPageThumbnail(url, *bitmap, score);
168 } 168 }
169 } 169 }
170 170
171 previous_url = url; 171 previous_url = url;
172 172
173 if (revisit_urls.empty() || RandomFloat() < kRevisitableURLProbability) 173 if (revisit_urls.empty() || RandomFloat() < kRevisitableURLProbability)
174 revisit_urls.push_back(url); 174 revisit_urls.push_back(url);
175 } 175 }
176 176
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698