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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 | 48 |
| 49 namespace blink { | 49 namespace blink { |
| 50 | 50 |
| 51 class Document; | 51 class Document; |
| 52 class KURL; | 52 class KURL; |
| 53 class ResourceRequest; | 53 class ResourceRequest; |
| 54 class SecurityOrigin; | 54 class SecurityOrigin; |
| 55 class ThreadableLoaderClient; | 55 class ThreadableLoaderClient; |
| 56 | 56 |
| 57 class CORE_EXPORT DocumentThreadableLoader final : public ThreadableLoader, priv ate RawResourceClient { | 57 class CORE_EXPORT DocumentThreadableLoader final : public ThreadableLoader, priv ate RawResourceClient { |
| 58 USING_FAST_MALLOC(DocumentThreadableLoader); | |
| 59 public: | 58 public: |
| 60 static void loadResourceSynchronously(Document&, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&, const ResourceLoaderOp tions&); | 59 static void loadResourceSynchronously(Document&, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&, const ResourceLoaderOp tions&); |
| 61 static std::unique_ptr<DocumentThreadableLoader> create(Document&, Threa dableLoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions& ); | 60 static DocumentThreadableLoader* create(Document&, ThreadableLoaderClien t*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); |
| 62 ~DocumentThreadableLoader() override; | 61 ~DocumentThreadableLoader() override; |
| 63 | 62 |
| 64 void start(const ResourceRequest&) override; | 63 void start(const ResourceRequest&) override; |
| 65 | 64 |
| 66 void overrideTimeout(unsigned long timeout) override; | 65 void overrideTimeout(unsigned long timeout) override; |
| 67 | 66 |
| 68 // |this| may be dead after calling this method in async mode. | 67 // |this| may be dead after calling this method in async mode. |
| 69 void cancel() override; | 68 void cancel() override; |
| 70 void setDefersLoading(bool); | 69 void setDefersLoading(bool); |
| 71 | 70 |
| 71 DECLARE_TRACE(); | |
| 72 | |
| 72 private: | 73 private: |
| 73 enum BlockingBehavior { | 74 enum BlockingBehavior { |
| 74 LoadSynchronously, | 75 LoadSynchronously, |
| 75 LoadAsynchronously | 76 LoadAsynchronously |
| 76 }; | 77 }; |
| 77 | 78 |
| 78 DocumentThreadableLoader(Document&, ThreadableLoaderClient*, BlockingBeh avior, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); | 79 DocumentThreadableLoader(Document&, ThreadableLoaderClient*, BlockingBeh avior, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); |
| 79 | 80 |
| 80 void clear(); | 81 void clear(); |
| 81 | 82 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 return; | 163 return; |
| 163 | 164 |
| 164 if (RawResource* oldResource = m_resource.release()) | 165 if (RawResource* oldResource = m_resource.release()) |
| 165 oldResource->removeClient(this); | 166 oldResource->removeClient(this); |
| 166 | 167 |
| 167 if (newResource) { | 168 if (newResource) { |
| 168 m_resource = newResource; | 169 m_resource = newResource; |
| 169 m_resource->addClient(this); | 170 m_resource->addClient(this); |
| 170 } | 171 } |
| 171 } | 172 } |
| 172 Persistent<RawResource> m_resource; | 173 Member<RawResource> m_resource; |
| 173 // End of ResourceOwner re-implementation, see above. | 174 // End of ResourceOwner re-implementation, see above. |
| 174 | 175 |
| 175 SecurityOrigin* getSecurityOrigin() const; | 176 SecurityOrigin* getSecurityOrigin() const; |
| 176 Document& document() const; | 177 Document& document() const; |
| 177 | 178 |
| 178 ThreadableLoaderClient* m_client; | 179 ThreadableLoaderClient* m_client; |
| 179 WeakPersistent<Document> m_document; | 180 Member<Document> m_document; |
| 180 | 181 |
| 181 const ThreadableLoaderOptions m_options; | 182 const ThreadableLoaderOptions m_options; |
| 182 // Some items may be overridden by m_forceDoNotAllowStoredCredentials | 183 // Some items may be overridden by m_forceDoNotAllowStoredCredentials |
| 183 // and m_securityOrigin. In such a case, build a ResourceLoaderOptions | 184 // and m_securityOrigin. In such a case, build a ResourceLoaderOptions |
| 184 // with up-to-date values from them and this variable, and use it. | 185 // with up-to-date values from them and this variable, and use it. |
| 185 const ResourceLoaderOptions m_resourceLoaderOptions; | 186 const ResourceLoaderOptions m_resourceLoaderOptions; |
| 186 | 187 |
| 187 bool m_forceDoNotAllowStoredCredentials; | 188 bool m_forceDoNotAllowStoredCredentials; |
| 188 RefPtr<SecurityOrigin> m_securityOrigin; | 189 RefPtr<SecurityOrigin> m_securityOrigin; |
| 189 | 190 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 int m_corsRedirectLimit; | 225 int m_corsRedirectLimit; |
| 225 | 226 |
| 226 WebURLRequest::FetchRedirectMode m_redirectMode; | 227 WebURLRequest::FetchRedirectMode m_redirectMode; |
| 227 | 228 |
| 228 // Holds the referrer after a redirect response was | 229 // Holds the referrer after a redirect response was |
| 229 // received. This referrer is used to populate the HTTP Referer | 230 // received. This referrer is used to populate the HTTP Referer |
| 230 // header when following the redirect. | 231 // header when following the redirect. |
| 231 bool m_didRedirect; | 232 bool m_didRedirect; |
| 232 Referrer m_referrerAfterRedirect; | 233 Referrer m_referrerAfterRedirect; |
| 233 | 234 |
| 234 WeakPtrFactory<DocumentThreadableLoader> m_weakFactory; | 235 WeakPtrFactory<DocumentThreadableLoader> m_weakFactory; |
|
haraken
2016/07/29 14:52:51
Now that DocumentThreadableLoader is on the heap,
| |
| 235 }; | 236 }; |
| 236 | 237 |
| 237 } // namespace blink | 238 } // namespace blink |
| 238 | 239 |
| 239 #endif // DocumentThreadableLoader_h | 240 #endif // DocumentThreadableLoader_h |
| OLD | NEW |