Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2013, Intel Corporation | 3 * Copyright (C) 2013, Intel Corporation |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 #include "platform/network/ResourceError.h" | 42 #include "platform/network/ResourceError.h" |
| 43 #include "platform/weborigin/Referrer.h" | 43 #include "platform/weborigin/Referrer.h" |
| 44 #include "wtf/Forward.h" | 44 #include "wtf/Forward.h" |
| 45 #include "wtf/text/WTFString.h" | 45 #include "wtf/text/WTFString.h" |
| 46 #include <memory> | 46 #include <memory> |
| 47 | 47 |
| 48 namespace blink { | 48 namespace blink { |
| 49 | 49 |
| 50 class Document; | 50 class Document; |
| 51 class KURL; | 51 class KURL; |
| 52 class LoadingContext; | |
| 52 class ResourceRequest; | 53 class ResourceRequest; |
| 53 class SecurityOrigin; | 54 class SecurityOrigin; |
| 54 class ThreadableLoaderClient; | 55 class ThreadableLoaderClient; |
| 55 | 56 |
| 56 class CORE_EXPORT DocumentThreadableLoader final : public ThreadableLoader, | 57 class CORE_EXPORT DocumentThreadableLoader final : public ThreadableLoader, |
| 57 private RawResourceClient { | 58 private RawResourceClient { |
| 58 USING_GARBAGE_COLLECTED_MIXIN(DocumentThreadableLoader); | 59 USING_GARBAGE_COLLECTED_MIXIN(DocumentThreadableLoader); |
| 59 | 60 |
| 60 public: | 61 public: |
| 61 static void loadResourceSynchronously(Document&, | 62 static void loadResourceSynchronously(Document&, |
| 62 const ResourceRequest&, | 63 const ResourceRequest&, |
| 63 ThreadableLoaderClient&, | 64 ThreadableLoaderClient&, |
| 64 const ThreadableLoaderOptions&, | 65 const ThreadableLoaderOptions&, |
| 65 const ResourceLoaderOptions&); | 66 const ResourceLoaderOptions&); |
| 66 static DocumentThreadableLoader* create(Document&, | 67 static DocumentThreadableLoader* create(Document&, |
| 67 ThreadableLoaderClient*, | 68 ThreadableLoaderClient*, |
| 68 const ThreadableLoaderOptions&, | 69 const ThreadableLoaderOptions&, |
| 69 const ResourceLoaderOptions&); | 70 const ResourceLoaderOptions&); |
| 71 static DocumentThreadableLoader* create(LoadingContext&, | |
| 72 ThreadableLoaderClient*, | |
| 73 const ThreadableLoaderOptions&, | |
| 74 const ResourceLoaderOptions&); | |
| 70 ~DocumentThreadableLoader() override; | 75 ~DocumentThreadableLoader() override; |
| 71 | 76 |
| 72 void start(const ResourceRequest&) override; | 77 void start(const ResourceRequest&) override; |
| 73 | 78 |
| 74 void overrideTimeout(unsigned long timeout) override; | 79 void overrideTimeout(unsigned long timeout) override; |
| 75 | 80 |
| 76 void cancel() override; | 81 void cancel() override; |
| 77 void setDefersLoading(bool); | 82 void setDefersLoading(bool); |
| 78 | 83 |
| 79 DECLARE_TRACE(); | 84 DECLARE_TRACE(); |
| 80 | 85 |
| 81 private: | 86 private: |
| 82 enum BlockingBehavior { LoadSynchronously, LoadAsynchronously }; | 87 enum BlockingBehavior { LoadSynchronously, LoadAsynchronously }; |
| 83 | 88 |
| 84 DocumentThreadableLoader(Document&, | 89 DocumentThreadableLoader(LoadingContext&, |
|
horo
2017/02/27 04:49:20
Why do you use reference instead of pointer?
kinuko
2017/02/27 04:55:35
Just to indicate this should never be null.
| |
| 85 ThreadableLoaderClient*, | 90 ThreadableLoaderClient*, |
| 86 BlockingBehavior, | 91 BlockingBehavior, |
| 87 const ThreadableLoaderOptions&, | 92 const ThreadableLoaderOptions&, |
| 88 const ResourceLoaderOptions&); | 93 const ResourceLoaderOptions&); |
| 89 | 94 |
| 90 void clear(); | 95 void clear(); |
| 91 | 96 |
| 92 // ResourceClient | 97 // ResourceClient |
| 93 void notifyFinished(Resource*) override; | 98 void notifyFinished(Resource*) override; |
| 94 | 99 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 175 if (newResource) { | 180 if (newResource) { |
| 176 m_resource = newResource; | 181 m_resource = newResource; |
| 177 m_checker.willAddClient(); | 182 m_checker.willAddClient(); |
| 178 m_resource->addClient(this); | 183 m_resource->addClient(this); |
| 179 } | 184 } |
| 180 } | 185 } |
| 181 Member<RawResource> m_resource; | 186 Member<RawResource> m_resource; |
| 182 // End of ResourceOwner re-implementation, see above. | 187 // End of ResourceOwner re-implementation, see above. |
| 183 | 188 |
| 184 const SecurityOrigin* getSecurityOrigin() const; | 189 const SecurityOrigin* getSecurityOrigin() const; |
| 185 Document& document() const; | 190 |
| 191 // TODO(kinuko): Remove dependency to document. | |
| 192 Document* document() const; | |
| 186 | 193 |
| 187 ThreadableLoaderClient* m_client; | 194 ThreadableLoaderClient* m_client; |
| 188 Member<Document> m_document; | 195 Member<LoadingContext> m_loadingContext; |
| 189 | 196 |
| 190 const ThreadableLoaderOptions m_options; | 197 const ThreadableLoaderOptions m_options; |
| 191 // Some items may be overridden by m_forceDoNotAllowStoredCredentials and | 198 // Some items may be overridden by m_forceDoNotAllowStoredCredentials and |
| 192 // m_securityOrigin. In such a case, build a ResourceLoaderOptions with | 199 // m_securityOrigin. In such a case, build a ResourceLoaderOptions with |
| 193 // up-to-date values from them and this variable, and use it. | 200 // up-to-date values from them and this variable, and use it. |
| 194 const ResourceLoaderOptions m_resourceLoaderOptions; | 201 const ResourceLoaderOptions m_resourceLoaderOptions; |
| 195 | 202 |
| 196 bool m_forceDoNotAllowStoredCredentials; | 203 bool m_forceDoNotAllowStoredCredentials; |
| 197 RefPtr<SecurityOrigin> m_securityOrigin; | 204 RefPtr<SecurityOrigin> m_securityOrigin; |
| 198 | 205 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 236 // used to populate the HTTP Referer header when following the redirect. | 243 // used to populate the HTTP Referer header when following the redirect. |
| 237 bool m_overrideReferrer; | 244 bool m_overrideReferrer; |
| 238 Referrer m_referrerAfterRedirect; | 245 Referrer m_referrerAfterRedirect; |
| 239 | 246 |
| 240 RawResourceClientStateChecker m_checker; | 247 RawResourceClientStateChecker m_checker; |
| 241 }; | 248 }; |
| 242 | 249 |
| 243 } // namespace blink | 250 } // namespace blink |
| 244 | 251 |
| 245 #endif // DocumentThreadableLoader_h | 252 #endif // DocumentThreadableLoader_h |
| OLD | NEW |