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. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // document: | 51 // document: |
52 // https://docs.google.com/document/d/1v0yTAZ6wkqX2U_M6BNIGUJpM1s0TIw1VsqpxoL7ac
iY/edit?usp=sharing | 52 // https://docs.google.com/document/d/1v0yTAZ6wkqX2U_M6BNIGUJpM1s0TIw1VsqpxoL7ac
iY/edit?usp=sharing |
53 class CORE_EXPORT ImageResource final | 53 class CORE_EXPORT ImageResource final |
54 : public Resource, | 54 : public Resource, |
55 public MultipartImageResourceParser::Client { | 55 public MultipartImageResourceParser::Client { |
56 USING_GARBAGE_COLLECTED_MIXIN(ImageResource); | 56 USING_GARBAGE_COLLECTED_MIXIN(ImageResource); |
57 | 57 |
58 public: | 58 public: |
59 using ClientType = ResourceClient; | 59 using ClientType = ResourceClient; |
60 | 60 |
61 // Use ImageResourceContent::fetch() unless ImageResource is required. | 61 // Use ImageResourceContent::Fetch() unless ImageResource is required. |
62 // TODO(hiroshige): Make fetch() private. | 62 // TODO(hiroshige): Make Fetch() private. |
63 static ImageResource* Fetch(FetchParameters&, ResourceFetcher*); | 63 static ImageResource* Fetch(RefPtr<WebTaskRunner>, |
| 64 FetchParameters&, |
| 65 ResourceFetcher*); |
64 | 66 |
65 // TODO(hiroshige): Make create() test-only by refactoring ImageDocument. | 67 // TODO(hiroshige): Make Create() test-only by refactoring ImageDocument. |
66 static ImageResource* Create(const ResourceRequest&); | 68 static ImageResource* Create(RefPtr<WebTaskRunner>, const ResourceRequest&); |
67 | 69 |
68 ~ImageResource() override; | 70 ~ImageResource() override; |
69 | 71 |
70 ImageResourceContent* GetContent(); | 72 ImageResourceContent* GetContent(); |
71 const ImageResourceContent* GetContent() const; | 73 const ImageResourceContent* GetContent() const; |
72 | 74 |
73 void ReloadIfLoFiOrPlaceholderImage(ResourceFetcher*, | 75 void ReloadIfLoFiOrPlaceholderImage(ResourceFetcher*, |
74 ReloadLoFiOrPlaceholderPolicy); | 76 ReloadLoFiOrPlaceholderPolicy); |
75 | 77 |
76 void DidAddClient(ResourceClient*) override; | 78 void DidAddClient(ResourceClient*) override; |
(...skipping 27 matching lines...) Expand all Loading... |
104 private: | 106 private: |
105 enum class MultipartParsingState : uint8_t { | 107 enum class MultipartParsingState : uint8_t { |
106 kWaitingForFirstPart, | 108 kWaitingForFirstPart, |
107 kParsingFirstPart, | 109 kParsingFirstPart, |
108 kFinishedParsingFirstPart, | 110 kFinishedParsingFirstPart, |
109 }; | 111 }; |
110 | 112 |
111 class ImageResourceInfoImpl; | 113 class ImageResourceInfoImpl; |
112 class ImageResourceFactory; | 114 class ImageResourceFactory; |
113 | 115 |
114 ImageResource(const ResourceRequest&, | 116 ImageResource(RefPtr<WebTaskRunner>, |
| 117 const ResourceRequest&, |
115 const ResourceLoaderOptions&, | 118 const ResourceLoaderOptions&, |
116 ImageResourceContent*, | 119 ImageResourceContent*, |
117 bool is_placeholder); | 120 bool is_placeholder); |
118 | 121 |
119 // Only for ImageResourceInfoImpl. | 122 // Only for ImageResourceInfoImpl. |
120 void DecodeError(bool all_data_received); | 123 void DecodeError(bool all_data_received); |
121 bool IsAccessAllowed( | 124 bool IsAccessAllowed( |
122 SecurityOrigin*, | 125 SecurityOrigin*, |
123 ImageResourceInfo::DoesCurrentFrameHaveSingleSecurityOrigin) const; | 126 ImageResourceInfo::DoesCurrentFrameHaveSingleSecurityOrigin) const; |
124 | 127 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // Do not show placeholder, reload only when decode error occurs. | 166 // Do not show placeholder, reload only when decode error occurs. |
164 kReloadPlaceholderOnDecodeError, | 167 kReloadPlaceholderOnDecodeError, |
165 | 168 |
166 // Show placeholder and reload. | 169 // Show placeholder and reload. |
167 kShowAndReloadPlaceholderAlways, | 170 kShowAndReloadPlaceholderAlways, |
168 }; | 171 }; |
169 PlaceholderOption placeholder_option_; | 172 PlaceholderOption placeholder_option_; |
170 | 173 |
171 Timer<ImageResource> flush_timer_; | 174 Timer<ImageResource> flush_timer_; |
172 double last_flush_time_ = 0.; | 175 double last_flush_time_ = 0.; |
| 176 RefPtr<WebTaskRunner> task_runner_; |
173 }; | 177 }; |
174 | 178 |
175 DEFINE_RESOURCE_TYPE_CASTS(Image); | 179 DEFINE_RESOURCE_TYPE_CASTS(Image); |
176 | 180 |
177 } // namespace blink | 181 } // namespace blink |
178 | 182 |
179 #endif | 183 #endif |
OLD | NEW |