| 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 26 matching lines...) Expand all Loading... |
| 37 #include "platform/graphics/BitmapImage.h" | 37 #include "platform/graphics/BitmapImage.h" |
| 38 #include "wtf/CurrentTime.h" | 38 #include "wtf/CurrentTime.h" |
| 39 #include "wtf/StdLibExtras.h" | 39 #include "wtf/StdLibExtras.h" |
| 40 #include "wtf/Vector.h" | 40 #include "wtf/Vector.h" |
| 41 | 41 |
| 42 namespace WebCore { | 42 namespace WebCore { |
| 43 | 43 |
| 44 ImageResource::ImageResource(const ResourceRequest& resourceRequest) | 44 ImageResource::ImageResource(const ResourceRequest& resourceRequest) |
| 45 : Resource(resourceRequest, Image) | 45 : Resource(resourceRequest, Image) |
| 46 , m_devicePixelRatioHeaderValue(1.0) | 46 , m_devicePixelRatioHeaderValue(1.0) |
| 47 , m_image(0) | 47 , m_image(nullptr) |
| 48 , m_loadingMultipartContent(false) | 48 , m_loadingMultipartContent(false) |
| 49 , m_hasDevicePixelRatioHeaderValue(false) | 49 , m_hasDevicePixelRatioHeaderValue(false) |
| 50 { | 50 { |
| 51 setStatus(Unknown); | 51 setStatus(Unknown); |
| 52 setCustomAcceptHeader(); | 52 setCustomAcceptHeader(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 ImageResource::ImageResource(WebCore::Image* image) | 55 ImageResource::ImageResource(WebCore::Image* image) |
| 56 : Resource(ResourceRequest(""), Image) | 56 : Resource(ResourceRequest(""), Image) |
| 57 , m_image(image) | 57 , m_image(image) |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 } | 121 } |
| 122 | 122 |
| 123 bool ImageResource::isSafeToUnlock() const | 123 bool ImageResource::isSafeToUnlock() const |
| 124 { | 124 { |
| 125 return !m_image || (m_image->hasOneRef() && m_image->isBitmapImage()); | 125 return !m_image || (m_image->hasOneRef() && m_image->isBitmapImage()); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void ImageResource::destroyDecodedDataIfPossible() | 128 void ImageResource::destroyDecodedDataIfPossible() |
| 129 { | 129 { |
| 130 if (isSafeToUnlock() && !hasClients() && !isLoading()) { | 130 if (isSafeToUnlock() && !hasClients() && !isLoading()) { |
| 131 m_image = 0; | 131 m_image = nullptr; |
| 132 setDecodedSize(0); | 132 setDecodedSize(0); |
| 133 } else if (m_image && !errorOccurred()) { | 133 } else if (m_image && !errorOccurred()) { |
| 134 m_image->destroyDecodedData(true); | 134 m_image->destroyDecodedData(true); |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 | 137 |
| 138 void ImageResource::allClientsRemoved() | 138 void ImageResource::allClientsRemoved() |
| 139 { | 139 { |
| 140 m_pendingContainerSizeRequests.clear(); | 140 m_pendingContainerSizeRequests.clear(); |
| 141 if (m_image && !errorOccurred()) | 141 if (m_image && !errorOccurred()) |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 bool ImageResource::isAccessAllowed(SecurityOrigin* securityOrigin) | 462 bool ImageResource::isAccessAllowed(SecurityOrigin* securityOrigin) |
| 463 { | 463 { |
| 464 if (!image()->currentFrameHasSingleSecurityOrigin()) | 464 if (!image()->currentFrameHasSingleSecurityOrigin()) |
| 465 return false; | 465 return false; |
| 466 if (passesAccessControlCheck(securityOrigin)) | 466 if (passesAccessControlCheck(securityOrigin)) |
| 467 return true; | 467 return true; |
| 468 return !securityOrigin->taintsCanvas(response().url()); | 468 return !securityOrigin->taintsCanvas(response().url()); |
| 469 } | 469 } |
| 470 | 470 |
| 471 } // namespace WebCore | 471 } // namespace WebCore |
| OLD | NEW |