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

Side by Side Diff: Source/core/loader/DocumentLoader.h

Issue 1263363005: Better handle reentrancy into DocumentLoader::dataReceived(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: . Created 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/loader/DocumentLoader.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
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 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. 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 27 matching lines...) Expand all
38 #include "core/fetch/ResourcePtr.h" 38 #include "core/fetch/ResourcePtr.h"
39 #include "core/fetch/SubstituteData.h" 39 #include "core/fetch/SubstituteData.h"
40 #include "core/frame/csp/ContentSecurityPolicy.h" 40 #include "core/frame/csp/ContentSecurityPolicy.h"
41 #include "core/loader/DocumentLoadTiming.h" 41 #include "core/loader/DocumentLoadTiming.h"
42 #include "core/loader/DocumentWriter.h" 42 #include "core/loader/DocumentWriter.h"
43 #include "core/loader/FrameLoaderTypes.h" 43 #include "core/loader/FrameLoaderTypes.h"
44 #include "core/loader/NavigationPolicy.h" 44 #include "core/loader/NavigationPolicy.h"
45 #include "platform/network/ResourceError.h" 45 #include "platform/network/ResourceError.h"
46 #include "platform/network/ResourceRequest.h" 46 #include "platform/network/ResourceRequest.h"
47 #include "platform/network/ResourceResponse.h" 47 #include "platform/network/ResourceResponse.h"
48 #include "wtf/Deque.h"
48 #include "wtf/HashSet.h" 49 #include "wtf/HashSet.h"
50 #include "wtf/OwnPtr.h"
49 #include "wtf/RefPtr.h" 51 #include "wtf/RefPtr.h"
52 #include "wtf/Vector.h"
50 53
51 namespace blink { 54 namespace blink {
52 55
53 class ApplicationCacheHost; 56 class ApplicationCacheHost;
54 class ResourceFetcher; 57 class ResourceFetcher;
55 class DocumentInit; 58 class DocumentInit;
56 class LocalFrame; 59 class LocalFrame;
57 class FrameLoader; 60 class FrameLoader;
58 class MHTMLArchive; 61 class MHTMLArchive;
59 class ResourceLoader; 62 class ResourceLoader;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 void prepareSubframeArchiveLoadIfNeeded(); 172 void prepareSubframeArchiveLoadIfNeeded();
170 173
171 void willSendRequest(ResourceRequest&, const ResourceResponse&); 174 void willSendRequest(ResourceRequest&, const ResourceResponse&);
172 void finishedLoading(double finishTime); 175 void finishedLoading(double finishTime);
173 void mainReceivedError(const ResourceError&); 176 void mainReceivedError(const ResourceError&);
174 void cancelLoadAfterXFrameOptionsOrCSPDenied(const ResourceResponse&); 177 void cancelLoadAfterXFrameOptionsOrCSPDenied(const ResourceResponse&);
175 void redirectReceived(Resource*, ResourceRequest&, const ResourceResponse&) final; 178 void redirectReceived(Resource*, ResourceRequest&, const ResourceResponse&) final;
176 void updateRequest(Resource*, const ResourceRequest&) final; 179 void updateRequest(Resource*, const ResourceRequest&) final;
177 void responseReceived(Resource*, const ResourceResponse&, PassOwnPtr<WebData ConsumerHandle>) final; 180 void responseReceived(Resource*, const ResourceResponse&, PassOwnPtr<WebData ConsumerHandle>) final;
178 void dataReceived(Resource*, const char* data, unsigned length) final; 181 void dataReceived(Resource*, const char* data, unsigned length) final;
182 void processData(const char* data, unsigned length);
179 void notifyFinished(Resource*) final; 183 void notifyFinished(Resource*) final;
180 184
181 bool maybeLoadEmpty(); 185 bool maybeLoadEmpty();
182 186
183 bool isRedirectAfterPost(const ResourceRequest&, const ResourceResponse&); 187 bool isRedirectAfterPost(const ResourceRequest&, const ResourceResponse&);
184 188
185 bool shouldContinueForResponse() const; 189 bool shouldContinueForResponse() const;
186 190
187 RawPtrWillBeMember<LocalFrame> m_frame; 191 RawPtrWillBeMember<LocalFrame> m_frame;
188 PersistentWillBeMember<ResourceFetcher> m_fetcher; 192 PersistentWillBeMember<ResourceFetcher> m_fetcher;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 InitialScrollState m_initialScrollState; 229 InitialScrollState m_initialScrollState;
226 230
227 enum State { 231 enum State {
228 NotStarted, 232 NotStarted,
229 Provisional, 233 Provisional,
230 Committed, 234 Committed,
231 DataReceived, 235 DataReceived,
232 MainResourceDone 236 MainResourceDone
233 }; 237 };
234 State m_state; 238 State m_state;
239
240 // Used to protect against reentrancy into dataReceived().
241 bool m_inDataReceived;
242 Deque<OwnPtr<Vector<char>>> m_dataQueue;
Nate Chapin 2015/08/05 18:27:06 I assume the OwnPtr here is actually necessary (or
dcheng 2015/08/05 21:57:12 It's to save a copy. If we could use std::move() a
235 }; 243 };
236 244
237 DECLARE_WEAK_IDENTIFIER_MAP(DocumentLoader); 245 DECLARE_WEAK_IDENTIFIER_MAP(DocumentLoader);
238 246
239 } // namespace blink 247 } // namespace blink
240 248
241 #endif // DocumentLoader_h 249 #endif // DocumentLoader_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/loader/DocumentLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698