Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: third_party/WebKit/Source/core/fetch/ImageResource.h

Issue 2054643003: Remove duplication of encoded image data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: (rebase) Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 26 matching lines...) Expand all
37 namespace blink { 37 namespace blink {
38 38
39 class FetchRequest; 39 class FetchRequest;
40 class FloatSize; 40 class FloatSize;
41 class ImageResourceObserver; 41 class ImageResourceObserver;
42 class MemoryCache; 42 class MemoryCache;
43 class ResourceClient; 43 class ResourceClient;
44 class ResourceFetcher; 44 class ResourceFetcher;
45 class SecurityOrigin; 45 class SecurityOrigin;
46 46
47 // ImageResource class represents an image type resource.
48 //
49 // As for the lifetimes of m_image and m_data, see this document:
50 // https://docs.google.com/document/d/1v0yTAZ6wkqX2U_M6BNIGUJpM1s0TIw1VsqpxoL7ac iY/edit?usp=sharing
47 class CORE_EXPORT ImageResource final : public Resource, public ImageObserver, p ublic MultipartImageResourceParser::Client { 51 class CORE_EXPORT ImageResource final : public Resource, public ImageObserver, p ublic MultipartImageResourceParser::Client {
48 friend class MemoryCache; 52 friend class MemoryCache;
49 USING_GARBAGE_COLLECTED_MIXIN(ImageResource); 53 USING_GARBAGE_COLLECTED_MIXIN(ImageResource);
50 public: 54 public:
51 using ClientType = ResourceClient; 55 using ClientType = ResourceClient;
52 56
53 static ImageResource* fetch(FetchRequest&, ResourceFetcher*); 57 static ImageResource* fetch(FetchRequest&, ResourceFetcher*);
54 58
55 static ImageResource* create(blink::Image* image) 59 static ImageResource* create(blink::Image* image)
56 { 60 {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 void didAddClient(ResourceClient*) override; 98 void didAddClient(ResourceClient*) override;
95 99
96 void addObserver(ImageResourceObserver*); 100 void addObserver(ImageResourceObserver*);
97 void removeObserver(ImageResourceObserver*); 101 void removeObserver(ImageResourceObserver*);
98 bool hasClientsOrObservers() const override { return Resource::hasClientsOrO bservers() || !m_observers.isEmpty() || !m_finishedObservers.isEmpty(); } 102 bool hasClientsOrObservers() const override { return Resource::hasClientsOrO bservers() || !m_observers.isEmpty() || !m_finishedObservers.isEmpty(); }
99 103
100 ResourcePriority priorityFromObservers() override; 104 ResourcePriority priorityFromObservers() override;
101 105
102 void allClientsAndObserversRemoved() override; 106 void allClientsAndObserversRemoved() override;
103 107
108 PassRefPtr<SharedBuffer> resourceBuffer() const override;
104 void appendData(const char*, size_t) override; 109 void appendData(const char*, size_t) override;
105 void error(const ResourceError&) override; 110 void error(const ResourceError&) override;
106 void responseReceived(const ResourceResponse&, std::unique_ptr<WebDataConsum erHandle>) override; 111 void responseReceived(const ResourceResponse&, std::unique_ptr<WebDataConsum erHandle>) override;
107 void finish(double finishTime = 0.0) override; 112 void finish(double finishTime = 0.0) override;
108 113
109 // For compatibility, images keep loading even if there are HTTP errors. 114 // For compatibility, images keep loading even if there are HTTP errors.
110 bool shouldIgnoreHTTPStatusCodeErrors() const override { return true; } 115 bool shouldIgnoreHTTPStatusCodeErrors() const override { return true; }
111 116
112 bool isImage() const override { return true; } 117 bool isImage() const override { return true; }
113 118
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 bool m_hasDevicePixelRatioHeaderValue; 179 bool m_hasDevicePixelRatioHeaderValue;
175 HashCountedSet<ImageResourceObserver*> m_observers; 180 HashCountedSet<ImageResourceObserver*> m_observers;
176 HashCountedSet<ImageResourceObserver*> m_finishedObservers; 181 HashCountedSet<ImageResourceObserver*> m_finishedObservers;
177 }; 182 };
178 183
179 DEFINE_RESOURCE_TYPE_CASTS(Image); 184 DEFINE_RESOURCE_TYPE_CASTS(Image);
180 185
181 } // namespace blink 186 } // namespace blink
182 187
183 #endif 188 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/clipboard/DataTransfer.cpp ('k') | third_party/WebKit/Source/core/fetch/ImageResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698