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

Unified Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 2235113002: Use StringView for String::append and ::insert. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix appendHex stuff. Created 4 years, 4 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
Index: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
index ec3b48206e6f0da15963f01768e62ad4a3a33ec1..748e130cb9231db90a7caeaf9129ed9d57511c39 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -514,28 +514,33 @@ private:
Member<WebGLRenderingContextBase> m_context;
};
-static void formatWebGLStatusString(const String& glInfo, const String& infostring, String& statusMessage)
+static void formatWebGLStatusString(const StringView& glInfo, const StringView& infoString, StringBuilder& builder)
{
- if (!infostring.isEmpty())
- statusMessage.append(", " + glInfo + " = " + infostring);
+ if (infoString.isEmpty())
+ return;
+ builder.append(", ");
+ builder.append(glInfo);
+ builder.append(" = ");
+ builder.append(infoString);
}
static String extractWebGLContextCreationError(const Platform::GraphicsInfo& info)
{
- String statusMessage("Could not create a WebGL context");
- formatWebGLStatusString("VENDOR", info.vendorId ? String::format("0x%04x", info.vendorId).utf8().data() : "0xffff", statusMessage);
- formatWebGLStatusString("DEVICE", info.deviceId ? String::format("0x%04x", info.deviceId).utf8().data() : "0xffff", statusMessage);
- formatWebGLStatusString("GL_VENDOR", info.vendorInfo.utf8().data(), statusMessage);
- formatWebGLStatusString("GL_RENDERER", info.rendererInfo.utf8().data(), statusMessage);
- formatWebGLStatusString("GL_VERSION", info.driverVersion.utf8().data(), statusMessage);
- formatWebGLStatusString("Sandboxed", info.sandboxed ? "yes" : "no", statusMessage);
- formatWebGLStatusString("Optimus", info.optimus ? "yes" : "no", statusMessage);
- formatWebGLStatusString("AMD switchable", info.amdSwitchable ? "yes" : "no", statusMessage);
- formatWebGLStatusString("Reset notification strategy", String::format("0x%04x", info.resetNotificationStrategy).utf8().data(), statusMessage);
- formatWebGLStatusString("GPU process crash count", String::number(info.processCrashCount).utf8().data(), statusMessage);
- formatWebGLStatusString("ErrorMessage", info.errorMessage.utf8().data(), statusMessage);
- statusMessage.append('.');
- return statusMessage;
+ StringBuilder builder;
+ builder.append("Could not create a WebGL context");
+ formatWebGLStatusString("VENDOR", info.vendorId ? String::format("0x%04x", info.vendorId) : "0xffff", builder);
+ formatWebGLStatusString("DEVICE", info.deviceId ? String::format("0x%04x", info.deviceId) : "0xffff", builder);
+ formatWebGLStatusString("GL_VENDOR", info.vendorInfo, builder);
+ formatWebGLStatusString("GL_RENDERER", info.rendererInfo, builder);
+ formatWebGLStatusString("GL_VERSION", info.driverVersion, builder);
+ formatWebGLStatusString("Sandboxed", info.sandboxed ? "yes" : "no", builder);
+ formatWebGLStatusString("Optimus", info.optimus ? "yes" : "no", builder);
+ formatWebGLStatusString("AMD switchable", info.amdSwitchable ? "yes" : "no", builder);
+ formatWebGLStatusString("Reset notification strategy", String::format("0x%04x", info.resetNotificationStrategy).utf8().data(), builder);
+ formatWebGLStatusString("GPU process crash count", String::number(info.processCrashCount), builder);
+ formatWebGLStatusString("ErrorMessage", info.errorMessage.utf8().data(), builder);
+ builder.append('.');
+ return builder.toString();
}
struct ContextProviderCreationInfo {

Powered by Google App Engine
This is Rietveld 408576698