Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2011 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 #include "core/CoreExport.h" | 32 #include "core/CoreExport.h" |
| 33 #include "core/fetch/ResourceLoaderOptions.h" | 33 #include "core/fetch/ResourceLoaderOptions.h" |
| 34 #include "platform/network/ResourceRequest.h" | 34 #include "platform/network/ResourceRequest.h" |
| 35 #include "public/platform/WebURLLoader.h" | 35 #include "public/platform/WebURLLoader.h" |
| 36 #include "public/platform/WebURLLoaderClient.h" | 36 #include "public/platform/WebURLLoaderClient.h" |
| 37 #include "wtf/Forward.h" | 37 #include "wtf/Forward.h" |
| 38 #include <memory> | 38 #include <memory> |
| 39 | 39 |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 class FetchContext; | |
| 42 class Resource; | 43 class Resource; |
| 43 class ResourceError; | 44 class ResourceError; |
| 44 class ResourceFetcher; | 45 class ResourceFetcher; |
| 45 | 46 |
| 46 class CORE_EXPORT ResourceLoader final | 47 class CORE_EXPORT ResourceLoader final |
| 47 : public GarbageCollectedFinalized<ResourceLoader>, | 48 : public GarbageCollectedFinalized<ResourceLoader>, |
| 48 protected WebURLLoaderClient { | 49 protected WebURLLoaderClient { |
| 49 public: | 50 public: |
| 50 static ResourceLoader* create(ResourceFetcher*, Resource*); | 51 static ResourceLoader* create(ResourceFetcher*, Resource*); |
| 51 ~ResourceLoader() override; | 52 ~ResourceLoader() override; |
| 52 DECLARE_TRACE(); | 53 DECLARE_TRACE(); |
| 53 | 54 |
| 54 void start(const ResourceRequest&, | 55 void start(const ResourceRequest&); |
| 55 WebTaskRunner* loadingTaskRunner, | |
| 56 bool defersLoading); | |
| 57 | 56 |
| 58 // This method is currently only used for service worker fallback request and | 57 // This method is currently only used for service worker fallback request and |
| 59 // cache-aware loading, other users should be careful not to break | 58 // cache-aware loading, other users should be careful not to break |
| 60 // ResourceLoader state. | 59 // ResourceLoader state. |
| 61 void restart(const ResourceRequest&, | 60 void restart(const ResourceRequest&); |
|
Nate Chapin
2016/12/07 19:13:00
This can be private now I think.
tyoshino (SeeGerritForStatus)
2016/12/12 11:10:55
Done.
| |
| 62 WebTaskRunner* loadingTaskRunner, | |
| 63 bool defersLoading); | |
| 64 | 61 |
| 65 void cancel(); | 62 void cancel(); |
| 66 | 63 |
| 67 void setDefersLoading(bool); | 64 void setDefersLoading(bool); |
| 68 | 65 |
| 69 void didChangePriority(ResourceLoadPriority, int intraPriorityValue); | 66 void didChangePriority(ResourceLoadPriority, int intraPriorityValue); |
| 70 | 67 |
| 71 // Called before start() to activate cache-aware loading if enabled in | 68 // Called before start() to activate cache-aware loading if enabled in |
| 72 // |m_resource->options()| and applicable. | 69 // |m_resource->options()| and applicable. |
| 73 void activateCacheAwareLoadingIfNeeded(const ResourceRequest&); | 70 void activateCacheAwareLoadingIfNeeded(const ResourceRequest&); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 99 void didReceiveData(const char*, int, int encodedDataLength) override; | 96 void didReceiveData(const char*, int, int encodedDataLength) override; |
| 100 void didDownloadData(int, int) override; | 97 void didDownloadData(int, int) override; |
| 101 void didFinishLoading(double finishTime, | 98 void didFinishLoading(double finishTime, |
| 102 int64_t encodedDataLength, | 99 int64_t encodedDataLength, |
| 103 int64_t encodedBodyLength) override; | 100 int64_t encodedBodyLength) override; |
| 104 void didFail(const WebURLError&, | 101 void didFail(const WebURLError&, |
| 105 int64_t encodedDataLength, | 102 int64_t encodedDataLength, |
| 106 int64_t encodedBodyLength) override; | 103 int64_t encodedBodyLength) override; |
| 107 | 104 |
| 108 void didFinishLoadingFirstPartInMultipart(); | 105 void didFinishLoadingFirstPartInMultipart(); |
| 109 void didFail(const ResourceError&); | |
| 110 | 106 |
| 111 private: | 107 private: |
| 112 // Assumes ResourceFetcher and Resource are non-null. | 108 // Assumes ResourceFetcher and Resource are non-null. |
| 113 ResourceLoader(ResourceFetcher*, Resource*); | 109 ResourceLoader(ResourceFetcher*, Resource*); |
| 114 | 110 |
| 111 FetchContext& context() const; | |
| 112 bool canAccessResponse(Resource*, const ResourceResponse&) const; | |
| 113 void handleError(const ResourceError&); | |
| 114 | |
| 115 void cancelWithURL(const KURL&); | |
|
Nate Chapin
2016/12/07 19:13:01
This is unused?
tyoshino (SeeGerritForStatus)
2016/12/12 11:10:55
Oh, right. Removed.
| |
| 115 void cancelForRedirectAccessCheckError(const KURL&); | 116 void cancelForRedirectAccessCheckError(const KURL&); |
| 116 void requestSynchronously(const ResourceRequest&); | 117 void requestSynchronously(const ResourceRequest&); |
| 117 | 118 |
| 118 std::unique_ptr<WebURLLoader> m_loader; | 119 std::unique_ptr<WebURLLoader> m_loader; |
| 119 Member<ResourceFetcher> m_fetcher; | 120 Member<ResourceFetcher> m_fetcher; |
| 120 Member<Resource> m_resource; | 121 Member<Resource> m_resource; |
| 121 bool m_isCacheAwareLoadingActivated; | 122 bool m_isCacheAwareLoadingActivated; |
| 122 }; | 123 }; |
| 123 | 124 |
| 124 } // namespace blink | 125 } // namespace blink |
| 125 | 126 |
| 126 #endif | 127 #endif |
| OLD | NEW |