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

Unified Diff: Source/core/inspector/InspectorLayerTreeAgent.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 | « no previous file | Source/platform/graphics/ImageBuffer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorLayerTreeAgent.cpp
diff --git a/Source/core/inspector/InspectorLayerTreeAgent.cpp b/Source/core/inspector/InspectorLayerTreeAgent.cpp
index 27eb0d398047cde607bcd99e777f691e694f2dc3..3b101730427a787ca9ce8c4aebd06d7f698bf82e 100644
--- a/Source/core/inspector/InspectorLayerTreeAgent.cpp
+++ b/Source/core/inspector/InspectorLayerTreeAgent.cpp
@@ -53,6 +53,7 @@
#include "public/platform/WebFloatPoint.h"
#include "public/platform/WebLayer.h"
#include "wtf/text/Base64.h"
+#include "wtf/text/StringBuilder.h"
namespace blink {
@@ -383,7 +384,11 @@ void InspectorLayerTreeAgent::replaySnapshot(ErrorString* errorString, const Str
*errorString = "Image encoding failed";
return;
}
- *dataURL = "data:image/png;base64," + *base64Data;
+ StringBuilder url;
+ url.appendLiteral("data:image/png;base64,");
+ url.reserveCapacity(url.length() + base64Data->size());
+ url.append(base64Data->begin(), base64Data->size());
+ *dataURL = url.toString();
}
void InspectorLayerTreeAgent::profileSnapshot(ErrorString* errorString, const String& snapshotId, const int* minRepeatCount, const double* minDuration, RefPtr<TypeBuilder::Array<TypeBuilder::Array<double> > >& outTimings)
« no previous file with comments | « no previous file | Source/platform/graphics/ImageBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698