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