Index: Source/core/inspector/InspectorLayerTreeAgent.cpp |
diff --git a/Source/core/inspector/InspectorLayerTreeAgent.cpp b/Source/core/inspector/InspectorLayerTreeAgent.cpp |
index 27eb0d398047cde607bcd99e777f691e694f2dc3..88ae87c6f415a9cfb3a7db965ac4e3612ce61c7c 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; |
pdr.
2014/09/11 04:38:15
Any reason for not using reserveCapacity before ap
Daniel Bratell
2014/09/11 11:22:31
I don't think I had seen that document before. It
|
+ url.append("data:image/png;base64,"); |
Noel Gordon
2014/09/11 02:39:45
per https://trac.webkit.org/wiki/EfficientStrings,
|
+ url.reserveCapacity(url.length() + base64Data->size()); // Prevent over-allocation. |
Noel Gordon
2014/09/11 01:03:23
nit: remove the comment.
Daniel Bratell
2014/09/11 11:22:31
Done.
|
+ 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) |