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

Unified Diff: Source/platform/graphics/ImageBuffer.cpp

Issue 559103002: Reduce memory peaks when generating data urls for images. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: toDataURL(): Fewer temporary coppies of image data Created 6 years, 3 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 | « Source/core/inspector/InspectorLayerTreeAgent.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/ImageBuffer.cpp
diff --git a/Source/platform/graphics/ImageBuffer.cpp b/Source/platform/graphics/ImageBuffer.cpp
index 4ea1880db0cb0eac0d88abebf9010ad21787cf92..d093ab330419ccf4708e03c9debb5ac9139a28da 100644
--- a/Source/platform/graphics/ImageBuffer.cpp
+++ b/Source/platform/graphics/ImageBuffer.cpp
@@ -420,10 +420,8 @@ String ImageBuffer::toDataURL(const String& mimeType, const double* quality) con
Vector<char> encodedImage;
if (!isSurfaceValid() || !encodeImage(m_surface->bitmap(), mimeType, quality, &encodedImage))
return "data:,";
- Vector<char> base64Data;
- base64Encode(encodedImage, base64Data);
- return "data:" + mimeType + ";base64," + base64Data;
+ return "data:" + mimeType + ";base64," + base64Encode(encodedImage);
}
String ImageDataToDataURL(const ImageDataBuffer& imageData, const String& mimeType, const double* quality)
@@ -434,10 +432,7 @@ String ImageDataToDataURL(const ImageDataBuffer& imageData, const String& mimeTy
if (!encodeImage(imageData, mimeType, quality, &encodedImage))
return "data:,";
- Vector<char> base64Data;
- base64Encode(encodedImage, base64Data);
-
- return "data:" + mimeType + ";base64," + base64Data;
+ return "data:" + mimeType + ";base64," + base64Encode(encodedImage);
}
} // namespace blink
« no previous file with comments | « Source/core/inspector/InspectorLayerTreeAgent.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698