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

Side by Side Diff: third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp

Issue 1376153002: Clear BodyStreamBuffer::m_handle in close()/error() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit tests. Created 5 years, 2 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "modules/fetch/BodyStreamBuffer.h" 6 #include "modules/fetch/BodyStreamBuffer.h"
7 7
8 #include "core/dom/DOMArrayBuffer.h" 8 #include "core/dom/DOMArrayBuffer.h"
9 #include "core/dom/DOMTypedArray.h" 9 #include "core/dom/DOMTypedArray.h"
10 #include "core/dom/ExceptionCode.h" 10 #include "core/dom/ExceptionCode.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 } 187 }
188 return; 188 return;
189 } 189 }
190 processData(); 190 processData();
191 } 191 }
192 192
193 void BodyStreamBuffer::close() 193 void BodyStreamBuffer::close()
194 { 194 {
195 m_reader = nullptr; 195 m_reader = nullptr;
196 m_stream->close(); 196 m_stream->close();
197 m_handle.clear();
197 } 198 }
198 199
199 void BodyStreamBuffer::error() 200 void BodyStreamBuffer::error()
200 { 201 {
201 m_reader = nullptr; 202 m_reader = nullptr;
202 m_stream->error(DOMException::create(NetworkError, "network error")); 203 m_stream->error(DOMException::create(NetworkError, "network error"));
204 m_handle.clear();
203 } 205 }
204 206
205 void BodyStreamBuffer::processData() 207 void BodyStreamBuffer::processData()
206 { 208 {
207 ASSERT(m_reader); 209 ASSERT(m_reader);
208 while (m_streamNeedsMore) { 210 while (m_streamNeedsMore) {
209 const void* buffer; 211 const void* buffer;
210 size_t available; 212 size_t available;
211 WebDataConsumerHandle::Result result = m_reader->beginRead(&buffer, WebD ataConsumerHandle::FlagNone, &available); 213 WebDataConsumerHandle::Result result = m_reader->beginRead(&buffer, WebD ataConsumerHandle::FlagNone, &available);
212 switch (result) { 214 switch (result) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 unlock(); 250 unlock();
249 if (mode == EndLoadingDone) { 251 if (mode == EndLoadingDone) {
250 close(); 252 close();
251 } else { 253 } else {
252 ASSERT(mode == EndLoadingErrored); 254 ASSERT(mode == EndLoadingErrored);
253 error(); 255 error();
254 } 256 }
255 } 257 }
256 258
257 } // namespace blink 259 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698