Title: [221306] trunk/Source/WebCore
- Revision
- 221306
- Author
- dba...@webkit.org
- Date
- 2017-08-29 11:08:54 -0700 (Tue, 29 Aug 2017)
Log Message
CacheQueryOptions::isolatedCopy() copies the cache name twice
https://bugs.webkit.org/show_bug.cgi?id=175974
Reviewed by Youenn Fablet.
Currently CacheQueryOptions has a user-defined constructor that calls String.isolatedCopy()
on the passed cache name. CacheQueryOptions::isolatedCopy() also calls String.isolatedCopy()
on the cache name before passing the result to the user-defined constructor; => we malloc
and copy the cache name twice. Ideally we would remove the user-defined constructors and
have callers use aggregate initializer syntax to instantiate a CacheQueryOptions. Unfortunately
we cannot do this until we upgrade from Visual Studio 2015 to Visual Studio 2017 as the former
does not support non-static data member initializers (NSDMI) for aggregates and CacheQueryOptions
has some. Therefore we modify the user-defined, non-default, constructor to take a String&&
and conditionally compile the the constructors when building with compilers that do not
support NSDMI for aggregates.
* Modules/cache/CacheQueryOptions.h:
(WebCore::CacheQueryOptions::CacheQueryOptions):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (221305 => 221306)
--- trunk/Source/WebCore/ChangeLog 2017-08-29 17:43:51 UTC (rev 221305)
+++ trunk/Source/WebCore/ChangeLog 2017-08-29 18:08:54 UTC (rev 221306)
@@ -1,3 +1,24 @@
+2017-08-29 Daniel Bates <daba...@apple.com>
+
+ CacheQueryOptions::isolatedCopy() copies the cache name twice
+ https://bugs.webkit.org/show_bug.cgi?id=175974
+
+ Reviewed by Youenn Fablet.
+
+ Currently CacheQueryOptions has a user-defined constructor that calls String.isolatedCopy()
+ on the passed cache name. CacheQueryOptions::isolatedCopy() also calls String.isolatedCopy()
+ on the cache name before passing the result to the user-defined constructor; => we malloc
+ and copy the cache name twice. Ideally we would remove the user-defined constructors and
+ have callers use aggregate initializer syntax to instantiate a CacheQueryOptions. Unfortunately
+ we cannot do this until we upgrade from Visual Studio 2015 to Visual Studio 2017 as the former
+ does not support non-static data member initializers (NSDMI) for aggregates and CacheQueryOptions
+ has some. Therefore we modify the user-defined, non-default, constructor to take a String&&
+ and conditionally compile the the constructors when building with compilers that do not
+ support NSDMI for aggregates.
+
+ * Modules/cache/CacheQueryOptions.h:
+ (WebCore::CacheQueryOptions::CacheQueryOptions):
+
2017-08-29 Youenn Fablet <you...@apple.com>
CanvasCaptureMediaStreamTrack clone is not a CanvasCaptureMediaStreamTrack
Modified: trunk/Source/WebCore/Modules/cache/CacheQueryOptions.h (221305 => 221306)
--- trunk/Source/WebCore/Modules/cache/CacheQueryOptions.h 2017-08-29 17:43:51 UTC (rev 221305)
+++ trunk/Source/WebCore/Modules/cache/CacheQueryOptions.h 2017-08-29 18:08:54 UTC (rev 221306)
@@ -30,8 +30,16 @@
namespace WebCore {
struct CacheQueryOptions {
+#if !COMPILER_SUPPORTS(NSDMI_FOR_AGGREGATES)
CacheQueryOptions() = default;
- CacheQueryOptions(bool ignoreSearch, bool ignoreMethod, bool ignoreVary, String cacheName);
+ CacheQueryOptions(bool ignoreSearch, bool ignoreMethod, bool ignoreVary, String&& cacheName)
+ : ignoreSearch { ignoreSearch }
+ , ignoreMethod { ignoreMethod }
+ , ignoreVary { ignoreVary }
+ , cacheName { WTFMove(cacheName) }
+ {
+ }
+#endif
CacheQueryOptions isolatedCopy() const { return { ignoreSearch, ignoreMethod, ignoreVary, cacheName.isolatedCopy() }; }
bool ignoreSearch { false };
@@ -40,12 +48,4 @@
String cacheName;
};
-inline CacheQueryOptions::CacheQueryOptions(bool ignoreSearch, bool ignoreMethod, bool ignoreVary, String cacheName)
- : ignoreSearch(ignoreSearch)
- , ignoreMethod(ignoreMethod)
- , ignoreVary(ignoreVary)
- , cacheName(cacheName.isolatedCopy())
-{
-}
-
} // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes