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 #include "chrome/browser/history/visitsegment_database.h" | 5 #include "chrome/browser/history/visitsegment_database.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "chrome/browser/history/page_usage_data.h" | 9 #include "chrome/browser/history/page_usage_data.h" |
10 #include "chrome/common/sqlite_compiled_statement.h" | 10 #include "chrome/common/sqlite_compiled_statement.h" |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 std::vector<PageUsageData*>* results) { | 233 std::vector<PageUsageData*>* results) { |
234 // This function gathers the highest-ranked segments in two queries. | 234 // This function gathers the highest-ranked segments in two queries. |
235 // The first gathers scores for all segments. | 235 // The first gathers scores for all segments. |
236 // The second gathers segment data (url, title, etc.) for the highest-ranked | 236 // The second gathers segment data (url, title, etc.) for the highest-ranked |
237 // segments. | 237 // segments. |
238 // TODO(evanm): this disregards the "presentation index", which was what was | 238 // TODO(evanm): this disregards the "presentation index", which was what was |
239 // used to lock results into position. But the rest of our code currently | 239 // used to lock results into position. But the rest of our code currently |
240 // does as well. | 240 // does as well. |
241 | 241 |
242 // How many results we return, as promised in the header file. | 242 // How many results we return, as promised in the header file. |
243 const int kResultCount = 9; | 243 const size_t kResultCount = 9; |
244 | 244 |
245 // Gather all the segment scores: | 245 // Gather all the segment scores: |
246 SQLITE_UNIQUE_STATEMENT(statement, GetStatementCache(), | 246 SQLITE_UNIQUE_STATEMENT(statement, GetStatementCache(), |
247 "SELECT segment_id, time_slot, visit_count " | 247 "SELECT segment_id, time_slot, visit_count " |
248 "FROM segment_usage WHERE time_slot >= ? " | 248 "FROM segment_usage WHERE time_slot >= ? " |
249 "ORDER BY segment_id"); | 249 "ORDER BY segment_id"); |
250 if (!statement.is_valid()) { | 250 if (!statement.is_valid()) { |
251 NOTREACHED(); | 251 NOTREACHED(); |
252 return; | 252 return; |
253 } | 253 } |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 r = false; | 380 r = false; |
381 } | 381 } |
382 delete_usage->reset(); | 382 delete_usage->reset(); |
383 delete_seg->reset(); | 383 delete_seg->reset(); |
384 } | 384 } |
385 return r; | 385 return r; |
386 } | 386 } |
387 | 387 |
388 } // namespace history | 388 } // namespace history |
389 | 389 |
OLD | NEW |