OLD | NEW |
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 "chrome/browser/history/thumbnail_database.h" | 5 #include "chrome/browser/history/thumbnail_database.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 FaviconBitmapID ThumbnailDatabase::AddFaviconBitmap( | 482 FaviconBitmapID ThumbnailDatabase::AddFaviconBitmap( |
483 FaviconID icon_id, | 483 FaviconID icon_id, |
484 const scoped_refptr<base::RefCountedMemory>& icon_data, | 484 const scoped_refptr<base::RefCountedMemory>& icon_data, |
485 base::Time time, | 485 base::Time time, |
486 const gfx::Size& pixel_size) { | 486 const gfx::Size& pixel_size) { |
487 DCHECK(icon_id); | 487 DCHECK(icon_id); |
488 sql::Statement statement(db_.GetCachedStatement(SQL_FROM_HERE, | 488 sql::Statement statement(db_.GetCachedStatement(SQL_FROM_HERE, |
489 "INSERT INTO favicon_bitmaps (icon_id, image_data, last_updated, width, " | 489 "INSERT INTO favicon_bitmaps (icon_id, image_data, last_updated, width, " |
490 "height) VALUES (?, ?, ?, ?, ?)")); | 490 "height) VALUES (?, ?, ?, ?, ?)")); |
491 statement.BindInt64(0, icon_id); | 491 statement.BindInt64(0, icon_id); |
492 if (icon_data->size()) { | 492 if (icon_data.get() && icon_data->size()) { |
493 statement.BindBlob(1, icon_data->front(), | 493 statement.BindBlob(1, icon_data->front(), |
494 static_cast<int>(icon_data->size())); | 494 static_cast<int>(icon_data->size())); |
495 } else { | 495 } else { |
496 statement.BindNull(1); | 496 statement.BindNull(1); |
497 } | 497 } |
498 statement.BindInt64(2, time.ToTimeT()); | 498 statement.BindInt64(2, time.ToTimeT()); |
499 statement.BindInt(3, pixel_size.width()); | 499 statement.BindInt(3, pixel_size.width()); |
500 statement.BindInt(4, pixel_size.height()); | 500 statement.BindInt(4, pixel_size.height()); |
501 | 501 |
502 if (!statement.Run()) | 502 if (!statement.Run()) |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 db_.Execute("ALTER TABLE temp_favicons RENAME TO favicons"); | 1011 db_.Execute("ALTER TABLE temp_favicons RENAME TO favicons"); |
1012 if (!success) | 1012 if (!success) |
1013 return false; | 1013 return false; |
1014 | 1014 |
1015 meta_table_.SetVersionNumber(6); | 1015 meta_table_.SetVersionNumber(6); |
1016 meta_table_.SetCompatibleVersionNumber(std::min(6, kCompatibleVersionNumber)); | 1016 meta_table_.SetCompatibleVersionNumber(std::min(6, kCompatibleVersionNumber)); |
1017 return true; | 1017 return true; |
1018 } | 1018 } |
1019 | 1019 |
1020 } // namespace history | 1020 } // namespace history |
OLD | NEW |