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

Unified Diff: Source/web/ImageDecodeBench.cpp

Issue 1145373003: Copy SharedBuffer before calling decodeImageData (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@benchmarkEmail
Patch Set: Rebase Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/ImageDecodeBench.cpp
diff --git a/Source/web/ImageDecodeBench.cpp b/Source/web/ImageDecodeBench.cpp
index 2f6f2b47c90d68347c208ef1f0e10f18f6444e69..6067ab92d4bb7af5529b8f38ed176585be93807b 100644
--- a/Source/web/ImageDecodeBench.cpp
+++ b/Source/web/ImageDecodeBench.cpp
@@ -365,8 +365,14 @@ int main(int argc, char* argv[])
double totalTime = 0.0;
for (size_t i = 0; i < iterations; ++i) {
+ // Copy the SharedBuffer. Note that we do not want to call
+ // SharedBuffer::copy, which would merge all the segments. We want this
+ // to look just like it would receiving partial data off the web.
+ // After this call, data will have its segments merged, but not tempData.
+ RefPtr<SharedBuffer> tempData = SharedBuffer::create(data->data(), data->size());
+
double startTime = getCurrentTime();
- bool decoded = decodeImageData(data.get(), applyColorCorrection);
+ bool decoded = decodeImageData(tempData.get(), applyColorCorrection);
double elapsedTime = getCurrentTime() - startTime;
totalTime += elapsedTime;
if (!decoded) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698