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

Side by Side Diff: chrome/browser/favicon/favicon_service.cc

Issue 421633002: Modify a favicon DCHECK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re-add DCHECK but with modification. Created 6 years, 4 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/favicon/favicon_service.h" 5 #include "chrome/browser/favicon/favicon_service.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/hash.h" 9 #include "base/hash.h"
10 #include "base/message_loop/message_loop_proxy.h" 10 #include "base/message_loop/message_loop_proxy.h"
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 void FaviconService::RunFaviconRawBitmapCallbackWithBitmapResults( 396 void FaviconService::RunFaviconRawBitmapCallbackWithBitmapResults(
397 const favicon_base::FaviconRawBitmapCallback& callback, 397 const favicon_base::FaviconRawBitmapCallback& callback,
398 int desired_size_in_pixel, 398 int desired_size_in_pixel,
399 const std::vector<favicon_base::FaviconRawBitmapResult>& 399 const std::vector<favicon_base::FaviconRawBitmapResult>&
400 favicon_bitmap_results) { 400 favicon_bitmap_results) {
401 if (favicon_bitmap_results.empty() || !favicon_bitmap_results[0].is_valid()) { 401 if (favicon_bitmap_results.empty() || !favicon_bitmap_results[0].is_valid()) {
402 callback.Run(favicon_base::FaviconRawBitmapResult()); 402 callback.Run(favicon_base::FaviconRawBitmapResult());
403 return; 403 return;
404 } 404 }
405 405
406 DCHECK_EQ(1u, favicon_bitmap_results.size()); 406 DCHECK_LE(1u, favicon_bitmap_results.size());
stevenjb 2014/07/25 18:45:19 We early exit above if favicon_bitmap_results.empt
stevenjb 2014/07/25 18:47:31 I *think* (it's been a long time) was that the exp
Daniel Nishi 2014/07/25 21:13:37 Yeah, you're right. I've changed it back to the re
407 favicon_base::FaviconRawBitmapResult bitmap_result = 407 favicon_base::FaviconRawBitmapResult bitmap_result =
408 favicon_bitmap_results[0]; 408 favicon_bitmap_results[0];
409 409
410 // If the desired size is 0, SelectFaviconFrames() will return the largest 410 // If the desired size is 0, SelectFaviconFrames() will return the largest
411 // bitmap without doing any resizing. As |favicon_bitmap_results| has bitmap 411 // bitmap without doing any resizing. As |favicon_bitmap_results| has bitmap
412 // data for a single bitmap, return it and avoid an unnecessary decode. 412 // data for a single bitmap, return it and avoid an unnecessary decode.
413 if (desired_size_in_pixel == 0) { 413 if (desired_size_in_pixel == 0) {
414 callback.Run(bitmap_result); 414 callback.Run(bitmap_result);
415 return; 415 return;
416 } 416 }
(...skipping 16 matching lines...) Expand all
433 if (!gfx::PNGCodec::EncodeBGRASkBitmap(resized_image.AsBitmap(), false, 433 if (!gfx::PNGCodec::EncodeBGRASkBitmap(resized_image.AsBitmap(), false,
434 &resized_bitmap_data)) { 434 &resized_bitmap_data)) {
435 callback.Run(favicon_base::FaviconRawBitmapResult()); 435 callback.Run(favicon_base::FaviconRawBitmapResult());
436 return; 436 return;
437 } 437 }
438 438
439 bitmap_result.bitmap_data = base::RefCountedBytes::TakeVector( 439 bitmap_result.bitmap_data = base::RefCountedBytes::TakeVector(
440 &resized_bitmap_data); 440 &resized_bitmap_data);
441 callback.Run(bitmap_result); 441 callback.Run(bitmap_result);
442 } 442 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698