Title: [127604] trunk
- Revision
- 127604
- Author
- [email protected]
- Date
- 2012-09-05 10:05:40 -0700 (Wed, 05 Sep 2012)
Log Message
[EFL] Remove '+=' usage in String
https://bugs.webkit.org/show_bug.cgi?id=95808
Patch by Kangil Han <[email protected]> on 2012-09-05
Reviewed by Benjamin Poulain.
Replaced use of String operator '+=' with StringBuilder.append*() in order to adopt efficient String concatenation.
Source/WebKit/efl:
* ewk/ewk_frame.cpp:
(ewk_frame_source_get): Removed unnecessary strlen usage.
Tools:
* DumpRenderTree/efl/DumpRenderTreeChrome.cpp:
(descriptionSuitableForTestResult):
Modified Paths
Diff
Modified: trunk/Source/WebKit/efl/ChangeLog (127603 => 127604)
--- trunk/Source/WebKit/efl/ChangeLog 2012-09-05 16:44:31 UTC (rev 127603)
+++ trunk/Source/WebKit/efl/ChangeLog 2012-09-05 17:05:40 UTC (rev 127604)
@@ -1,3 +1,15 @@
+2012-09-05 Kangil Han <[email protected]>
+
+ [EFL] Remove '+=' usage in String
+ https://bugs.webkit.org/show_bug.cgi?id=95808
+
+ Reviewed by Benjamin Poulain.
+
+ Replaced use of String operator '+=' with StringBuilder.append*() in order to adopt efficient String concatenation.
+
+ * ewk/ewk_frame.cpp:
+ (ewk_frame_source_get): Removed unnecessary strlen usage.
+
2012-09-05 Kaustubh Atrawalkar <[email protected]>
[DRT] LTC:: Move printing related APIs from LayoutTestController to Internals
Modified: trunk/Source/WebKit/efl/ewk/ewk_frame.cpp (127603 => 127604)
--- trunk/Source/WebKit/efl/ewk/ewk_frame.cpp 2012-09-05 16:44:31 UTC (rev 127603)
+++ trunk/Source/WebKit/efl/ewk/ewk_frame.cpp 2012-09-05 17:05:40 UTC (rev 127604)
@@ -1638,7 +1638,7 @@
EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame->document(), -1);
EINA_SAFETY_ON_NULL_RETURN_VAL(frameSource, -1);
- WTF::String source;
+ StringBuilder builder;
*frameSource = 0; // Saves 0 to pointer until it's not allocated.
if (!smartData->frame->document()->isHTMLDocument()) {
@@ -1654,28 +1654,29 @@
if (node->hasTagName(WebCore::HTMLNames::htmlTag)) {
WebCore::HTMLElement* element = static_cast<WebCore::HTMLElement*>(node);
if (element)
- source = element->outerHTML();
+ builder.append(element->outerHTML());
break;
}
}
// Try to get <head> and <body> tags if <html> tag was not found.
- if (source.isEmpty()) {
+ if (builder.isEmpty()) {
if (smartData->frame->document()->head())
- source = smartData->frame->document()->head()->outerHTML();
+ builder.append(smartData->frame->document()->head()->outerHTML());
if (smartData->frame->document()->body())
- source += smartData->frame->document()->body()->outerHTML();
+ builder.append(smartData->frame->document()->body()->outerHTML());
}
- size_t sourceLength = strlen(source.utf8().data());
+ CString utf8String = builder.toString().utf8();
+ size_t sourceLength = utf8String.length();
*frameSource = static_cast<char*>(malloc(sourceLength + 1));
if (!*frameSource) {
CRITICAL("Could not allocate memory.");
return -1;
}
- strncpy(*frameSource, source.utf8().data(), sourceLength);
+ strncpy(*frameSource, utf8String.data(), sourceLength);
(*frameSource)[sourceLength] = '\0';
return sourceLength;
Modified: trunk/Tools/ChangeLog (127603 => 127604)
--- trunk/Tools/ChangeLog 2012-09-05 16:44:31 UTC (rev 127603)
+++ trunk/Tools/ChangeLog 2012-09-05 17:05:40 UTC (rev 127604)
@@ -1,3 +1,15 @@
+2012-09-05 Kangil Han <[email protected]>
+
+ [EFL] Remove '+=' usage in String
+ https://bugs.webkit.org/show_bug.cgi?id=95808
+
+ Reviewed by Benjamin Poulain.
+
+ Replaced use of String operator '+=' with StringBuilder.append*() in order to adopt efficient String concatenation.
+
+ * DumpRenderTree/efl/DumpRenderTreeChrome.cpp:
+ (descriptionSuitableForTestResult):
+
2012-09-05 Christophe Dumez <[email protected]>
[EFL][WK2] Provide implementation for TestRunner::pathToLocalResource()
Modified: trunk/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp (127603 => 127604)
--- trunk/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp 2012-09-05 16:44:31 UTC (rev 127603)
+++ trunk/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp 2012-09-05 17:05:40 UTC (rev 127604)
@@ -48,6 +48,7 @@
#include <Evas.h>
#include <cstdio>
#include <wtf/NotFound.h>
+#include <wtf/text/StringBuilder.h>
using namespace WebCore;
@@ -365,15 +366,20 @@
static CString descriptionSuitableForTestResult(Ewk_Frame_Resource_Request* request)
{
- String ret = "<NSURLRequest URL ";
- ret += pathSuitableForTestResult(request->url).data();
- ret += ", main document URL ";
- ret += urlSuitableForTestResult(request->first_party).data();
- ret += ", http method ";
- ret += request->http_method ? String(request->http_method) : "(none)";
- ret += ">";
+ StringBuilder builder;
+ builder.appendLiteral("<NSURLRequest URL ");
+ builder.append(pathSuitableForTestResult(request->url).data());
+ builder.appendLiteral(", main document URL ");
+ builder.append(urlSuitableForTestResult(request->first_party).data());
+ builder.appendLiteral(", http method ");
- return ret.utf8();
+ if (request->http_method)
+ builder.append(String(request->http_method));
+ else
+ builder.appendLiteral("(none)");
+
+ builder.append('>');
+ return builder.toString().utf8();
}
static CString descriptionSuitableForTestResult(const Ewk_Frame_Resource_Response* response)
@@ -381,13 +387,13 @@
if (!response)
return CString("(null)");
- String ret = "<NSURLResponse ";
- ret += pathSuitableForTestResult(response->url).data();
- ret += ", http status code ";
- ret += String::number(response->status_code);
- ret += ">";
-
- return ret.utf8();
+ StringBuilder builder;
+ builder.appendLiteral("<NSURLResponse ");
+ builder.append(pathSuitableForTestResult(response->url).data());
+ builder.appendLiteral(", http status code ");
+ builder.append(String::number(response->status_code));
+ builder.append('>');
+ return builder.toString().utf8();
}
static CString descriptionSuitableForTestResult(Ewk_Frame_Load_Error* error)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes