summaryrefslogtreecommitdiffstats
path: root/chrome/browser/history
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/history')
-rw-r--r--chrome/browser/history/history.cc2
-rw-r--r--chrome/browser/history/history_backend.cc7
-rw-r--r--chrome/browser/history/history_backend.h2
-rw-r--r--chrome/browser/history/history_backend_unittest.cc14
-rw-r--r--chrome/browser/history/thumbnail_database.cc9
-rw-r--r--chrome/browser/history/thumbnail_database.h4
6 files changed, 22 insertions, 16 deletions
diff --git a/chrome/browser/history/history.cc b/chrome/browser/history/history.cc
index 53ad780..b1b9d09 100644
--- a/chrome/browser/history/history.cc
+++ b/chrome/browser/history/history.cc
@@ -433,7 +433,7 @@ void HistoryService::SetFavicon(const GURL& page_url,
ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::SetFavIcon,
page_url, icon_url,
- scoped_refptr<RefCountedBytes>(new RefCountedBytes(image_data)));
+ scoped_refptr<RefCountedMemory>(new RefCountedBytes(image_data)));
}
void HistoryService::SetFaviconOutOfDateForPage(const GURL& page_url) {
diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc
index 33c079a..420095e 100644
--- a/chrome/browser/history/history_backend.cc
+++ b/chrome/browser/history/history_backend.cc
@@ -1445,7 +1445,8 @@ void HistoryBackend::SetImportedFavicons(
favicon_id = thumbnail_db_->AddFavIcon(favicon_usage[i].favicon_url);
if (!favicon_id)
continue; // Unable to add the favicon.
- thumbnail_db_->SetFavIcon(favicon_id, favicon_usage[i].png_data, now);
+ thumbnail_db_->SetFavIcon(favicon_id,
+ new RefCountedBytes(favicon_usage[i].png_data), now);
}
// Save the mapping from all the URLs to the favicon.
@@ -1561,7 +1562,7 @@ void HistoryBackend::GetFavIconForURL(
void HistoryBackend::SetFavIcon(
const GURL& page_url,
const GURL& icon_url,
- scoped_refptr<RefCountedBytes> data) {
+ scoped_refptr<RefCountedMemory> data) {
DCHECK(data.get());
if (!thumbnail_db_.get() || !db_.get())
return;
@@ -1571,7 +1572,7 @@ void HistoryBackend::SetFavIcon(
id = thumbnail_db_->AddFavIcon(icon_url);
// Set the image data.
- thumbnail_db_->SetFavIcon(id, data->data, Time::Now());
+ thumbnail_db_->SetFavIcon(id, data, Time::Now());
SetFavIconMapping(page_url, id);
}
diff --git a/chrome/browser/history/history_backend.h b/chrome/browser/history/history_backend.h
index 34817a7..cfd1637 100644
--- a/chrome/browser/history/history_backend.h
+++ b/chrome/browser/history/history_backend.h
@@ -191,7 +191,7 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>,
const GURL& page_url);
void SetFavIcon(const GURL& page_url,
const GURL& icon_url,
- scoped_refptr<RefCountedBytes> data);
+ scoped_refptr<RefCountedMemory> data);
void UpdateFavIconMappingAndFetch(scoped_refptr<GetFavIconRequest> request,
const GURL& page_url,
const GURL& icon_url);
diff --git a/chrome/browser/history/history_backend_unittest.cc b/chrome/browser/history/history_backend_unittest.cc
index e1c8d47..5be4a77 100644
--- a/chrome/browser/history/history_backend_unittest.cc
+++ b/chrome/browser/history/history_backend_unittest.cc
@@ -6,6 +6,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/path_service.h"
+#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/history/history_backend.h"
@@ -183,12 +184,12 @@ TEST_F(HistoryBackendTest, DeleteAll) {
std::vector<unsigned char> data;
data.push_back('1');
- EXPECT_TRUE(backend_->thumbnail_db_->SetFavIcon(
- favicon1, data, Time::Now()));
+ EXPECT_TRUE(backend_->thumbnail_db_->SetFavIcon(favicon1,
+ new RefCountedBytes(data), Time::Now()));
data[0] = '2';
EXPECT_TRUE(backend_->thumbnail_db_->SetFavIcon(
- favicon2, data, Time::Now()));
+ favicon2, new RefCountedBytes(data), Time::Now()));
// First visit two URLs.
URLRow row1(GURL("http://www.google.com/"));
@@ -311,11 +312,11 @@ TEST_F(HistoryBackendTest, URLsNoLongerBookmarked) {
std::vector<unsigned char> data;
data.push_back('1');
EXPECT_TRUE(backend_->thumbnail_db_->SetFavIcon(
- favicon1, data, Time::Now()));
+ favicon1, new RefCountedBytes(data), Time::Now()));
data[0] = '2';
EXPECT_TRUE(backend_->thumbnail_db_->SetFavIcon(
- favicon2, data, Time::Now()));
+ favicon2, new RefCountedBytes(data), Time::Now()));
// First visit two URLs.
URLRow row1(GURL("http://www.google.com/"));
@@ -509,7 +510,8 @@ TEST_F(HistoryBackendTest, ImportedFaviconsTest) {
FavIconID favicon1 = backend_->thumbnail_db_->AddFavIcon(favicon_url1);
std::vector<unsigned char> data;
data.push_back('1');
- EXPECT_TRUE(backend_->thumbnail_db_->SetFavIcon(favicon1, data, Time::Now()));
+ EXPECT_TRUE(backend_->thumbnail_db_->SetFavIcon(favicon1,
+ RefCountedBytes::TakeVector(&data), Time::Now()));
URLRow row1(GURL("http://www.google.com/"));
row1.set_favicon_id(favicon1);
row1.set_visit_count(1);
diff --git a/chrome/browser/history/thumbnail_database.cc b/chrome/browser/history/thumbnail_database.cc
index 4e6f372..9fab35c 100644
--- a/chrome/browser/history/thumbnail_database.cc
+++ b/chrome/browser/history/thumbnail_database.cc
@@ -11,6 +11,7 @@
#if defined(OS_MACOSX)
#include "base/mac_util.h"
#endif
+#include "base/ref_counted_memory.h"
#include "base/time.h"
#include "base/string_util.h"
#include "chrome/browser/diagnostics/sqlite_diagnostics.h"
@@ -305,17 +306,17 @@ bool ThumbnailDatabase::ThumbnailScoreForId(URLID id,
}
bool ThumbnailDatabase::SetFavIcon(URLID icon_id,
- const std::vector<unsigned char>& icon_data,
+ scoped_refptr<RefCountedMemory> icon_data,
base::Time time) {
DCHECK(icon_id);
- if (icon_data.size()) {
+ if (icon_data->size()) {
sql::Statement statement(db_.GetCachedStatement(SQL_FROM_HERE,
"UPDATE favicons SET image_data=?, last_updated=? WHERE id=?"));
if (!statement)
return 0;
- statement.BindBlob(0, &icon_data.front(),
- static_cast<int>(icon_data.size()));
+ statement.BindBlob(0, icon_data->front(),
+ static_cast<int>(icon_data->size()));
statement.BindInt64(1, time.ToTimeT());
statement.BindInt64(2, icon_id);
return statement.Run();
diff --git a/chrome/browser/history/thumbnail_database.h b/chrome/browser/history/thumbnail_database.h
index 362edec..fb24357 100644
--- a/chrome/browser/history/thumbnail_database.h
+++ b/chrome/browser/history/thumbnail_database.h
@@ -10,11 +10,13 @@
#include "app/sql/connection.h"
#include "app/sql/init_status.h"
#include "app/sql/meta_table.h"
+#include "base/ref_counted.h"
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/history/url_database.h" // For DBCloseScoper.
#include "chrome/browser/meta_table_helper.h"
class FilePath;
+class RefCountedMemory;
struct ThumbnailScore;
class SkBitmap;
@@ -88,7 +90,7 @@ class ThumbnailDatabase {
// The time indicates the access time, and is used to detect when the favicon
// should be refreshed.
bool SetFavIcon(FavIconID icon_id,
- const std::vector<unsigned char>& icon_data,
+ scoped_refptr<RefCountedMemory> icon_data,
base::Time time);
// Sets the time the favicon was last updated.