| Index: third_party/WebKit/Source/modules/fetch/BytesConsumer.cpp
|
| diff --git a/third_party/WebKit/Source/modules/fetch/BytesConsumer.cpp b/third_party/WebKit/Source/modules/fetch/BytesConsumer.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..89eb71958c9c00425f658ea58c3b47c73524fa2f
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/modules/fetch/BytesConsumer.cpp
|
| @@ -0,0 +1,25 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "modules/fetch/BytesConsumer.h"
|
| +
|
| +#include <algorithm>
|
| +#include <string.h>
|
| +
|
| +namespace blink {
|
| +
|
| +BytesConsumer::Result BytesConsumer::read(char* buffer, size_t size, size_t* readSize)
|
| +{
|
| + *readSize = 0;
|
| + const char* src = nullptr;
|
| + size_t available;
|
| + Result r = beginRead(&src, &available);
|
| + if (r != Result::Ok)
|
| + return r;
|
| + *readSize = std::min(available, size);
|
| + memcpy(buffer, src, *readSize);
|
| + return endRead(*readSize);
|
| +}
|
| +
|
| +} // namespace blink
|
|
|