Bug 20039 - Implement UString::adopt
Summary: Implement UString::adopt
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-15 02:30 PDT by Adam Barth
Modified: 2011-08-25 15:17 PDT (History)
2 users (show)

See Also:


Attachments
patch (2.09 KB, patch)
2008-07-15 02:30 PDT, Adam Barth
sam: review-
Details | Formatted Diff | Diff
non-perf tested version of what I was thinking (5.69 KB, patch)
2008-07-15 13:44 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Barth 2008-07-15 02:30:02 PDT
It is handy to be able to transfer ownership of a Vector<UChar> into a UString without having to memcpy the contents of the vector.  This can be done with the public API of UString, but it would be more convenient to have a UString::adopt(Vector<UChar>&) method.
Comment 1 Adam Barth 2008-07-15 02:30:41 PDT
Created attachment 22278 [details]
patch
Comment 2 Sam Weinig 2008-07-15 13:26:49 PDT
Comment on attachment 22278 [details]
patch

I would rather we remove non-copying version of the UString constructor and only use adopt.
Comment 3 Sam Weinig 2008-07-15 13:44:30 PDT
Created attachment 22287 [details]
non-perf tested version of what I was thinking
Comment 4 Adam Barth 2008-07-15 16:58:54 PDT
> I would rather we remove non-copying version of the UString constructor and
> only use adopt.  

Yes, that's a good idea.  The non-copying constructor is just asking for memory errors.
Comment 5 Gavin Barraclough 2011-08-25 15:17:25 PDT
This now exists!