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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 #include "wtf/text/WTFString.h" | 46 #include "wtf/text/WTFString.h" |
47 | 47 |
48 namespace blink { | 48 namespace blink { |
49 | 49 |
50 class Document; | 50 class Document; |
51 class KURL; | 51 class KURL; |
52 class ResourceRequest; | 52 class ResourceRequest; |
53 class SecurityOrigin; | 53 class SecurityOrigin; |
54 class ThreadableLoaderClient; | 54 class ThreadableLoaderClient; |
55 | 55 |
56 class CORE_EXPORT DocumentThreadableLoader final : public ThreadableLoader, priv ate ResourceOwner<RawResource> { | 56 class CORE_EXPORT DocumentThreadableLoader final : public ThreadableLoader, priv ate RawResourceClient { |
57 USING_FAST_MALLOC(DocumentThreadableLoader); | 57 USING_FAST_MALLOC(DocumentThreadableLoader); |
58 public: | 58 public: |
59 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&); |
60 static PassRefPtr<DocumentThreadableLoader> create(Document&, Threadable LoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&, const Res ourceLoaderOptions&); | 60 static PassRefPtr<DocumentThreadableLoader> create(Document&, Threadable LoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&, const Res ourceLoaderOptions&); |
61 ~DocumentThreadableLoader() override; | 61 ~DocumentThreadableLoader() override; |
62 | 62 |
63 void overrideTimeout(unsigned long timeout) override; | 63 void overrideTimeout(unsigned long timeout) override; |
64 | 64 |
65 // |this| may be dead after calling this method in async mode. | 65 // |this| may be dead after calling this method in async mode. |
66 void cancel() override; | 66 void cancel() override; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 void handleError(const ResourceError&); | 139 void handleError(const ResourceError&); |
140 | 140 |
141 void loadRequest(const ResourceRequest&, ResourceLoaderOptions); | 141 void loadRequest(const ResourceRequest&, ResourceLoaderOptions); |
142 bool isAllowedRedirect(const KURL&) const; | 142 bool isAllowedRedirect(const KURL&) const; |
143 bool isAllowedByContentSecurityPolicy(const KURL&, ContentSecurityPolicy ::RedirectStatus) const; | 143 bool isAllowedByContentSecurityPolicy(const KURL&, ContentSecurityPolicy ::RedirectStatus) const; |
144 // Returns DoNotAllowStoredCredentials | 144 // Returns DoNotAllowStoredCredentials |
145 // if m_forceDoNotAllowStoredCredentials is set. Otherwise, just | 145 // if m_forceDoNotAllowStoredCredentials is set. Otherwise, just |
146 // returns allowCredentials value of m_resourceLoaderOptions. | 146 // returns allowCredentials value of m_resourceLoaderOptions. |
147 StoredCredentials effectiveAllowCredentials() const; | 147 StoredCredentials effectiveAllowCredentials() const; |
148 | 148 |
149 // TODO(oilpan): DocumentThreadableLoader used to be a ResourceOwner, | |
150 // but ResourceOwner was moved onto the oilpan heap before | |
151 // DocumentThreadableLoader was ready. When DocumentThreadableLoader | |
haraken
2016/01/12 00:22:52
Just help me understand: In what sense is it not r
yhirano
2016/01/12 07:54:49
Making ThreadableLoader on-heap means making Worke
| |
152 // moves onto the oilpan heap, make it a ResourceOwner again and remove | |
153 // this re-implementation of ResourceOwner. | |
154 RawResource* resource() const { return m_resource.get(); } | |
155 void clearResource() { setResource(nullptr); } | |
156 void setResource(const ResourcePtr<RawResource>& newResource) | |
157 { | |
158 if (newResource == m_resource) | |
159 return; | |
160 | |
161 if (ResourcePtr<RawResource> oldResource = m_resource) { | |
162 m_resource.clear(); | |
163 oldResource->removeClient(this); | |
164 } | |
165 | |
166 if (newResource) { | |
167 m_resource = newResource; | |
168 m_resource->addClient(this); | |
169 } | |
170 } | |
171 ResourcePtr<RawResource> m_resource; | |
172 // End of ResourceOwner re-implementation, see above. | |
173 | |
149 SecurityOrigin* securityOrigin() const; | 174 SecurityOrigin* securityOrigin() const; |
150 Document& document() const; | 175 Document& document() const; |
151 | 176 |
152 ThreadableLoaderClient* m_client; | 177 ThreadableLoaderClient* m_client; |
153 RawPtrWillBeWeakPersistent<Document> m_document; | 178 RawPtrWillBeWeakPersistent<Document> m_document; |
154 | 179 |
155 const ThreadableLoaderOptions m_options; | 180 const ThreadableLoaderOptions m_options; |
156 // Some items may be overridden by m_forceDoNotAllowStoredCredentials | 181 // Some items may be overridden by m_forceDoNotAllowStoredCredentials |
157 // and m_securityOrigin. In such a case, build a ResourceLoaderOptions | 182 // and m_securityOrigin. In such a case, build a ResourceLoaderOptions |
158 // with up-to-date values from them and this variable, and use it. | 183 // with up-to-date values from them and this variable, and use it. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 // But this value is not the max number of total redirects allowed, | 221 // But this value is not the max number of total redirects allowed, |
197 // because same-origin redirects are not counted here. | 222 // because same-origin redirects are not counted here. |
198 int m_corsRedirectLimit; | 223 int m_corsRedirectLimit; |
199 | 224 |
200 const WebURLRequest::FetchRedirectMode m_redirectMode; | 225 const WebURLRequest::FetchRedirectMode m_redirectMode; |
201 }; | 226 }; |
202 | 227 |
203 } // namespace blink | 228 } // namespace blink |
204 | 229 |
205 #endif // DocumentThreadableLoader_h | 230 #endif // DocumentThreadableLoader_h |
OLD | NEW |