WebKit Bugzilla
Attachment 339622 Details for
Bug 185337
: Support instantiating a String with a StaticStringImpl{&, *}
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
Bug185337.patch (text/plain), 2.15 KB, created by
Daniel Bates
on 2018-05-04 18:53:11 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Daniel Bates
Created:
2018-05-04 18:53:11 PDT
Size:
2.15 KB
patch
obsolete
>Index: Source/WTF/ChangeLog >=================================================================== >--- Source/WTF/ChangeLog (revision 231394) >+++ Source/WTF/ChangeLog (working copy) >@@ -1,3 +1,20 @@ >+2018-05-04 Daniel Bates <dabates@apple.com> >+ >+ Support instantiating a String with a StaticStringImpl{&, *} >+ https://bugs.webkit.org/show_bug.cgi?id=185337 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Adds support for instantiating a String object with a const StaticStringImpl{&, *}. >+ It is safe to do this because StaticStringImpls are guaranteed to be immutable. This >+ immutability is guaranteed both at runtime (see [1] for more details) and by >+ convention of only instantiating a StaticStringImpl in a constexpr expression. >+ >+ [1] <https://trac.webkit.org/browser/trunk/Source/WTF/wtf/text/StringImpl.h?rev=231268#L330> >+ >+ * wtf/text/WTFString.h: >+ (WTF::String::String): >+ > 2018-05-04 Tim Horton <timothy_horton@apple.com> > > Shift to a lower-level framework for simplifying URLs >Index: Source/WTF/wtf/text/WTFString.h >=================================================================== >--- Source/WTF/wtf/text/WTFString.h (revision 231394) >+++ Source/WTF/wtf/text/WTFString.h (working copy) >@@ -115,8 +115,8 @@ public: > String(Ref<AtomicStringImpl>&&); > String(RefPtr<AtomicStringImpl>&&); > >- String(StaticStringImpl&); >- String(StaticStringImpl*); >+ String(const StaticStringImpl&); >+ String(const StaticStringImpl*); > > // Construct a string from a constant string literal. > WTF_EXPORT_PRIVATE String(ASCIILiteral); >@@ -468,13 +468,13 @@ inline String::String(RefPtr<AtomicStrin > { > } > >-inline String::String(StaticStringImpl& string) >- : m_impl(reinterpret_cast<StringImpl*>(&string)) >+inline String::String(const StaticStringImpl& string) >+ : m_impl(reinterpret_cast<StringImpl*>(const_cast<StaticStringImpl*>(&string))) > { > } > >-inline String::String(StaticStringImpl* string) >- : m_impl(reinterpret_cast<StringImpl*>(string)) >+inline String::String(const StaticStringImpl* string) >+ : m_impl(reinterpret_cast<StringImpl*>(const_cast<StaticStringImpl*>(string))) > { > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
dbates
:
review-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185337
: 339622