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

Side by Side Diff: components/history/core/browser/url_database.cc

Issue 2954593002: History init: add metrics and skip migration. (Closed)
Patch Set: Fixes Created 3 years, 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/history/core/browser/url_database.h" 5 #include "components/history/core/browser/url_database.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 if (GetDB().DoesTableExist(name)) 579 if (GetDB().DoesTableExist(name))
580 return true; 580 return true;
581 581
582 // Note: revise implementation for InsertOrUpdateURLRowByID() if you add any 582 // Note: revise implementation for InsertOrUpdateURLRowByID() if you add any
583 // new constraints to the schema. 583 // new constraints to the schema.
584 std::string sql; 584 std::string sql;
585 sql.append("CREATE TABLE "); 585 sql.append("CREATE TABLE ");
586 sql.append(name); 586 sql.append(name);
587 sql.append( 587 sql.append(
588 "(" 588 "("
589 "id INTEGER PRIMARY KEY AUTOINCREMENT," 589 // The id uses AUTOINCREMENT is for sync propose. Sync uses this |id| as
590 // Using AUTOINCREMENT is for sync propose. Sync uses this |id| as an 590 // an unique key to identify the URLs. If here did not use AUTOINCREMENT,
591 // unique key to identify the URLs. If here did not use AUTOINCREMENT, and 591 // and Sync was not working somehow, a ROWID could be deleted and re-used
592 // Sync was not working somehow, a ROWID could be deleted and re-used
593 // during this period. Once Sync come back, Sync would use ROWIDs and 592 // during this period. Once Sync come back, Sync would use ROWIDs and
594 // timestamps to see if there are any updates need to be synced. And sync 593 // timestamps to see if there are any updates need to be synced. And sync
595 // will only see the new URL, but missed the deleted URL. 594 // will only see the new URL, but missed the deleted URL.
595 //
596 // IMPORTANT NOTE: Currently new tables are created with AUTOINCREMENT
597 // but the migration code is disabled. This means that you will not
598 // be able to count on AUTOINCREMENT behavior without adding
599 // additional migration steps.
600 //
601 // TODO(https://crbug.com/736136) figure out how to update users to use
602 // AUTOINCREMENT.
603 "id INTEGER PRIMARY KEY AUTOINCREMENT,"
596 "url LONGVARCHAR," 604 "url LONGVARCHAR,"
597 "title LONGVARCHAR," 605 "title LONGVARCHAR,"
598 "visit_count INTEGER DEFAULT 0 NOT NULL," 606 "visit_count INTEGER DEFAULT 0 NOT NULL,"
599 "typed_count INTEGER DEFAULT 0 NOT NULL," 607 "typed_count INTEGER DEFAULT 0 NOT NULL,"
600 "last_visit_time INTEGER NOT NULL," 608 "last_visit_time INTEGER NOT NULL,"
601 "hidden INTEGER DEFAULT 0 NOT NULL)"); 609 "hidden INTEGER DEFAULT 0 NOT NULL)");
602 610
603 return GetDB().Execute(sql.c_str()); 611 return GetDB().Execute(sql.c_str());
604 } 612 }
605 613
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 return false; 654 return false;
647 655
648 const base::Time& real_threshold = 656 const base::Time& real_threshold =
649 threshold.is_null() ? AutocompleteAgeThreshold() : threshold; 657 threshold.is_null() ? AutocompleteAgeThreshold() : threshold;
650 return (row.typed_count() >= kLowQualityMatchTypedLimit) || 658 return (row.typed_count() >= kLowQualityMatchTypedLimit) ||
651 (row.visit_count() >= kLowQualityMatchVisitLimit) || 659 (row.visit_count() >= kLowQualityMatchVisitLimit) ||
652 (row.last_visit() >= real_threshold); 660 (row.last_visit() >= real_threshold);
653 } 661 }
654 662
655 } // namespace history 663 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698