| 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 12 matching lines...) Expand all Loading... |
| 23 #ifndef RawResource_h | 23 #ifndef RawResource_h |
| 24 #define RawResource_h | 24 #define RawResource_h |
| 25 | 25 |
| 26 #include "core/CoreExport.h" | 26 #include "core/CoreExport.h" |
| 27 #include "core/fetch/ResourceClient.h" | 27 #include "core/fetch/ResourceClient.h" |
| 28 #include "core/fetch/ResourcePtr.h" | 28 #include "core/fetch/ResourcePtr.h" |
| 29 #include "public/platform/WebDataConsumerHandle.h" | 29 #include "public/platform/WebDataConsumerHandle.h" |
| 30 #include "wtf/PassOwnPtr.h" | 30 #include "wtf/PassOwnPtr.h" |
| 31 | 31 |
| 32 namespace blink { | 32 namespace blink { |
| 33 class FetchRequest; |
| 33 class RawResourceClient; | 34 class RawResourceClient; |
| 35 class ResourceFetcher; |
| 36 class SubstituteData; |
| 34 | 37 |
| 35 class CORE_EXPORT RawResource final : public Resource { | 38 class CORE_EXPORT RawResource final : public Resource { |
| 36 public: | 39 public: |
| 37 typedef RawResourceClient ClientType; | 40 typedef RawResourceClient ClientType; |
| 38 | 41 |
| 42 static ResourcePtr<Resource> fetchSynchronously(FetchRequest&, ResourceFetch
er*); |
| 43 static ResourcePtr<RawResource> fetch(FetchRequest&, ResourceFetcher*); |
| 44 static ResourcePtr<RawResource> fetchMainResource(FetchRequest&, ResourceFet
cher*, const SubstituteData&); |
| 45 static ResourcePtr<RawResource> fetchImport(FetchRequest&, ResourceFetcher*)
; |
| 46 static ResourcePtr<RawResource> fetchMedia(FetchRequest&, ResourceFetcher*); |
| 47 static ResourcePtr<RawResource> fetchTextTrack(FetchRequest&, ResourceFetche
r*); |
| 48 |
| 49 // Exposed for testing |
| 39 RawResource(const ResourceRequest&, Type); | 50 RawResource(const ResourceRequest&, Type); |
| 40 | 51 |
| 41 // FIXME: AssociatedURLLoader shouldn't be a DocumentThreadableLoader and th
erefore shouldn't | 52 // FIXME: AssociatedURLLoader shouldn't be a DocumentThreadableLoader and th
erefore shouldn't |
| 42 // use RawResource. However, it is, and it needs to be able to defer loading
. | 53 // use RawResource. However, it is, and it needs to be able to defer loading
. |
| 43 // This can be fixed by splitting CORS preflighting out of DocumentThreacabl
eLoader. | 54 // This can be fixed by splitting CORS preflighting out of DocumentThreacabl
eLoader. |
| 44 void setDefersLoading(bool); | 55 void setDefersLoading(bool); |
| 45 | 56 |
| 46 bool canReuse(const ResourceRequest&) const override; | 57 bool canReuse(const ResourceRequest&) const override; |
| 47 | 58 |
| 48 private: | 59 private: |
| 60 class RawResourceFactory : public ResourceFactory { |
| 61 public: |
| 62 RawResourceFactory(Resource::Type type) |
| 63 : ResourceFactory(type) { } |
| 64 |
| 65 Resource* create(const ResourceRequest& request, const String& charset)
const override |
| 66 { |
| 67 return new RawResource(request, m_type); |
| 68 } |
| 69 }; |
| 70 static void preCacheSubstituteDataForMainResource(const FetchRequest&, Resou
rceFetcher*, const SubstituteData&); |
| 71 |
| 49 void didAddClient(ResourceClient*) override; | 72 void didAddClient(ResourceClient*) override; |
| 50 void appendData(const char*, unsigned) override; | 73 void appendData(const char*, unsigned) override; |
| 51 | 74 |
| 52 bool shouldIgnoreHTTPStatusCodeErrors() const override { return true; } | 75 bool shouldIgnoreHTTPStatusCodeErrors() const override { return true; } |
| 53 | 76 |
| 54 void willFollowRedirect(ResourceRequest&, const ResourceResponse&) override; | 77 void willFollowRedirect(ResourceRequest&, const ResourceResponse&) override; |
| 55 void updateRequest(const ResourceRequest&) override; | 78 void updateRequest(const ResourceRequest&) override; |
| 56 void responseReceived(const ResourceResponse&, PassOwnPtr<WebDataConsumerHan
dle>) override; | 79 void responseReceived(const ResourceResponse&, PassOwnPtr<WebDataConsumerHan
dle>) override; |
| 57 void setSerializedCachedMetadata(const char*, size_t) override; | 80 void setSerializedCachedMetadata(const char*, size_t) override; |
| 58 void didSendData(unsigned long long bytesSent, unsigned long long totalBytes
ToBeSent) override; | 81 void didSendData(unsigned long long bytesSent, unsigned long long totalBytes
ToBeSent) override; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 83 virtual void setSerializedCachedMetadata(Resource*, const char*, size_t) { } | 106 virtual void setSerializedCachedMetadata(Resource*, const char*, size_t) { } |
| 84 virtual void dataReceived(Resource*, const char* /* data */, unsigned /* len
gth */) { } | 107 virtual void dataReceived(Resource*, const char* /* data */, unsigned /* len
gth */) { } |
| 85 virtual void redirectReceived(Resource*, ResourceRequest&, const ResourceRes
ponse&) { } | 108 virtual void redirectReceived(Resource*, ResourceRequest&, const ResourceRes
ponse&) { } |
| 86 virtual void updateRequest(Resource*, const ResourceRequest&) { } | 109 virtual void updateRequest(Resource*, const ResourceRequest&) { } |
| 87 virtual void dataDownloaded(Resource*, int) { } | 110 virtual void dataDownloaded(Resource*, int) { } |
| 88 }; | 111 }; |
| 89 | 112 |
| 90 } | 113 } |
| 91 | 114 |
| 92 #endif // RawResource_h | 115 #endif // RawResource_h |
| OLD | NEW |