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