| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "modules/fetch/BytesConsumer.h" |
| 6 |
| 7 #include <algorithm> |
| 8 #include <string.h> |
| 9 |
| 10 namespace blink { |
| 11 |
| 12 BytesConsumer::Result BytesConsumer::read(char* buffer, size_t size, size_t* rea
dSize) |
| 13 { |
| 14 *readSize = 0; |
| 15 const char* src = nullptr; |
| 16 size_t available; |
| 17 Result r = beginRead(&src, &available); |
| 18 if (r != Result::Ok) |
| 19 return r; |
| 20 *readSize = std::min(available, size); |
| 21 memcpy(buffer, src, *readSize); |
| 22 return endRead(*readSize); |
| 23 } |
| 24 |
| 25 } // namespace blink |
| OLD | NEW |