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

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

Issue 2676163002: Refactor the forPreload flag to mean speculative preload. (Closed)
Patch Set: Renamed ReportingPolicy and moved comments Created 3 years, 10 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 /* 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 if (request.resourceRequest().requestContext() == 148 if (request.resourceRequest().requestContext() ==
149 WebURLRequest::RequestContextUnspecified) { 149 WebURLRequest::RequestContextUnspecified) {
150 request.mutableResourceRequest().setRequestContext( 150 request.mutableResourceRequest().setRequestContext(
151 WebURLRequest::RequestContextImage); 151 WebURLRequest::RequestContextImage);
152 } 152 }
153 if (fetcher->context().pageDismissalEventBeingDispatched()) { 153 if (fetcher->context().pageDismissalEventBeingDispatched()) {
154 KURL requestURL = request.resourceRequest().url(); 154 KURL requestURL = request.resourceRequest().url();
155 if (requestURL.isValid()) { 155 if (requestURL.isValid()) {
156 ResourceRequestBlockedReason blockReason = fetcher->context().canRequest( 156 ResourceRequestBlockedReason blockReason = fetcher->context().canRequest(
157 Resource::Image, request.resourceRequest(), requestURL, 157 Resource::Image, request.resourceRequest(), requestURL,
158 request.options(), request.forPreload(), 158 request.options(),
159 /* Don't send security violation reports for speculative preloads */
160 request.isSpeculativePreload()
161 ? FetchContext::SecurityViolationReportingPolicy::
162 SuppressReporting
163 : FetchContext::SecurityViolationReportingPolicy::Report,
159 request.getOriginRestriction()); 164 request.getOriginRestriction());
160 if (blockReason == ResourceRequestBlockedReason::None) 165 if (blockReason == ResourceRequestBlockedReason::None)
161 fetcher->context().sendImagePing(requestURL); 166 fetcher->context().sendImagePing(requestURL);
162 } 167 }
163 return nullptr; 168 return nullptr;
164 } 169 }
165 170
166 ImageResource* resource = toImageResource( 171 ImageResource* resource = toImageResource(
167 fetcher->requestResource(request, ImageResourceFactory(request))); 172 fetcher->requestResource(request, ImageResourceFactory(request)));
168 if (resource && 173 if (resource &&
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 514
510 void ImageResource::updateImage( 515 void ImageResource::updateImage(
511 PassRefPtr<SharedBuffer> sharedBuffer, 516 PassRefPtr<SharedBuffer> sharedBuffer,
512 ImageResourceContent::UpdateImageOption updateImageOption, 517 ImageResourceContent::UpdateImageOption updateImageOption,
513 bool allDataReceived) { 518 bool allDataReceived) {
514 getContent()->updateImage(std::move(sharedBuffer), updateImageOption, 519 getContent()->updateImage(std::move(sharedBuffer), updateImageOption,
515 allDataReceived); 520 allDataReceived);
516 } 521 }
517 522
518 } // namespace blink 523 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698