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); |
58 public: | 59 public: |
59 static void loadResourceSynchronously(Document&, const ResourceRequest&,
ThreadableLoaderClient&, const ThreadableLoaderOptions&, const ResourceLoaderOp
tions&); | 60 static void loadResourceSynchronously(Document&, const ResourceRequest&,
ThreadableLoaderClient&, const ThreadableLoaderOptions&, const ResourceLoaderOp
tions&); |
60 static DocumentThreadableLoader* create(Document&, ThreadableLoaderClien
t*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); | 61 static std::unique_ptr<DocumentThreadableLoader> create(Document&, Threa
dableLoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&
); |
61 ~DocumentThreadableLoader() override; | 62 ~DocumentThreadableLoader() override; |
62 | 63 |
63 void start(const ResourceRequest&) override; | 64 void start(const ResourceRequest&) override; |
64 | 65 |
65 void overrideTimeout(unsigned long timeout) override; | 66 void overrideTimeout(unsigned long timeout) override; |
66 | 67 |
67 // |this| may be dead after calling this method in async mode. | 68 // |this| may be dead after calling this method in async mode. |
68 void cancel() override; | 69 void cancel() override; |
69 void setDefersLoading(bool); | 70 void setDefersLoading(bool); |
70 | 71 |
71 DECLARE_TRACE(); | |
72 | |
73 private: | 72 private: |
74 enum BlockingBehavior { | 73 enum BlockingBehavior { |
75 LoadSynchronously, | 74 LoadSynchronously, |
76 LoadAsynchronously | 75 LoadAsynchronously |
77 }; | 76 }; |
78 | 77 |
79 DocumentThreadableLoader(Document&, ThreadableLoaderClient*, BlockingBeh
avior, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); | 78 DocumentThreadableLoader(Document&, ThreadableLoaderClient*, BlockingBeh
avior, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); |
80 | 79 |
81 void clear(); | 80 void clear(); |
82 | 81 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 return; | 162 return; |
164 | 163 |
165 if (RawResource* oldResource = m_resource.release()) | 164 if (RawResource* oldResource = m_resource.release()) |
166 oldResource->removeClient(this); | 165 oldResource->removeClient(this); |
167 | 166 |
168 if (newResource) { | 167 if (newResource) { |
169 m_resource = newResource; | 168 m_resource = newResource; |
170 m_resource->addClient(this); | 169 m_resource->addClient(this); |
171 } | 170 } |
172 } | 171 } |
173 Member<RawResource> m_resource; | 172 Persistent<RawResource> m_resource; |
174 // End of ResourceOwner re-implementation, see above. | 173 // End of ResourceOwner re-implementation, see above. |
175 | 174 |
176 SecurityOrigin* getSecurityOrigin() const; | 175 SecurityOrigin* getSecurityOrigin() const; |
177 Document& document() const; | 176 Document& document() const; |
178 | 177 |
179 ThreadableLoaderClient* m_client; | 178 ThreadableLoaderClient* m_client; |
180 Member<Document> m_document; | 179 WeakPersistent<Document> m_document; |
181 | 180 |
182 const ThreadableLoaderOptions m_options; | 181 const ThreadableLoaderOptions m_options; |
183 // Some items may be overridden by m_forceDoNotAllowStoredCredentials | 182 // Some items may be overridden by m_forceDoNotAllowStoredCredentials |
184 // and m_securityOrigin. In such a case, build a ResourceLoaderOptions | 183 // and m_securityOrigin. In such a case, build a ResourceLoaderOptions |
185 // with up-to-date values from them and this variable, and use it. | 184 // with up-to-date values from them and this variable, and use it. |
186 const ResourceLoaderOptions m_resourceLoaderOptions; | 185 const ResourceLoaderOptions m_resourceLoaderOptions; |
187 | 186 |
188 bool m_forceDoNotAllowStoredCredentials; | 187 bool m_forceDoNotAllowStoredCredentials; |
189 RefPtr<SecurityOrigin> m_securityOrigin; | 188 RefPtr<SecurityOrigin> m_securityOrigin; |
190 | 189 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 // header when following the redirect. | 230 // header when following the redirect. |
232 bool m_didRedirect; | 231 bool m_didRedirect; |
233 Referrer m_referrerAfterRedirect; | 232 Referrer m_referrerAfterRedirect; |
234 | 233 |
235 WeakPtrFactory<DocumentThreadableLoader> m_weakFactory; | 234 WeakPtrFactory<DocumentThreadableLoader> m_weakFactory; |
236 }; | 235 }; |
237 | 236 |
238 } // namespace blink | 237 } // namespace blink |
239 | 238 |
240 #endif // DocumentThreadableLoader_h | 239 #endif // DocumentThreadableLoader_h |
OLD | NEW |