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

Side by Side Diff: chrome/browser/android/ntp/most_visited_sites.cc

Issue 1879443002: JPEG decoding: replace ownership comments with std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fixes Created 4 years, 8 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
« no previous file with comments | « no previous file | components/suggestions/image_encoder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/android/ntp/most_visited_sites.h" 5 #include "chrome/browser/android/ntp/most_visited_sites.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 NUM_TILE_TYPES, 86 NUM_TILE_TYPES,
87 }; 87 };
88 88
89 std::unique_ptr<SkBitmap> MaybeFetchLocalThumbnail( 89 std::unique_ptr<SkBitmap> MaybeFetchLocalThumbnail(
90 const GURL& url, 90 const GURL& url,
91 const scoped_refptr<TopSites>& top_sites) { 91 const scoped_refptr<TopSites>& top_sites) {
92 DCHECK_CURRENTLY_ON(BrowserThread::DB); 92 DCHECK_CURRENTLY_ON(BrowserThread::DB);
93 scoped_refptr<base::RefCountedMemory> image; 93 scoped_refptr<base::RefCountedMemory> image;
94 std::unique_ptr<SkBitmap> bitmap; 94 std::unique_ptr<SkBitmap> bitmap;
95 if (top_sites && top_sites->GetPageThumbnail(url, false, &image)) 95 if (top_sites && top_sites->GetPageThumbnail(url, false, &image))
96 bitmap.reset(gfx::JPEGCodec::Decode(image->front(), image->size())); 96 bitmap = gfx::JPEGCodec::Decode(image->front(), image->size());
97 return bitmap; 97 return bitmap;
98 } 98 }
99 99
100 // Log an event for a given |histogram| at a given element |position|. This 100 // Log an event for a given |histogram| at a given element |position|. This
101 // routine exists because regular histogram macros are cached thus can't be used 101 // routine exists because regular histogram macros are cached thus can't be used
102 // if the name of the histogram will change at a given call site. 102 // if the name of the histogram will change at a given call site.
103 void LogHistogramEvent(const std::string& histogram, 103 void LogHistogramEvent(const std::string& histogram,
104 int position, 104 int position,
105 int num_sites) { 105 int num_sites) {
106 base::HistogramBase* counter = base::LinearHistogram::FactoryGet( 106 base::HistogramBase* counter = base::LinearHistogram::FactoryGet(
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 } 871 }
872 } 872 }
873 873
874 static jlong Init(JNIEnv* env, 874 static jlong Init(JNIEnv* env,
875 const JavaParamRef<jobject>& obj, 875 const JavaParamRef<jobject>& obj,
876 const JavaParamRef<jobject>& jprofile) { 876 const JavaParamRef<jobject>& jprofile) {
877 MostVisitedSites* most_visited_sites = 877 MostVisitedSites* most_visited_sites =
878 new MostVisitedSites(ProfileAndroid::FromProfileAndroid(jprofile)); 878 new MostVisitedSites(ProfileAndroid::FromProfileAndroid(jprofile));
879 return reinterpret_cast<intptr_t>(most_visited_sites); 879 return reinterpret_cast<intptr_t>(most_visited_sites);
880 } 880 }
OLDNEW
« no previous file with comments | « no previous file | components/suggestions/image_encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698