OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "modules/fetch/BytesConsumer.h" | 5 #include "modules/fetch/BytesConsumer.h" |
6 | 6 |
7 #include "core/dom/ExecutionContext.h" | 7 #include "core/dom/ExecutionContext.h" |
8 #include "core/dom/TaskRunnerHelper.h" | 8 #include "core/dom/TaskRunnerHelper.h" |
9 #include "modules/fetch/BytesConsumerForDataConsumerHandle.h" | 9 #include "modules/fetch/BlobBytesConsumer.h" |
10 #include "modules/fetch/FetchBlobDataConsumerHandle.h" | 10 #include "modules/fetch/FetchBlobDataConsumerHandle.h" |
11 #include "platform/blob/BlobData.h" | 11 #include "platform/blob/BlobData.h" |
12 #include "public/platform/WebTaskRunner.h" | 12 #include "public/platform/WebTaskRunner.h" |
13 #include "wtf/Functional.h" | 13 #include "wtf/Functional.h" |
14 #include "wtf/RefPtr.h" | 14 #include "wtf/RefPtr.h" |
15 #include <algorithm> | 15 #include <algorithm> |
16 #include <string.h> | 16 #include <string.h> |
17 | 17 |
18 namespace blink { | 18 namespace blink { |
19 | 19 |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 }; | 317 }; |
318 | 318 |
319 } // namespace | 319 } // namespace |
320 | 320 |
321 void BytesConsumer::tee(ExecutionContext* executionContext, BytesConsumer* src,
BytesConsumer** dest1, BytesConsumer** dest2) | 321 void BytesConsumer::tee(ExecutionContext* executionContext, BytesConsumer* src,
BytesConsumer** dest1, BytesConsumer** dest2) |
322 { | 322 { |
323 RefPtr<BlobDataHandle> blobDataHandle = src->drainAsBlobDataHandle(BlobSizeP
olicy::AllowBlobWithInvalidSize); | 323 RefPtr<BlobDataHandle> blobDataHandle = src->drainAsBlobDataHandle(BlobSizeP
olicy::AllowBlobWithInvalidSize); |
324 if (blobDataHandle) { | 324 if (blobDataHandle) { |
325 // Register a client in order to be consistent. | 325 // Register a client in order to be consistent. |
326 src->setClient(new NoopClient); | 326 src->setClient(new NoopClient); |
327 // TODO(yhirano): Do not use FetchBlobDataConsumerHandle. | 327 *dest1 = new BlobBytesConsumer(executionContext, blobDataHandle); |
328 *dest1 = new BytesConsumerForDataConsumerHandle(executionContext, FetchB
lobDataConsumerHandle::create(executionContext, blobDataHandle)); | 328 *dest2 = new BlobBytesConsumer(executionContext, blobDataHandle); |
329 *dest2 = new BytesConsumerForDataConsumerHandle(executionContext, FetchB
lobDataConsumerHandle::create(executionContext, blobDataHandle)); | |
330 return; | 329 return; |
331 } | 330 } |
332 | 331 |
333 Tee* tee = new Tee(executionContext, src); | 332 Tee* tee = new Tee(executionContext, src); |
334 *dest1 = tee->destination1(); | 333 *dest1 = tee->destination1(); |
335 *dest2 = tee->destination2(); | 334 *dest2 = tee->destination2(); |
336 } | 335 } |
337 | 336 |
338 } // namespace blink | 337 } // namespace blink |
OLD | NEW |