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

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: Review 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 request.isSpeculativePreload()
160 ? FetchContext::ReportingPolicy::SuppressReporting
161 : FetchContext::ReportingPolicy::Report,
159 request.getOriginRestriction()); 162 request.getOriginRestriction());
160 if (blockReason == ResourceRequestBlockedReason::None) 163 if (blockReason == ResourceRequestBlockedReason::None)
161 fetcher->context().sendImagePing(requestURL); 164 fetcher->context().sendImagePing(requestURL);
162 } 165 }
163 return nullptr; 166 return nullptr;
164 } 167 }
165 168
166 ImageResource* resource = toImageResource( 169 ImageResource* resource = toImageResource(
167 fetcher->requestResource(request, ImageResourceFactory(request))); 170 fetcher->requestResource(request, ImageResourceFactory(request)));
168 if (resource && 171 if (resource &&
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 512
510 void ImageResource::updateImage( 513 void ImageResource::updateImage(
511 PassRefPtr<SharedBuffer> sharedBuffer, 514 PassRefPtr<SharedBuffer> sharedBuffer,
512 ImageResourceContent::UpdateImageOption updateImageOption, 515 ImageResourceContent::UpdateImageOption updateImageOption,
513 bool allDataReceived) { 516 bool allDataReceived) {
514 getContent()->updateImage(std::move(sharedBuffer), updateImageOption, 517 getContent()->updateImage(std::move(sharedBuffer), updateImageOption,
515 allDataReceived); 518 allDataReceived);
516 } 519 }
517 520
518 } // namespace blink 521 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698