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

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

Issue 42013: Slight code change to make some global variables const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 9 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
« no previous file with comments | « chrome/tools/crash_service/crash_service.h ('k') | chrome/views/bitmap_scroll_bar.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 std::vector<GURL> revisit_urls; 113 std::vector<GURL> revisit_urls;
114 114
115 // Scoping value for page IDs (required by the history service). 115 // Scoping value for page IDs (required by the history service).
116 void* id_scope = reinterpret_cast<void*>(1); 116 void* id_scope = reinterpret_cast<void*>(1);
117 117
118 printf("Inserting %d URLs...\n", batch_size); 118 printf("Inserting %d URLs...\n", batch_size);
119 GURL previous_url; 119 GURL previous_url;
120 PageTransition::Type transition = PageTransition::TYPED; 120 PageTransition::Type transition = PageTransition::TYPED;
121 const int end_page_id = page_id + batch_size; 121 const int end_page_id = page_id + batch_size;
122 for (; page_id < end_page_id; ++page_id) { 122 for (; page_id < end_page_id; ++page_id) {
123 // Randomly decide whether this new URL simulates following a link or whethe r 123 // Randomly decide whether this new URL simulates following a link or
124 // it's a jump to a new URL. 124 // whether it's a jump to a new URL.
125 if (!previous_url.is_empty() && RandomFloat() < kFollowLinkProbability) { 125 if (!previous_url.is_empty() && RandomFloat() < kFollowLinkProbability) {
126 transition = PageTransition::LINK; 126 transition = PageTransition::LINK;
127 } else { 127 } else {
128 previous_url = GURL(); 128 previous_url = GURL();
129 transition = PageTransition::TYPED; 129 transition = PageTransition::TYPED;
130 } 130 }
131 131
132 // Pick a URL, either newly at random or from our list of previously 132 // Pick a URL, either newly at random or from our list of previously
133 // visited URLs. 133 // visited URLs.
134 GURL url; 134 GURL url;
(...skipping 77 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
« no previous file with comments | « chrome/tools/crash_service/crash_service.h ('k') | chrome/views/bitmap_scroll_bar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698