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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 // DocumentThreadableLoader was ready. When DocumentThreadableLoader | 154 // DocumentThreadableLoader was ready. When DocumentThreadableLoader |
155 // moves onto the oilpan heap, make it a ResourceOwner again and remove | 155 // moves onto the oilpan heap, make it a ResourceOwner again and remove |
156 // this re-implementation of ResourceOwner. | 156 // this re-implementation of ResourceOwner. |
157 RawResource* resource() const { return m_resource.get(); } | 157 RawResource* resource() const { return m_resource.get(); } |
158 void clearResource() { setResource(nullptr); } | 158 void clearResource() { setResource(nullptr); } |
159 void setResource(RawResource* newResource) | 159 void setResource(RawResource* newResource) |
160 { | 160 { |
161 if (newResource == m_resource) | 161 if (newResource == m_resource) |
162 return; | 162 return; |
163 | 163 |
164 if (RawResource* oldResource = m_resource.release()) | 164 if (RawResource* oldResource = m_resource.release()) { |
| 165 m_checker.willRemoveClient(); |
165 oldResource->removeClient(this); | 166 oldResource->removeClient(this); |
| 167 } |
166 | 168 |
167 if (newResource) { | 169 if (newResource) { |
168 m_resource = newResource; | 170 m_resource = newResource; |
| 171 m_checker.willAddClient(); |
169 m_resource->addClient(this); | 172 m_resource->addClient(this); |
170 } | 173 } |
171 } | 174 } |
172 Persistent<RawResource> m_resource; | 175 Persistent<RawResource> m_resource; |
173 // End of ResourceOwner re-implementation, see above. | 176 // End of ResourceOwner re-implementation, see above. |
174 | 177 |
175 SecurityOrigin* getSecurityOrigin() const; | 178 SecurityOrigin* getSecurityOrigin() const; |
176 Document& document() const; | 179 Document& document() const; |
177 | 180 |
178 ThreadableLoaderClient* m_client; | 181 ThreadableLoaderClient* m_client; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 221 |
219 // Max number of times that this DocumentThreadableLoader can follow | 222 // Max number of times that this DocumentThreadableLoader can follow |
220 // cross-origin redirects. | 223 // cross-origin redirects. |
221 // This is used to limit the number of redirects. | 224 // This is used to limit the number of redirects. |
222 // But this value is not the max number of total redirects allowed, | 225 // But this value is not the max number of total redirects allowed, |
223 // because same-origin redirects are not counted here. | 226 // because same-origin redirects are not counted here. |
224 int m_corsRedirectLimit; | 227 int m_corsRedirectLimit; |
225 | 228 |
226 WebURLRequest::FetchRedirectMode m_redirectMode; | 229 WebURLRequest::FetchRedirectMode m_redirectMode; |
227 | 230 |
| 231 RawResourceClientStateChecker m_checker; |
| 232 |
228 WeakPtrFactory<DocumentThreadableLoader> m_weakFactory; | 233 WeakPtrFactory<DocumentThreadableLoader> m_weakFactory; |
229 }; | 234 }; |
230 | 235 |
231 } // namespace blink | 236 } // namespace blink |
232 | 237 |
233 #endif // DocumentThreadableLoader_h | 238 #endif // DocumentThreadableLoader_h |
OLD | NEW |