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

Side by Side Diff: Source/modules/fetch/Body.cpp

Issue 1107793002: Oilpan: have DOMException be on the heap by default. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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 | « Source/modules/fetch/Body.h ('k') | Source/modules/fetch/BodyStreamBuffer.h » ('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/Body.h" 6 #include "modules/fetch/Body.h"
7 7
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "bindings/core/v8/ScriptState.h" 10 #include "bindings/core/v8/ScriptState.h"
(...skipping 17 matching lines...) Expand all
28 explicit BlobHandleReceiver(Body* body) 28 explicit BlobHandleReceiver(Body* body)
29 : m_body(body) 29 : m_body(body)
30 { 30 {
31 } 31 }
32 void didCreateBlobHandle(PassRefPtr<BlobDataHandle> handle) override 32 void didCreateBlobHandle(PassRefPtr<BlobDataHandle> handle) override
33 { 33 {
34 ASSERT(m_body); 34 ASSERT(m_body);
35 m_body->readAsyncFromBlob(handle); 35 m_body->readAsyncFromBlob(handle);
36 m_body = nullptr; 36 m_body = nullptr;
37 } 37 }
38 void didFail(PassRefPtrWillBeRawPtr<DOMException> exception) override 38 void didFail(DOMException* exception) override
39 { 39 {
40 ASSERT(m_body); 40 ASSERT(m_body);
41 m_body->didBlobHandleReceiveError(exception); 41 m_body->didBlobHandleReceiveError(exception);
42 m_body = nullptr; 42 m_body = nullptr;
43 } 43 }
44 DEFINE_INLINE_VIRTUAL_TRACE() 44 DEFINE_INLINE_VIRTUAL_TRACE()
45 { 45 {
46 BodyStreamBuffer::BlobHandleCreatorClient::trace(visitor); 46 BodyStreamBuffer::BlobHandleCreatorClient::trace(visitor);
47 visitor->trace(m_body); 47 visitor->trace(m_body);
48 } 48 }
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 m_bodyStreamBuffer->cancel(); 254 m_bodyStreamBuffer->cancel();
255 // We should not close the stream here, because it is canceller's 255 // We should not close the stream here, because it is canceller's
256 // responsibility. 256 // responsibility.
257 } else { 257 } else {
258 if (m_loader) 258 if (m_loader)
259 m_loader->cancel(); 259 m_loader->cancel();
260 close(); 260 close();
261 } 261 }
262 } 262 }
263 263
264 PassRefPtrWillBeRawPtr<DOMException> exception() 264 DOMException* exception()
265 { 265 {
266 if (m_state != Errored) 266 if (m_state != Errored)
267 return nullptr; 267 return nullptr;
268 if (m_bodyStreamBuffer) { 268 if (m_bodyStreamBuffer) {
269 ASSERT(m_bodyStreamBuffer->exception()); 269 ASSERT(m_bodyStreamBuffer->exception());
270 return m_bodyStreamBuffer->exception(); 270 return m_bodyStreamBuffer->exception();
271 } 271 }
272 return DOMException::create(NetworkError, "network error"); 272 return DOMException::create(NetworkError, "network error");
273 } 273 }
274 274
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 return; 578 return;
579 579
580 m_streamSource->error(); 580 m_streamSource->error();
581 if (m_resolver) { 581 if (m_resolver) {
582 // FIXME: We should reject the promise. 582 // FIXME: We should reject the promise.
583 m_resolver->resolve(""); 583 m_resolver->resolve("");
584 m_resolver.clear(); 584 m_resolver.clear();
585 } 585 }
586 } 586 }
587 587
588 void Body::didBlobHandleReceiveError(PassRefPtrWillBeRawPtr<DOMException> except ion) 588 void Body::didBlobHandleReceiveError(DOMException* exception)
589 { 589 {
590 if (!m_resolver) 590 if (!m_resolver)
591 return; 591 return;
592 m_streamSource->error(); 592 m_streamSource->error();
593 m_resolver->reject(exception); 593 m_resolver->reject(exception);
594 m_resolver.clear(); 594 m_resolver.clear();
595 } 595 }
596 596
597 } // namespace blink 597 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/fetch/Body.h ('k') | Source/modules/fetch/BodyStreamBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698