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

Side by Side Diff: chrome/browser/history/text_database.cc

Issue 341087: Eliminate QueryOptions::most_recent_visit_only. All non-unittest consumers o... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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/browser/history/text_database.h ('k') | chrome/browser/history/visit_database.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) 2009 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 #include <limits> 5 #include <limits>
6 #include <set> 6 #include <set>
7 7
8 #include "chrome/browser/history/text_database.h" 8 #include "chrome/browser/history/text_database.h"
9 9
10 #include "app/sql/connection.h" 10 #include "app/sql/connection.h"
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 statement.BindInt64(1, effective_begin_time); 319 statement.BindInt64(1, effective_begin_time);
320 statement.BindInt64(2, effective_end_time); 320 statement.BindInt64(2, effective_end_time);
321 statement.BindInt(3, effective_max_count); 321 statement.BindInt(3, effective_max_count);
322 322
323 while (statement.Step()) { 323 while (statement.Step()) {
324 // TODO(brettw) allow canceling the query in the middle. 324 // TODO(brettw) allow canceling the query in the middle.
325 // if (canceled_or_something) 325 // if (canceled_or_something)
326 // break; 326 // break;
327 327
328 GURL url(statement.ColumnString(0)); 328 GURL url(statement.ColumnString(0));
329 if (options.most_recent_visit_only) { 329 URLSet::const_iterator found_url = found_urls->find(url);
330 URLSet::const_iterator found_url = found_urls->find(url); 330 if (found_url != found_urls->end())
331 if (found_url != found_urls->end()) 331 continue; // Don't add this duplicate.
332 continue; // Don't add this duplicate when unique URLs are requested.
333 }
334 332
335 // Fill the results into the vector (avoid copying the URL with Swap()). 333 // Fill the results into the vector (avoid copying the URL with Swap()).
336 results->resize(results->size() + 1); 334 results->resize(results->size() + 1);
337 Match& match = results->at(results->size() - 1); 335 Match& match = results->at(results->size() - 1);
338 match.url.Swap(&url); 336 match.url.Swap(&url);
339 337
340 match.title = UTF8ToWide(statement.ColumnString(1)); 338 match.title = UTF8ToWide(statement.ColumnString(1));
341 match.time = base::Time::FromInternalValue(statement.ColumnInt64(2)); 339 match.time = base::Time::FromInternalValue(statement.ColumnInt64(2));
342 340
343 // Extract any matches in the title. 341 // Extract any matches in the title.
(...skipping 23 matching lines...) Expand all
367 } else { 365 } else {
368 // Since we got the results in order, we know the last item is the last 366 // Since we got the results in order, we know the last item is the last
369 // time we considered. 367 // time we considered.
370 *first_time_searched = results->back().time; 368 *first_time_searched = results->back().time;
371 } 369 }
372 370
373 statement.Reset(); 371 statement.Reset();
374 } 372 }
375 373
376 } // namespace history 374 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/text_database.h ('k') | chrome/browser/history/visit_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698