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

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: 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(), request.speculativePreload(),
Charlie Harrison 2017/02/05 18:39:11 nit: Can you inline /* suppressReport */ here? It
Yoav Weiss 2017/02/06 09:58:35 I agree that currently the call-site is not very c
Charlie Harrison 2017/02/06 19:54:15 Yes an enum sounds good.
159 request.getOriginRestriction()); 159 request.getOriginRestriction());
160 if (blockReason == ResourceRequestBlockedReason::None) 160 if (blockReason == ResourceRequestBlockedReason::None)
161 fetcher->context().sendImagePing(requestURL); 161 fetcher->context().sendImagePing(requestURL);
162 } 162 }
163 return nullptr; 163 return nullptr;
164 } 164 }
165 165
166 ImageResource* resource = toImageResource( 166 ImageResource* resource = toImageResource(
167 fetcher->requestResource(request, ImageResourceFactory(request))); 167 fetcher->requestResource(request, ImageResourceFactory(request)));
168 if (resource && 168 if (resource &&
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 509
510 void ImageResource::updateImage( 510 void ImageResource::updateImage(
511 PassRefPtr<SharedBuffer> sharedBuffer, 511 PassRefPtr<SharedBuffer> sharedBuffer,
512 ImageResourceContent::UpdateImageOption updateImageOption, 512 ImageResourceContent::UpdateImageOption updateImageOption,
513 bool allDataReceived) { 513 bool allDataReceived) {
514 getContent()->updateImage(std::move(sharedBuffer), updateImageOption, 514 getContent()->updateImage(std::move(sharedBuffer), updateImageOption,
515 allDataReceived); 515 allDataReceived);
516 } 516 }
517 517
518 } // namespace blink 518 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698