Title: [221573] trunk/Source/WebCore
- Revision
- 221573
- Author
- [email protected]
- Date
- 2017-09-03 23:07:09 -0700 (Sun, 03 Sep 2017)
Log Message
Use StringView in DOMFileSystem::evaluatePath()
https://bugs.webkit.org/show_bug.cgi?id=176324
Reviewed by Darin Adler.
Use StringView in DOMFileSystem::evaluatePath() for performance.
* Modules/entriesapi/DOMFileSystem.cpp:
(WebCore::resolveRelativeVirtualPath):
(WebCore::DOMFileSystem::evaluatePath):
* Modules/entriesapi/DOMFileSystem.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (221572 => 221573)
--- trunk/Source/WebCore/ChangeLog 2017-09-04 06:04:39 UTC (rev 221572)
+++ trunk/Source/WebCore/ChangeLog 2017-09-04 06:07:09 UTC (rev 221573)
@@ -1,3 +1,17 @@
+2017-09-03 Chris Dumez <[email protected]>
+
+ Use StringView in DOMFileSystem::evaluatePath()
+ https://bugs.webkit.org/show_bug.cgi?id=176324
+
+ Reviewed by Darin Adler.
+
+ Use StringView in DOMFileSystem::evaluatePath() for performance.
+
+ * Modules/entriesapi/DOMFileSystem.cpp:
+ (WebCore::resolveRelativeVirtualPath):
+ (WebCore::DOMFileSystem::evaluatePath):
+ * Modules/entriesapi/DOMFileSystem.h:
+
2017-09-03 Yusuke Suzuki <[email protected]>
String#utf8() allocates new CString
Modified: trunk/Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp (221572 => 221573)
--- trunk/Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp 2017-09-04 06:04:39 UTC (rev 221572)
+++ trunk/Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp 2017-09-04 06:07:09 UTC (rev 221573)
@@ -191,7 +191,7 @@
virtualPathSegments.removeLast();
continue;
}
- virtualPathSegments.append(segment.toString());
+ virtualPathSegments.append(segment.toStringWithoutCopying());
}
if (virtualPathSegments.isEmpty())
@@ -206,14 +206,13 @@
}
// https://wicg.github.io/entries-api/#evaluate-a-path
-String DOMFileSystem::evaluatePath(const String& virtualPath)
+String DOMFileSystem::evaluatePath(StringView virtualPath)
{
ASSERT(virtualPath[0] == '/');
auto components = virtualPath.split('/');
Vector<String> resolvedComponents;
- resolvedComponents.reserveInitialCapacity(components.size());
- for (auto& component : components) {
+ for (auto component : components) {
if (component == ".")
continue;
if (component == "..") {
@@ -221,7 +220,7 @@
resolvedComponents.removeLast();
continue;
}
- resolvedComponents.uncheckedAppend(component);
+ resolvedComponents.append(component.toStringWithoutCopying());
}
return pathByAppendingComponents(m_rootPath, resolvedComponents);
Modified: trunk/Source/WebCore/Modules/entriesapi/DOMFileSystem.h (221572 => 221573)
--- trunk/Source/WebCore/Modules/entriesapi/DOMFileSystem.h 2017-09-04 06:04:39 UTC (rev 221572)
+++ trunk/Source/WebCore/Modules/entriesapi/DOMFileSystem.h 2017-09-04 06:07:09 UTC (rev 221573)
@@ -67,7 +67,7 @@
private:
explicit DOMFileSystem(Ref<File>&&);
- String evaluatePath(const String& virtualPath);
+ String evaluatePath(StringView virtualPath);
Ref<FileSystemEntry> fileAsEntry(ScriptExecutionContext&);
String m_name;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes