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

Side by Side Diff: third_party/WebKit/Source/core/loader/resource/ImageResource.cpp

Issue 2484633004: Change Lo-Fi bool to bitmask to support multiple Previews types (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) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 .toFloat(&m_hasDevicePixelRatioHeaderValue); 389 .toFloat(&m_hasDevicePixelRatioHeaderValue);
390 if (!m_hasDevicePixelRatioHeaderValue || 390 if (!m_hasDevicePixelRatioHeaderValue ||
391 m_devicePixelRatioHeaderValue <= 0.0) { 391 m_devicePixelRatioHeaderValue <= 0.0) {
392 m_devicePixelRatioHeaderValue = 1.0; 392 m_devicePixelRatioHeaderValue = 1.0;
393 m_hasDevicePixelRatioHeaderValue = false; 393 m_hasDevicePixelRatioHeaderValue = false;
394 } 394 }
395 } 395 }
396 } 396 }
397 397
398 static bool isLoFiImage(const ImageResource& resource) { 398 static bool isLoFiImage(const ImageResource& resource) {
399 if (resource.resourceRequest().loFiState() != WebURLRequest::LoFiOn) 399 if (!(resource.resourceRequest().previewsState() &
400 WebURLRequest::ServerLoFiOn)) {
400 return false; 401 return false;
402 }
401 return !resource.isLoaded() || 403 return !resource.isLoaded() ||
402 resource.response() 404 resource.response()
403 .httpHeaderField("chrome-proxy-content-transform") 405 .httpHeaderField("chrome-proxy-content-transform")
404 .contains("empty-image"); 406 .contains("empty-image");
405 } 407 }
406 408
407 void ImageResource::reloadIfLoFiOrPlaceholderImage( 409 void ImageResource::reloadIfLoFiOrPlaceholderImage(
408 ResourceFetcher* fetcher, 410 ResourceFetcher* fetcher,
409 ReloadLoFiOrPlaceholderPolicy policy) { 411 ReloadLoFiOrPlaceholderPolicy policy) {
410 if (policy == kReloadIfNeeded && !shouldReloadBrokenPlaceholder()) 412 if (policy == kReloadIfNeeded && !shouldReloadBrokenPlaceholder())
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 504
503 const ImageResourceContent* ImageResource::getContent() const { 505 const ImageResourceContent* ImageResource::getContent() const {
504 return m_content; 506 return m_content;
505 } 507 }
506 508
507 ResourcePriority ImageResource::priorityFromObservers() { 509 ResourcePriority ImageResource::priorityFromObservers() {
508 return getContent()->priorityFromObservers(); 510 return getContent()->priorityFromObservers();
509 } 511 }
510 512
511 } // namespace blink 513 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698