Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: third_party/WebKit/Source/core/loader/DocumentThreadableLoader.h

Issue 2020313002: Verify the order of RawResourceClient callbacks in DocumentThreadableLoader (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix rebase error and update TODO comment Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // |this| may be dead after calling this method. 144 // |this| may be dead after calling this method.
145 void handleError(const ResourceError&); 145 void handleError(const ResourceError&);
146 146
147 void loadRequest(const ResourceRequest&, ResourceLoaderOptions); 147 void loadRequest(const ResourceRequest&, ResourceLoaderOptions);
148 bool isAllowedRedirect(const KURL&) const; 148 bool isAllowedRedirect(const KURL&) const;
149 // Returns DoNotAllowStoredCredentials 149 // Returns DoNotAllowStoredCredentials
150 // if m_forceDoNotAllowStoredCredentials is set. Otherwise, just 150 // if m_forceDoNotAllowStoredCredentials is set. Otherwise, just
151 // returns allowCredentials value of m_resourceLoaderOptions. 151 // returns allowCredentials value of m_resourceLoaderOptions.
152 StoredCredentials effectiveAllowCredentials() const; 152 StoredCredentials effectiveAllowCredentials() const;
153 153
154 // TODO(oilpan): DocumentThreadableLoader used to be a ResourceOwner, 154 // TODO(hiroshige): After crbug.com/633696 is fixed,
155 // but ResourceOwner was moved onto the oilpan heap before 155 // - Remove RawResourceClientStateChecker logic,
156 // DocumentThreadableLoader was ready. When DocumentThreadableLoader 156 // - Make DocumentThreadableLoader to be a ResourceOwner and remove
157 // moves onto the oilpan heap, make it a ResourceOwner again and remove 157 // this re-implementation of ResourceOwner, and
158 // this re-implementation of ResourceOwner. 158 // - Consider re-applying RawResourceClientStateChecker in a more
159 // general fashion (crbug.com/640291).
159 RawResource* resource() const { return m_resource.get(); } 160 RawResource* resource() const { return m_resource.get(); }
160 void clearResource() { setResource(nullptr); } 161 void clearResource() { setResource(nullptr); }
161 void setResource(RawResource* newResource) 162 void setResource(RawResource* newResource)
162 { 163 {
163 if (newResource == m_resource) 164 if (newResource == m_resource)
164 return; 165 return;
165 166
166 if (RawResource* oldResource = m_resource.release()) 167 if (RawResource* oldResource = m_resource.release()) {
168 m_checker.willRemoveClient();
167 oldResource->removeClient(this); 169 oldResource->removeClient(this);
170 }
168 171
169 if (newResource) { 172 if (newResource) {
170 m_resource = newResource; 173 m_resource = newResource;
174 m_checker.willAddClient();
171 m_resource->addClient(this); 175 m_resource->addClient(this);
172 } 176 }
173 } 177 }
174 Member<RawResource> m_resource; 178 Member<RawResource> m_resource;
175 // End of ResourceOwner re-implementation, see above. 179 // End of ResourceOwner re-implementation, see above.
176 180
177 const SecurityOrigin* getSecurityOrigin() const; 181 const SecurityOrigin* getSecurityOrigin() const;
178 Document& document() const; 182 Document& document() const;
179 183
180 ThreadableLoaderClient* m_client; 184 ThreadableLoaderClient* m_client;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 int m_corsRedirectLimit; 230 int m_corsRedirectLimit;
227 231
228 WebURLRequest::FetchRedirectMode m_redirectMode; 232 WebURLRequest::FetchRedirectMode m_redirectMode;
229 233
230 // Holds the referrer after a redirect response was 234 // Holds the referrer after a redirect response was
231 // received. This referrer is used to populate the HTTP Referer 235 // received. This referrer is used to populate the HTTP Referer
232 // header when following the redirect. 236 // header when following the redirect.
233 bool m_didRedirect; 237 bool m_didRedirect;
234 Referrer m_referrerAfterRedirect; 238 Referrer m_referrerAfterRedirect;
235 239
240 RawResourceClientStateChecker m_checker;
236 WeakPtrFactory<DocumentThreadableLoader> m_weakFactory; 241 WeakPtrFactory<DocumentThreadableLoader> m_weakFactory;
237 }; 242 };
238 243
239 } // namespace blink 244 } // namespace blink
240 245
241 #endif // DocumentThreadableLoader_h 246 #endif // DocumentThreadableLoader_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698