| OLD | NEW |
| 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/DOMException.h" | 9 #include "core/dom/DOMException.h" |
| 10 #include "core/dom/ExceptionCode.h" | 10 #include "core/dom/ExceptionCode.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 virtual ~BlobHandleCallback() override { } | 53 virtual ~BlobHandleCallback() override { } |
| 54 DEFINE_INLINE_VIRTUAL_TRACE() | 54 DEFINE_INLINE_VIRTUAL_TRACE() |
| 55 { | 55 { |
| 56 visitor->trace(m_exception); | 56 visitor->trace(m_exception); |
| 57 BodyStreamBuffer::BlobHandleCreatorClient::trace(visitor); | 57 BodyStreamBuffer::BlobHandleCreatorClient::trace(visitor); |
| 58 } | 58 } |
| 59 virtual void didCreateBlobHandle(PassRefPtr<BlobDataHandle> blobHandle) over
ride | 59 virtual void didCreateBlobHandle(PassRefPtr<BlobDataHandle> blobHandle) over
ride |
| 60 { | 60 { |
| 61 m_blobHandle = blobHandle; | 61 m_blobHandle = blobHandle; |
| 62 } | 62 } |
| 63 virtual void didFail(PassRefPtrWillBeRawPtr<DOMException> exception) overrid
e | 63 virtual void didFail(DOMException* exception) override |
| 64 { | 64 { |
| 65 m_exception = exception; | 65 m_exception = exception; |
| 66 } | 66 } |
| 67 PassRefPtr<BlobDataHandle> blobHandle() | 67 PassRefPtr<BlobDataHandle> blobHandle() |
| 68 { | 68 { |
| 69 return m_blobHandle; | 69 return m_blobHandle; |
| 70 } | 70 } |
| 71 PassRefPtrWillBeRawPtr<DOMException> exception() | 71 DOMException* exception() |
| 72 { | 72 { |
| 73 return m_exception; | 73 return m_exception; |
| 74 } | 74 } |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 RefPtr<BlobDataHandle> m_blobHandle; | 77 RefPtr<BlobDataHandle> m_blobHandle; |
| 78 RefPtrWillBeMember<DOMException> m_exception; | 78 Member<DOMException> m_exception; |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 class MockCanceller : public BodyStreamBuffer::Canceller { | 81 class MockCanceller : public BodyStreamBuffer::Canceller { |
| 82 public: | 82 public: |
| 83 MockCanceller() : m_counter(0) { } | 83 MockCanceller() : m_counter(0) { } |
| 84 void cancel() override { ++m_counter; } | 84 void cancel() override { ++m_counter; } |
| 85 int counter() const { return m_counter; } | 85 int counter() const { return m_counter; } |
| 86 | 86 |
| 87 private: | 87 private: |
| 88 int m_counter; | 88 int m_counter; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 auto canceller = new MockCanceller; | 253 auto canceller = new MockCanceller; |
| 254 BodyStreamBuffer* buffer = new BodyStreamBuffer(canceller); | 254 BodyStreamBuffer* buffer = new BodyStreamBuffer(canceller); |
| 255 buffer->cancel(); | 255 buffer->cancel(); |
| 256 | 256 |
| 257 EXPECT_EQ(1, canceller->counter()); | 257 EXPECT_EQ(1, canceller->counter()); |
| 258 EXPECT_FALSE(buffer->isClosed()); | 258 EXPECT_FALSE(buffer->isClosed()); |
| 259 EXPECT_FALSE(buffer->hasError()); | 259 EXPECT_FALSE(buffer->hasError()); |
| 260 } | 260 } |
| 261 | 261 |
| 262 } // namespace blink | 262 } // namespace blink |
| OLD | NEW |