Bug 171405 - Add StringView::toExistingAtomicString()
Summary: Add StringView::toExistingAtomicString()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Local Build
Hardware: All All
: P2 Normal
Assignee: Daniel Bates
URL:
Keywords:
Depends on:
Blocks: 170925
  Show dependency treegraph
 
Reported: 2017-04-27 16:33 PDT by Daniel Bates
Modified: 2017-04-28 14:46 PDT (History)
8 users (show)

See Also:


Attachments
Patch (4.89 KB, patch)
2017-04-27 16:55 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff
Patch (4.87 KB, patch)
2017-04-27 16:56 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2017-04-27 16:33:45 PDT
As suggested by Darin Adler in bug #170925, comment 7 and echoed by Sam Weinig in bug #170925, comment 14, we should add the convenience function StringView::toExistingAtomicString() to return an existing AtomicStringImpl for the string represented by the StringView if one exists. Returning an existing atomic string is more efficient than creating a new one using StringView::toAtomicString().
Comment 1 Daniel Bates 2017-04-27 16:55:14 PDT
Created attachment 308479 [details]
Patch

Is there a reason for the AtomicStringImpl::lookUp() functions taking a non-const pointer to a LChar/UChar? I mean, AtomicStringImpl does not mutate the LChar/UChar* buffer passed when performing a lookup. I am unclear how we came to the decision to have these functions (formerley named AtomicString::find()) take non-const pointers to buffers other than to match the non-constness of the buffer passed by the callers that motiviated the addition of these lookup functions in <http://trac.webkit.org/changeset/168256> (bug #132548). We seemed to explicitly avoid making these lookup functions take a const pointer to a buffer and added AtomicString::findInternal() when we later moved and renamed AtomicString::find() to AtomicStringImpl::lookUp() in <https://trac.webkit.org/changeset/182915> (bug #43404). Why?
Comment 2 Daniel Bates 2017-04-27 16:56:39 PDT
Created attachment 308480 [details]
Patch
Comment 3 Andreas Kling 2017-04-28 06:28:19 PDT
Comment on attachment 308480 [details]
Patch

r=me :)
Comment 4 Daniel Bates 2017-04-28 14:22:23 PDT
Comment on attachment 308480 [details]
Patch

Clearing flags on attachment: 308480

Committed r215947: <http://trac.webkit.org/changeset/215947>
Comment 5 Daniel Bates 2017-04-28 14:22:25 PDT
All reviewed patches have been landed.  Closing bug.