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

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoder.cpp

Issue 2470233009: WTF/std normalization: replace WTF::Vector::first() with ::front() (Closed)
Patch Set: rebase Created 4 years 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 /* 1 /*
2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved. 2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 DEFINE_THREAD_SAFE_STATIC_LOCAL( 274 DEFINE_THREAD_SAFE_STATIC_LOCAL(
275 blink::CustomCountHistogram, dimensionsLocationHistogram, 275 blink::CustomCountHistogram, dimensionsLocationHistogram,
276 new blink::CustomCountHistogram( 276 new blink::CustomCountHistogram(
277 "Blink.DecodedImage.EffectiveDimensionsLocation.ICO", 0, 50000, 50)); 277 "Blink.DecodedImage.EffectiveDimensionsLocation.ICO", 0, 50000, 50));
278 dimensionsLocationHistogram.count(m_decodedOffset - 1); 278 dimensionsLocationHistogram.count(m_decodedOffset - 1);
279 279
280 // Arrange frames in decreasing quality order. 280 // Arrange frames in decreasing quality order.
281 std::sort(m_dirEntries.begin(), m_dirEntries.end(), compareEntries); 281 std::sort(m_dirEntries.begin(), m_dirEntries.end(), compareEntries);
282 282
283 // The image size is the size of the largest entry. 283 // The image size is the size of the largest entry.
284 const IconDirectoryEntry& dirEntry = m_dirEntries.first(); 284 const IconDirectoryEntry& dirEntry = m_dirEntries.front();
285 // Technically, this next call shouldn't be able to fail, since the width 285 // Technically, this next call shouldn't be able to fail, since the width
286 // and height here are each <= 256, and |m_frameSize| is empty. 286 // and height here are each <= 256, and |m_frameSize| is empty.
287 return setSize(dirEntry.m_size.width(), dirEntry.m_size.height()); 287 return setSize(dirEntry.m_size.width(), dirEntry.m_size.height());
288 } 288 }
289 289
290 ICOImageDecoder::IconDirectoryEntry ICOImageDecoder::readDirectoryEntry() { 290 ICOImageDecoder::IconDirectoryEntry ICOImageDecoder::readDirectoryEntry() {
291 // Read icon data. 291 // Read icon data.
292 // The following calls to readUint8() return a uint8_t, which is appropriate 292 // The following calls to readUint8() return a uint8_t, which is appropriate
293 // because that's the on-disk type of the width and height values. Storing 293 // because that's the on-disk type of the width and height values. Storing
294 // them in ints (instead of matching uint8_ts) is so we can record dimensions 294 // them in ints (instead of matching uint8_ts) is so we can record dimensions
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 SECURITY_DCHECK(index < m_dirEntries.size()); 333 SECURITY_DCHECK(index < m_dirEntries.size());
334 const uint32_t imageOffset = m_dirEntries[index].m_imageOffset; 334 const uint32_t imageOffset = m_dirEntries[index].m_imageOffset;
335 if ((imageOffset > m_data->size()) || ((m_data->size() - imageOffset) < 4)) 335 if ((imageOffset > m_data->size()) || ((m_data->size() - imageOffset) < 4))
336 return Unknown; 336 return Unknown;
337 char buffer[4]; 337 char buffer[4];
338 const char* data = m_fastReader.getConsecutiveData(imageOffset, 4, buffer); 338 const char* data = m_fastReader.getConsecutiveData(imageOffset, 4, buffer);
339 return strncmp(data, "\x89PNG", 4) ? BMP : PNG; 339 return strncmp(data, "\x89PNG", 4) ? BMP : PNG;
340 } 340 }
341 341
342 } // namespace blink 342 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698