Revert of Consolidate SkStream copying methods (patchset #1 id:1 of https://coderevie...
authormsarett <msarett@google.com>
Wed, 27 Jan 2016 20:06:22 +0000 (12:06 -0800)
committerCommit bot <commit-bot@chromium.org>
Wed, 27 Jan 2016 20:06:22 +0000 (12:06 -0800)
Reason for revert:
Test to see if this fixes the bots.

Original issue's description:
> Consolidate SkStream copying methods
>
> Make SkCopyStreamToData call SkStreamCopy, removing duplicate code.
>
> The former still has its own method of copying with a length, since
> it saves one copy.
>
> BUG=skia:4788
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1640793002
>
> Committed: https://skia.googlesource.com/skia/+/440c5a98dee428c661b77d149e30c794d264b8cd

TBR=halcanary@google.com,scroggo@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:4788

Review URL: https://codereview.chromium.org/1641853002

src/core/SkStream.cpp

index 80628d4..9529308 100644 (file)
@@ -890,9 +890,12 @@ SkData* SkCopyStreamToData(SkStream* stream) {
     }
 
     SkDynamicMemoryWStream tempStream;
-    if (!SkStreamCopy(&tempStream, stream)) {
-        return nullptr;
-    }
+    const size_t bufferSize = 4096;
+    char buffer[bufferSize];
+    do {
+        size_t bytesRead = stream->read(buffer, bufferSize);
+        tempStream.write(buffer, bytesRead);
+    } while (!stream->isAtEnd());
     return tempStream.copyToData();
 }