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

Side by Side Diff: content/renderer/image_downloader/image_downloader_impl.cc

Issue 2119283002: Use container::back() and container::pop_back() for content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/renderer/image_downloader/image_downloader_impl.h" 5 #include "content/renderer/image_downloader/image_downloader_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // in a box of size |max_image_size|. 71 // in a box of size |max_image_size|.
72 // Sets |original_image_sizes| to the sizes of |images| before resizing. 72 // Sets |original_image_sizes| to the sizes of |images| before resizing.
73 void FilterAndResizeImagesForMaximalSize( 73 void FilterAndResizeImagesForMaximalSize(
74 const std::vector<SkBitmap>& unfiltered, 74 const std::vector<SkBitmap>& unfiltered,
75 uint32_t max_image_size, 75 uint32_t max_image_size,
76 std::vector<SkBitmap>* images, 76 std::vector<SkBitmap>* images,
77 std::vector<gfx::Size>* original_image_sizes) { 77 std::vector<gfx::Size>* original_image_sizes) {
78 images->clear(); 78 images->clear();
79 original_image_sizes->clear(); 79 original_image_sizes->clear();
80 80
81 if (!unfiltered.size()) 81 if (unfiltered.empty())
82 return; 82 return;
83 83
84 if (max_image_size == 0) 84 if (max_image_size == 0)
85 max_image_size = std::numeric_limits<uint32_t>::max(); 85 max_image_size = std::numeric_limits<uint32_t>::max();
86 86
87 const SkBitmap* min_image = NULL; 87 const SkBitmap* min_image = NULL;
88 uint32_t min_image_size = std::numeric_limits<uint32_t>::max(); 88 uint32_t min_image_size = std::numeric_limits<uint32_t>::max();
89 // Filter the images by |max_image_size|, and also identify the smallest image 89 // Filter the images by |max_image_size|, and also identify the smallest image
90 // in case all the images are bigger than |max_image_size|. 90 // in case all the images are bigger than |max_image_size|.
91 for (std::vector<SkBitmap>::const_iterator it = unfiltered.begin(); 91 for (std::vector<SkBitmap>::const_iterator it = unfiltered.begin();
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 const DownloadImageCallback& callback) { 219 const DownloadImageCallback& callback) {
220 callback.Run(http_status_code, mojo::Array<SkBitmap>::From(result_images), 220 callback.Run(http_status_code, mojo::Array<SkBitmap>::From(result_images),
221 result_original_image_sizes); 221 result_original_image_sizes);
222 } 222 }
223 223
224 void ImageDownloaderImpl::OnDestruct() { 224 void ImageDownloaderImpl::OnDestruct() {
225 delete this; 225 delete this;
226 } 226 }
227 227
228 } // namespace content 228 } // namespace content
OLDNEW
« no previous file with comments | « content/child/indexed_db/webidbcursor_impl.cc ('k') | content/renderer/pepper/pepper_plugin_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698