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

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

Issue 2795073003: Treat responses with LoFi headers as being LoFi images. (Closed)
Patch Set: addressed comments Created 3 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 | third_party/WebKit/Source/core/loader/resource/ImageResourceTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 case PlaceholderOption::ReloadPlaceholderOnDecodeError: 452 case PlaceholderOption::ReloadPlaceholderOnDecodeError:
453 return getStatus() == ResourceStatus::DecodeError; 453 return getStatus() == ResourceStatus::DecodeError;
454 case PlaceholderOption::DoNotReloadPlaceholder: 454 case PlaceholderOption::DoNotReloadPlaceholder:
455 return false; 455 return false;
456 } 456 }
457 NOTREACHED(); 457 NOTREACHED();
458 return false; 458 return false;
459 } 459 }
460 460
461 static bool isLoFiImage(const ImageResource& resource) { 461 static bool isLoFiImage(const ImageResource& resource) {
462 if (!(resource.resourceRequest().previewsState() & 462 if (resource.isLoaded()) {
463 WebURLRequest::ServerLoFiOn)) { 463 return resource.response()
464 return false; 464 .httpHeaderField("chrome-proxy-content-transform")
465 .contains("empty-image");
465 } 466 }
466 return !resource.isLoaded() || 467 return resource.resourceRequest().previewsState() &
467 resource.response() 468 WebURLRequest::ServerLoFiOn;
468 .httpHeaderField("chrome-proxy-content-transform")
469 .contains("empty-image");
470 } 469 }
471 470
472 void ImageResource::reloadIfLoFiOrPlaceholderImage( 471 void ImageResource::reloadIfLoFiOrPlaceholderImage(
473 ResourceFetcher* fetcher, 472 ResourceFetcher* fetcher,
474 ReloadLoFiOrPlaceholderPolicy policy) { 473 ReloadLoFiOrPlaceholderPolicy policy) {
475 if (policy == kReloadIfNeeded && !shouldReloadBrokenPlaceholder()) 474 if (policy == kReloadIfNeeded && !shouldReloadBrokenPlaceholder())
476 return; 475 return;
477 476
478 if (m_placeholderOption == PlaceholderOption::DoNotReloadPlaceholder && 477 if (m_placeholderOption == PlaceholderOption::DoNotReloadPlaceholder &&
479 !isLoFiImage(*this)) 478 !isLoFiImage(*this))
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 // reloading in Step 3 due to notifyObservers()'s 591 // reloading in Step 3 due to notifyObservers()'s
593 // schedulingReloadOrShouldReloadBrokenPlaceholder() check. 592 // schedulingReloadOrShouldReloadBrokenPlaceholder() check.
594 // 3. reloadIfLoFiOrPlaceholderImage() is called via ResourceFetcher 593 // 3. reloadIfLoFiOrPlaceholderImage() is called via ResourceFetcher
595 // (a) via didFinishLoading() called in decodeError(), or 594 // (a) via didFinishLoading() called in decodeError(), or
596 // (b) after returning ImageResource::updateImage(). 595 // (b) after returning ImageResource::updateImage().
597 decodeError(allDataReceived); 596 decodeError(allDataReceived);
598 } 597 }
599 } 598 }
600 599
601 } // namespace blink 600 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/loader/resource/ImageResourceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698