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

Unified Diff: third_party/WebKit/Source/core/fetch/Resource.h

Issue 1710733002: Move multipart resource handling to core/fetch (2/2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@multipart-cleanup
Patch Set: rebase Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/fetch/Resource.h
diff --git a/third_party/WebKit/Source/core/fetch/Resource.h b/third_party/WebKit/Source/core/fetch/Resource.h
index 03bdb79022eed771b760daa93bd19f99e8b31740..83c02e1bde60dd6d4ff0781b31ade4d6fe0147e4 100644
--- a/third_party/WebKit/Source/core/fetch/Resource.h
+++ b/third_party/WebKit/Source/core/fetch/Resource.h
@@ -25,6 +25,7 @@
#include "core/CoreExport.h"
#include "core/fetch/CachedMetadataHandler.h"
+#include "core/fetch/MultipartImageResourceParser.h"
#include "core/fetch/ResourceLoaderOptions.h"
#include "platform/Timer.h"
#include "platform/network/ResourceError.h"
@@ -59,9 +60,10 @@ class SharedBuffer;
// A resource that is held in the cache. Classes who want to use this object should derive
// from ResourceClient, to get the function calls in case the requested data has arrived.
// This class also does the actual communication with the loader to obtain the resource from the network.
-class CORE_EXPORT Resource : public RefCountedWillBeGarbageCollectedFinalized<Resource> {
+class CORE_EXPORT Resource : public RefCountedWillBeGarbageCollectedFinalized<Resource>, public MultipartImageResourceParser::Client {
Nate Chapin 2016/02/25 22:07:53 We should at least take a look at weather we can m
yhirano 2016/02/27 01:27:45 It's not possible at this moment because ImageDocu
WTF_MAKE_NONCOPYABLE(Resource);
USING_FAST_MALLOC_WITH_TYPE_NAME_WILL_BE_REMOVED(blink::Resource);
+ WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Resource);
friend class InspectorResource;
public:
@@ -104,7 +106,7 @@ public:
virtual void setEncoding(const String&) { }
virtual String encoding() const { return String(); }
- virtual void appendData(const char*, size_t);
+ void appendData(const char*, size_t);
virtual void error(Resource::Status);
virtual void setCORSFailed() { }
@@ -258,12 +260,18 @@ public:
// TODO(japhet): Remove once oilpan ships, it doesn't need the WeakPtr.
WeakPtrWillBeRawPtr<Resource> asWeakPtr();
+ bool isMultipartImage() const;
+
#ifdef ENABLE_RESOURCE_IS_DELETED_CHECK
void assertAlive() const { RELEASE_ASSERT(!m_deleted); }
#else
void assertAlive() const { }
#endif
+ // MultipartImageResourceParser::Client
+ void didReceiveResponse(const ResourceResponse&) final;
+ void didReceiveData(const char*, size_t) final;
+
protected:
Resource(const ResourceRequest&, Type);
@@ -271,6 +279,7 @@ protected:
virtual void finishOnePart();
virtual void destroyDecodedDataForFailedRevalidation() { }
+ virtual void appendDataInternal(const char*, size_t);
void setEncodedSize(size_t);
void setDecodedSize(size_t);
@@ -353,6 +362,7 @@ private:
RefPtr<CachedMetadata> m_cachedMetadata;
OwnPtrWillBeMember<CacheHandler> m_cacheHandler;
+ PersistentWillBeMember<MultipartImageResourceParser> m_multipartParser;
ResourceError m_error;

Powered by Google App Engine
This is Rietveld 408576698