Chromium Code Reviews| 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) 2006 Samuel Weinig (sam.weinig@gmail.com) | 4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 5 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 5 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
| 6 | 6 |
| 7 This library is free software; you can redistribute it and/or | 7 This library is free software; you can redistribute it and/or |
| 8 modify it under the terms of the GNU Library General Public | 8 modify it under the terms of the GNU Library General Public |
| 9 License as published by the Free Software Foundation; either | 9 License as published by the Free Software Foundation; either |
| 10 version 2 of the License, or (at your option) any later version. | 10 version 2 of the License, or (at your option) any later version. |
| 11 | 11 |
| 12 This library is distributed in the hope that it will be useful, | 12 This library is distributed in the hope that it will be useful, |
| 13 but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 Library General Public License for more details. | 15 Library General Public License for more details. |
| 16 | 16 |
| 17 You should have received a copy of the GNU Library General Public License | 17 You should have received a copy of the GNU Library General Public License |
| 18 along with this library; see the file COPYING.LIB. If not, write to | 18 along with this library; see the file COPYING.LIB. If not, write to |
| 19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 20 Boston, MA 02110-1301, USA. | 20 Boston, MA 02110-1301, USA. |
| 21 */ | 21 */ |
| 22 | 22 |
| 23 #ifndef ImageResource_h | 23 #ifndef ImageResource_h |
| 24 #define ImageResource_h | 24 #define ImageResource_h |
| 25 | 25 |
| 26 #include "core/CoreExport.h" | 26 #include "core/CoreExport.h" |
| 27 #include "core/fetch/ImageResourceContent.h" | |
|
hajimehoshi
2016/12/06 07:26:00
I couldn't find this file.
| |
| 27 #include "core/fetch/MultipartImageResourceParser.h" | 28 #include "core/fetch/MultipartImageResourceParser.h" |
| 28 #include "core/fetch/Resource.h" | 29 #include "core/fetch/Resource.h" |
| 29 #include <memory> | 30 #include <memory> |
| 30 | 31 |
| 31 namespace blink { | 32 namespace blink { |
| 32 | 33 |
| 33 class FetchRequest; | 34 class FetchRequest; |
| 34 class ResourceClient; | 35 class ResourceClient; |
| 35 class ResourceFetcher; | 36 class ResourceFetcher; |
| 36 class SecurityOrigin; | 37 class SecurityOrigin; |
| 37 class ImageResourceContent; | |
| 38 | 38 |
| 39 // ImageResource is the resource-related part of image loading. | 39 // ImageResource is the resource-related part of image loading. |
| 40 // Image-related things (blink::Image and ImageResourceObserver) are handled by | 40 // Image-related things (blink::Image and ImageResourceObserver) are handled by |
| 41 // ImageResourceContent. | 41 // ImageResourceContent. |
| 42 // Most users should use ImageResourceContent instead of ImageResource. | 42 // Most users should use ImageResourceContent instead of ImageResource. |
| 43 // https://docs.google.com/document/d/1O-fB83mrE0B_V8gzXNqHgmRLCvstTB4MMi3RnVLr8 bE/edit?usp=sharing | 43 // https://docs.google.com/document/d/1O-fB83mrE0B_V8gzXNqHgmRLCvstTB4MMi3RnVLr8 bE/edit?usp=sharing |
| 44 // | 44 // |
| 45 // As for the lifetimes of ImageResourceContent::m_image and m_data, see this | 45 // As for the lifetimes of ImageResourceContent::m_image and m_data, see this |
| 46 // document: | 46 // document: |
| 47 // https://docs.google.com/document/d/1v0yTAZ6wkqX2U_M6BNIGUJpM1s0TIw1VsqpxoL7ac iY/edit?usp=sharing | 47 // https://docs.google.com/document/d/1v0yTAZ6wkqX2U_M6BNIGUJpM1s0TIw1VsqpxoL7ac iY/edit?usp=sharing |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 | 128 |
| 129 bool hasClientsOrObservers() const override; | 129 bool hasClientsOrObservers() const override; |
| 130 | 130 |
| 131 void updateImageAndClearBuffer(); | 131 void updateImageAndClearBuffer(); |
| 132 | 132 |
| 133 void checkNotify() override; | 133 void checkNotify() override; |
| 134 | 134 |
| 135 void destroyDecodedDataIfPossible() override; | 135 void destroyDecodedDataIfPossible() override; |
| 136 void destroyDecodedDataForFailedRevalidation() override; | 136 void destroyDecodedDataForFailedRevalidation() override; |
| 137 | 137 |
| 138 // When ClearImageOption is KeepExistingImage but this is the first | |
| 139 // updateImage() call, then ClearExistingImage is used instead to enforce | |
| 140 // new image creation. | |
| 141 void updateImage(PassRefPtr<SharedBuffer>, | |
| 142 ImageResourceContent::ClearImageOption, | |
| 143 bool allDataReceived); | |
| 138 void flushImageIfNeeded(TimerBase*); | 144 void flushImageIfNeeded(TimerBase*); |
| 139 | 145 |
| 140 bool willPaintBrokenImage() const; | 146 bool willPaintBrokenImage() const; |
| 141 | 147 |
| 142 Member<ImageResourceContent> m_content; | 148 Member<ImageResourceContent> m_content; |
| 143 | 149 |
| 150 // Indicates whether updateImage() is called for this resource, or for this | |
| 151 // part (in case of multipart images), and is used for enforcing creation of | |
| 152 // new blink::Image in ImageResourceContent for the first updateImage(). | |
| 153 bool m_isUpdateImageCalled = false; | |
| 154 | |
| 144 float m_devicePixelRatioHeaderValue; | 155 float m_devicePixelRatioHeaderValue; |
| 145 | 156 |
| 146 Member<MultipartImageResourceParser> m_multipartParser; | 157 Member<MultipartImageResourceParser> m_multipartParser; |
| 147 MultipartParsingState m_multipartParsingState = | 158 MultipartParsingState m_multipartParsingState = |
| 148 MultipartParsingState::WaitingForFirstPart; | 159 MultipartParsingState::WaitingForFirstPart; |
| 149 bool m_hasDevicePixelRatioHeaderValue; | 160 bool m_hasDevicePixelRatioHeaderValue; |
| 150 | 161 |
| 151 // Indicates if the ImageResource is currently scheduling a reload, e.g. | 162 // Indicates if the ImageResource is currently scheduling a reload, e.g. |
| 152 // because reloadIfLoFi() was called. | 163 // because reloadIfLoFi() was called. |
| 153 bool m_isSchedulingReload; | 164 bool m_isSchedulingReload; |
| 154 | 165 |
| 155 // Indicates if this ImageResource is either attempting to load a placeholder | 166 // Indicates if this ImageResource is either attempting to load a placeholder |
| 156 // image, or is a (possibly broken) placeholder image. | 167 // image, or is a (possibly broken) placeholder image. |
| 157 bool m_isPlaceholder; | 168 bool m_isPlaceholder; |
| 158 | 169 |
| 159 Timer<ImageResource> m_flushTimer; | 170 Timer<ImageResource> m_flushTimer; |
| 160 double m_lastFlushTime = 0.; | 171 double m_lastFlushTime = 0.; |
| 161 }; | 172 }; |
| 162 | 173 |
| 163 DEFINE_RESOURCE_TYPE_CASTS(Image); | 174 DEFINE_RESOURCE_TYPE_CASTS(Image); |
| 164 | 175 |
| 165 } // namespace blink | 176 } // namespace blink |
| 166 | 177 |
| 167 #endif | 178 #endif |
| OLD | NEW |