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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 memcpy(buffer, src, *readSize); | 325 memcpy(buffer, src, *readSize); |
326 return endRead(*readSize); | 326 return endRead(*readSize); |
327 } | 327 } |
328 | 328 |
329 void BytesConsumer::tee(ExecutionContext* executionContext, BytesConsumer* src,
BytesConsumer** dest1, BytesConsumer** dest2) | 329 void BytesConsumer::tee(ExecutionContext* executionContext, BytesConsumer* src,
BytesConsumer** dest1, BytesConsumer** dest2) |
330 { | 330 { |
331 RefPtr<BlobDataHandle> blobDataHandle = src->drainAsBlobDataHandle(BlobSizeP
olicy::AllowBlobWithInvalidSize); | 331 RefPtr<BlobDataHandle> blobDataHandle = src->drainAsBlobDataHandle(BlobSizeP
olicy::AllowBlobWithInvalidSize); |
332 if (blobDataHandle) { | 332 if (blobDataHandle) { |
333 // Register a client in order to be consistent. | 333 // Register a client in order to be consistent. |
334 src->setClient(new NoopClient); | 334 src->setClient(new NoopClient); |
335 // TODO(yhirano): Do not use FetchBlobDataConsumerHandle. | 335 *dest1 = new BlobBytesConsumer(executionContext, blobDataHandle); |
336 *dest1 = new BytesConsumerForDataConsumerHandle(executionContext, FetchB
lobDataConsumerHandle::create(executionContext, blobDataHandle)); | 336 *dest2 = new BlobBytesConsumer(executionContext, blobDataHandle); |
337 *dest2 = new BytesConsumerForDataConsumerHandle(executionContext, FetchB
lobDataConsumerHandle::create(executionContext, blobDataHandle)); | |
338 return; | 337 return; |
339 } | 338 } |
340 | 339 |
341 Tee* tee = new Tee(executionContext, src); | 340 Tee* tee = new Tee(executionContext, src); |
342 *dest1 = tee->destination1(); | 341 *dest1 = tee->destination1(); |
343 *dest2 = tee->destination2(); | 342 *dest2 = tee->destination2(); |
344 } | 343 } |
345 | 344 |
346 } // namespace blink | 345 } // namespace blink |
OLD | NEW |