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

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

Issue 2828173002: [Refactor] Simplify HistoryBackend::UpdateFaviconMappingsAndFetchImpl() signature (Closed)
Patch Set: Merge branch 'master' into icon_type0 Created 3 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/thumbnail_database.h" 5 #include "components/history/core/browser/thumbnail_database.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 sql::Statement statement(db_.GetCachedStatement(SQL_FROM_HERE, 577 sql::Statement statement(db_.GetCachedStatement(SQL_FROM_HERE,
578 "UPDATE favicon_bitmaps SET last_updated=? WHERE icon_id=?")); 578 "UPDATE favicon_bitmaps SET last_updated=? WHERE icon_id=?"));
579 statement.BindInt64(0, 0); 579 statement.BindInt64(0, 0);
580 statement.BindInt64(1, icon_id); 580 statement.BindInt64(1, icon_id);
581 581
582 return statement.Run(); 582 return statement.Run();
583 } 583 }
584 584
585 favicon_base::FaviconID ThumbnailDatabase::GetFaviconIDForFaviconURL( 585 favicon_base::FaviconID ThumbnailDatabase::GetFaviconIDForFaviconURL(
586 const GURL& icon_url, 586 const GURL& icon_url,
587 int required_icon_type, 587 favicon_base::IconType icon_type) {
588 favicon_base::IconType* icon_type) { 588 sql::Statement statement(db_.GetCachedStatement(
589 sql::Statement statement(db_.GetCachedStatement(SQL_FROM_HERE, 589 SQL_FROM_HERE, "SELECT id FROM favicons WHERE url=? AND icon_type=?"));
590 "SELECT id, icon_type FROM favicons WHERE url=? AND (icon_type & ? > 0) "
591 "ORDER BY icon_type DESC"));
592 statement.BindString(0, URLDatabase::GURLToDatabaseURL(icon_url)); 590 statement.BindString(0, URLDatabase::GURLToDatabaseURL(icon_url));
593 statement.BindInt(1, required_icon_type); 591 statement.BindInt(1, icon_type);
594 592
595 if (!statement.Step()) 593 if (!statement.Step())
596 return 0; // not cached 594 return 0; // not cached
597 595
598 if (icon_type)
599 *icon_type = static_cast<favicon_base::IconType>(statement.ColumnInt(1));
600 return statement.ColumnInt64(0); 596 return statement.ColumnInt64(0);
601 } 597 }
602 598
603 bool ThumbnailDatabase::GetFaviconHeader(favicon_base::FaviconID icon_id, 599 bool ThumbnailDatabase::GetFaviconHeader(favicon_base::FaviconID icon_id,
604 GURL* icon_url, 600 GURL* icon_url,
605 favicon_base::IconType* icon_type) { 601 favicon_base::IconType* icon_type) {
606 DCHECK(icon_id); 602 DCHECK(icon_id);
607 603
608 sql::Statement statement(db_.GetCachedStatement(SQL_FROM_HERE, 604 sql::Statement statement(db_.GetCachedStatement(SQL_FROM_HERE,
609 "SELECT url, icon_type FROM favicons WHERE id=?")); 605 "SELECT url, icon_type FROM favicons WHERE id=?"));
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 meta_table_.SetVersionNumber(8); 1063 meta_table_.SetVersionNumber(8);
1068 meta_table_.SetCompatibleVersionNumber(std::min(8, kCompatibleVersionNumber)); 1064 meta_table_.SetCompatibleVersionNumber(std::min(8, kCompatibleVersionNumber));
1069 return true; 1065 return true;
1070 } 1066 }
1071 1067
1072 bool ThumbnailDatabase::IsFaviconDBStructureIncorrect() { 1068 bool ThumbnailDatabase::IsFaviconDBStructureIncorrect() {
1073 return !db_.IsSQLValid("SELECT id, url, icon_type FROM favicons"); 1069 return !db_.IsSQLValid("SELECT id, url, icon_type FROM favicons");
1074 } 1070 }
1075 1071
1076 } // namespace history 1072 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698