| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 protected WebURLLoaderClient { | 48 protected WebURLLoaderClient { |
| 49 public: | 49 public: |
| 50 static ResourceLoader* create(ResourceFetcher*, Resource*); | 50 static ResourceLoader* create(ResourceFetcher*, Resource*); |
| 51 ~ResourceLoader() override; | 51 ~ResourceLoader() override; |
| 52 DECLARE_TRACE(); | 52 DECLARE_TRACE(); |
| 53 | 53 |
| 54 void start(const ResourceRequest&, | 54 void start(const ResourceRequest&, |
| 55 WebTaskRunner* loadingTaskRunner, | 55 WebTaskRunner* loadingTaskRunner, |
| 56 bool defersLoading); | 56 bool defersLoading); |
| 57 | 57 |
| 58 // This method is currently only used for service worker fallback request, | 58 // This method is currently only used for service worker fallback request and |
| 59 // other users should be careful not to break ResourceLoader state. | 59 // cache-aware loading, other users should be careful not to break |
| 60 // ResourceLoader state. |
| 60 void restart(const ResourceRequest&, | 61 void restart(const ResourceRequest&, |
| 61 WebTaskRunner* loadingTaskRunner, | 62 WebTaskRunner* loadingTaskRunner, |
| 62 bool defersLoading); | 63 bool defersLoading); |
| 63 | 64 |
| 64 void cancel(); | 65 void cancel(); |
| 65 | 66 |
| 66 void setDefersLoading(bool); | 67 void setDefersLoading(bool); |
| 67 | 68 |
| 68 void didChangePriority(ResourceLoadPriority, int intraPriorityValue); | 69 void didChangePriority(ResourceLoadPriority, int intraPriorityValue); |
| 69 | 70 |
| 71 // Called before start() to activate cache-aware loading if enabled in |
| 72 // |m_resource->options()| and applicable. |
| 73 void activateCacheAwareLoadingIfNeeded(const ResourceRequest&); |
| 74 |
| 75 bool isCacheAwareLoadingActivated() const { |
| 76 return m_isCacheAwareLoadingActivated; |
| 77 } |
| 78 |
| 70 // WebURLLoaderClient | 79 // WebURLLoaderClient |
| 71 // | 80 // |
| 72 // A succesful load will consist of: | 81 // A succesful load will consist of: |
| 73 // 0+ willFollowRedirect() | 82 // 0+ willFollowRedirect() |
| 74 // 0+ didSendData() | 83 // 0+ didSendData() |
| 75 // 1 didReceiveResponse() | 84 // 1 didReceiveResponse() |
| 76 // 0-1 didReceiveCachedMetadata() | 85 // 0-1 didReceiveCachedMetadata() |
| 77 // 0+ didReceiveData() or didDownloadData(), but never both | 86 // 0+ didReceiveData() or didDownloadData(), but never both |
| 78 // 1 didFinishLoading() | 87 // 1 didFinishLoading() |
| 79 // A failed load is indicated by 1 didFail(), which can occur at any time | 88 // A failed load is indicated by 1 didFail(), which can occur at any time |
| (...skipping 29 matching lines...) Expand all Loading... |
| 109 private: | 118 private: |
| 110 // Assumes ResourceFetcher and Resource are non-null. | 119 // Assumes ResourceFetcher and Resource are non-null. |
| 111 ResourceLoader(ResourceFetcher*, Resource*); | 120 ResourceLoader(ResourceFetcher*, Resource*); |
| 112 | 121 |
| 113 void cancelForRedirectAccessCheckError(const KURL&); | 122 void cancelForRedirectAccessCheckError(const KURL&); |
| 114 void requestSynchronously(const ResourceRequest&); | 123 void requestSynchronously(const ResourceRequest&); |
| 115 | 124 |
| 116 std::unique_ptr<WebURLLoader> m_loader; | 125 std::unique_ptr<WebURLLoader> m_loader; |
| 117 Member<ResourceFetcher> m_fetcher; | 126 Member<ResourceFetcher> m_fetcher; |
| 118 Member<Resource> m_resource; | 127 Member<Resource> m_resource; |
| 128 bool m_isCacheAwareLoadingActivated; |
| 119 }; | 129 }; |
| 120 | 130 |
| 121 } // namespace blink | 131 } // namespace blink |
| 122 | 132 |
| 123 #endif | 133 #endif |
| OLD | NEW |