 Chromium Code Reviews
 Chromium Code Reviews Issue 1263363005:
  Better handle reentrancy into DocumentLoader::dataReceived().  (Closed) 
  Base URL: svn://svn.chromium.org/blink/trunk
    
  
    Issue 1263363005:
  Better handle reentrancy into DocumentLoader::dataReceived().  (Closed) 
  Base URL: svn://svn.chromium.org/blink/trunk| Index: Source/core/loader/DocumentLoader.h | 
| diff --git a/Source/core/loader/DocumentLoader.h b/Source/core/loader/DocumentLoader.h | 
| index 69a160c4a66a272a265db155e0154a06900270a1..4af2c3d0d99c85915077a9c2b0c9c4976bbe5768 100644 | 
| --- a/Source/core/loader/DocumentLoader.h | 
| +++ b/Source/core/loader/DocumentLoader.h | 
| @@ -45,8 +45,11 @@ | 
| #include "platform/network/ResourceError.h" | 
| #include "platform/network/ResourceRequest.h" | 
| #include "platform/network/ResourceResponse.h" | 
| +#include "wtf/Deque.h" | 
| #include "wtf/HashSet.h" | 
| +#include "wtf/OwnPtr.h" | 
| #include "wtf/RefPtr.h" | 
| +#include "wtf/Vector.h" | 
| namespace blink { | 
| @@ -176,6 +179,7 @@ private: | 
| void updateRequest(Resource*, const ResourceRequest&) final; | 
| void responseReceived(Resource*, const ResourceResponse&, PassOwnPtr<WebDataConsumerHandle>) final; | 
| void dataReceived(Resource*, const char* data, unsigned length) final; | 
| + void processData(const char* data, unsigned length); | 
| void notifyFinished(Resource*) final; | 
| bool maybeLoadEmpty(); | 
| @@ -232,6 +236,10 @@ private: | 
| MainResourceDone | 
| }; | 
| State m_state; | 
| + | 
| + // Used to protect against reentrancy into dataReceived(). | 
| + bool m_inDataReceived; | 
| + 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
 | 
| }; | 
| DECLARE_WEAK_IDENTIFIER_MAP(DocumentLoader); |