diff options
author | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-15 03:28:29 +0000 |
---|---|---|
committer | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-15 03:28:29 +0000 |
commit | 12c7da12c76dfdd58e9a5fc2ed77b319dfd2c96d (patch) | |
tree | c8b03dacda19d343c7dfc33ad72e4c273f808462 /chrome/browser/history | |
parent | e7a8cbd4d4d389e666d5d3c372bb5d09a63b829b (diff) | |
download | chromium_src-12c7da12c76dfdd58e9a5fc2ed77b319dfd2c96d.zip chromium_src-12c7da12c76dfdd58e9a5fc2ed77b319dfd2c96d.tar.gz chromium_src-12c7da12c76dfdd58e9a5fc2ed77b319dfd2c96d.tar.bz2 |
Revert 136812 - Get rid of Image::Image(SkBitmap*)
Bug=124566
Test=Compiles on CrOS,Mac
Review URL: https://chromiumcodereview.appspot.com/10378009
TBR=pkotwicz@chromium.org
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=136813
Review URL: https://chromiumcodereview.appspot.com/10383153
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137068 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history')
-rw-r--r-- | chrome/browser/history/expire_history_backend_unittest.cc | 3 | ||||
-rw-r--r-- | chrome/browser/history/history_backend_unittest.cc | 11 | ||||
-rw-r--r-- | chrome/browser/history/history_tab_helper.cc | 2 | ||||
-rw-r--r-- | chrome/browser/history/top_sites_unittest.cc | 10 |
4 files changed, 15 insertions, 11 deletions
diff --git a/chrome/browser/history/expire_history_backend_unittest.cc b/chrome/browser/history/expire_history_backend_unittest.cc index fffc7f1..40562e1 100644 --- a/chrome/browser/history/expire_history_backend_unittest.cc +++ b/chrome/browser/history/expire_history_backend_unittest.cc @@ -230,8 +230,9 @@ void ExpireHistoryTest::AddExampleData(URLID url_ids[3], Time visit_times[4]) { thumb_db_->AddIconMapping(url_row3.url(), favicon2); // Thumbnails for each URL. |thumbnail| takes ownership of decoded SkBitmap. - gfx::Image thumbnail( + scoped_ptr<SkBitmap> thumbnail_bitmap( gfx::JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail))); + gfx::Image thumbnail(*thumbnail_bitmap); ThumbnailScore score(0.25, true, true, Time::Now()); Time time; diff --git a/chrome/browser/history/history_backend_unittest.cc b/chrome/browser/history/history_backend_unittest.cc index d3f6f0b..c3e0884 100644 --- a/chrome/browser/history/history_backend_unittest.cc +++ b/chrome/browser/history/history_backend_unittest.cc @@ -346,16 +346,19 @@ TEST_F(HistoryBackendTest, DeleteAll) { // Add thumbnails for each page. The |Images| take ownership of SkBitmap // created from decoding the images. ThumbnailScore score(0.25, true, true); - gfx::Image google_bitmap( + scoped_ptr<SkBitmap> google_bitmap( gfx::JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail))); + gfx::Image google_image(*google_bitmap); + Time time; GURL gurl; - backend_->thumbnail_db_->SetPageThumbnail(gurl, row1_id, &google_bitmap, + backend_->thumbnail_db_->SetPageThumbnail(gurl, row1_id, &google_image, score, time); - gfx::Image weewar_bitmap( + scoped_ptr<SkBitmap> weewar_bitmap( gfx::JPEGCodec::Decode(kWeewarThumbnail, sizeof(kWeewarThumbnail))); - backend_->thumbnail_db_->SetPageThumbnail(gurl, row2_id, &weewar_bitmap, + gfx::Image weewar_image(*weewar_bitmap); + backend_->thumbnail_db_->SetPageThumbnail(gurl, row2_id, &weewar_image, score, time); // Star row1. diff --git a/chrome/browser/history/history_tab_helper.cc b/chrome/browser/history/history_tab_helper.cc index 2da50d0..a9eb13c 100644 --- a/chrome/browser/history/history_tab_helper.cc +++ b/chrome/browser/history/history_tab_helper.cc @@ -158,7 +158,7 @@ void HistoryTabHelper::OnThumbnail(const GURL& url, // Tell History about this thumbnail. history::TopSites* ts = profile->GetTopSites(); if (ts) { - gfx::Image thumbnail(new SkBitmap(bitmap)); + gfx::Image thumbnail(bitmap); ts->SetPageThumbnail(url, &thumbnail, score); } } diff --git a/chrome/browser/history/top_sites_unittest.cc b/chrome/browser/history/top_sites_unittest.cc index bdfd045..863bfc6 100644 --- a/chrome/browser/history/top_sites_unittest.cc +++ b/chrome/browser/history/top_sites_unittest.cc @@ -166,11 +166,11 @@ class TopSitesTest : public HistoryUnitTestBase { // Creates a bitmap of the specified color. Caller takes ownership. gfx::Image CreateBitmap(SkColor color) { - SkBitmap* thumbnail = new SkBitmap; - thumbnail->setConfig(SkBitmap::kARGB_8888_Config, 4, 4); - thumbnail->allocPixels(); - thumbnail->eraseColor(color); - return gfx::Image(thumbnail); // takes ownership. + SkBitmap thumbnail; + thumbnail.setConfig(SkBitmap::kARGB_8888_Config, 4, 4); + thumbnail.allocPixels(); + thumbnail.eraseColor(color); + return gfx::Image(thumbnail); // adds ref. } // Forces top sites to load top sites from history, then recreates top sites. |