Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: third_party/WebKit/Source/modules/fetch/BytesConsumer.cpp

Issue 2046203003: [Fetch API] Introduce BytesConsumer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698