OLD | NEW |
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 21 matching lines...) Expand all Loading... |
32 #include "core/svg/graphics/SVGImage.h" | 32 #include "core/svg/graphics/SVGImage.h" |
33 #include "platform/Logging.h" | 33 #include "platform/Logging.h" |
34 #include "platform/RuntimeEnabledFeatures.h" | 34 #include "platform/RuntimeEnabledFeatures.h" |
35 #include "platform/SharedBuffer.h" | 35 #include "platform/SharedBuffer.h" |
36 #include "platform/TraceEvent.h" | 36 #include "platform/TraceEvent.h" |
37 #include "platform/graphics/BitmapImage.h" | 37 #include "platform/graphics/BitmapImage.h" |
38 #include "public/platform/Platform.h" | 38 #include "public/platform/Platform.h" |
39 #include "public/platform/WebCachePolicy.h" | 39 #include "public/platform/WebCachePolicy.h" |
40 #include "wtf/CurrentTime.h" | 40 #include "wtf/CurrentTime.h" |
41 #include "wtf/StdLibExtras.h" | 41 #include "wtf/StdLibExtras.h" |
42 #include <memory> | |
43 | 42 |
44 namespace blink { | 43 namespace blink { |
45 | 44 |
46 using ImageResourceObserverWalker = ResourceClientOrObserverWalker<ImageResource
Observer, ImageResourceObserver>; | 45 using ImageResourceObserverWalker = ResourceClientOrObserverWalker<ImageResource
Observer, ImageResourceObserver>; |
47 | 46 |
48 ImageResource* ImageResource::fetch(FetchRequest& request, ResourceFetcher* fetc
her) | 47 ImageResource* ImageResource::fetch(FetchRequest& request, ResourceFetcher* fetc
her) |
49 { | 48 { |
50 if (request.resourceRequest().requestContext() == WebURLRequest::RequestCont
extUnspecified) | 49 if (request.resourceRequest().requestContext() == WebURLRequest::RequestCont
extUnspecified) |
51 request.mutableResourceRequest().setRequestContext(WebURLRequest::Reques
tContextImage); | 50 request.mutableResourceRequest().setRequestContext(WebURLRequest::Reques
tContextImage); |
52 if (fetcher->context().pageDismissalEventBeingDispatched()) { | 51 if (fetcher->context().pageDismissalEventBeingDispatched()) { |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 | 399 |
401 void ImageResource::error(const ResourceError& error) | 400 void ImageResource::error(const ResourceError& error) |
402 { | 401 { |
403 if (m_multipartParser) | 402 if (m_multipartParser) |
404 m_multipartParser->cancel(); | 403 m_multipartParser->cancel(); |
405 clear(); | 404 clear(); |
406 Resource::error(error); | 405 Resource::error(error); |
407 notifyObservers(); | 406 notifyObservers(); |
408 } | 407 } |
409 | 408 |
410 void ImageResource::responseReceived(const ResourceResponse& response, std::uniq
ue_ptr<WebDataConsumerHandle> handle) | 409 void ImageResource::responseReceived(const ResourceResponse& response, PassOwnPt
r<WebDataConsumerHandle> handle) |
411 { | 410 { |
412 ASSERT(!handle); | 411 ASSERT(!handle); |
413 ASSERT(!m_multipartParser); | 412 ASSERT(!m_multipartParser); |
414 // If there's no boundary, just handle the request normally. | 413 // If there's no boundary, just handle the request normally. |
415 if (response.isMultipart() && !response.multipartBoundary().isEmpty()) | 414 if (response.isMultipart() && !response.multipartBoundary().isEmpty()) |
416 m_multipartParser = new MultipartImageResourceParser(response, response.
multipartBoundary(), this); | 415 m_multipartParser = new MultipartImageResourceParser(response, response.
multipartBoundary(), this); |
417 Resource::responseReceived(response, std::move(handle)); | 416 Resource::responseReceived(response, std::move(handle)); |
418 if (RuntimeEnabledFeatures::clientHintsEnabled()) { | 417 if (RuntimeEnabledFeatures::clientHintsEnabled()) { |
419 m_devicePixelRatioHeaderValue = m_response.httpHeaderField(HTTPNames::Co
ntent_DPR).toFloat(&m_hasDevicePixelRatioHeaderValue); | 418 m_devicePixelRatioHeaderValue = m_response.httpHeaderField(HTTPNames::Co
ntent_DPR).toFloat(&m_hasDevicePixelRatioHeaderValue); |
420 if (!m_hasDevicePixelRatioHeaderValue || m_devicePixelRatioHeaderValue <
= 0.0) { | 419 if (!m_hasDevicePixelRatioHeaderValue || m_devicePixelRatioHeaderValue <
= 0.0) { |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 if (response().wasFetchedViaServiceWorker()) | 550 if (response().wasFetchedViaServiceWorker()) |
552 return response().serviceWorkerResponseType() != WebServiceWorkerRespons
eTypeOpaque; | 551 return response().serviceWorkerResponseType() != WebServiceWorkerRespons
eTypeOpaque; |
553 if (!getImage()->currentFrameHasSingleSecurityOrigin()) | 552 if (!getImage()->currentFrameHasSingleSecurityOrigin()) |
554 return false; | 553 return false; |
555 if (passesAccessControlCheck(securityOrigin)) | 554 if (passesAccessControlCheck(securityOrigin)) |
556 return true; | 555 return true; |
557 return !securityOrigin->taintsCanvas(response().url()); | 556 return !securityOrigin->taintsCanvas(response().url()); |
558 } | 557 } |
559 | 558 |
560 } // namespace blink | 559 } // namespace blink |
OLD | NEW |