Bug 24046 - Misc improvements to CString
Summary: Misc improvements to CString
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Darin Fisher (:fishd, Google)
Depends on:
Reported: 2009-02-19 16:35 PST by Darin Fisher (:fishd, Google)
Modified: 2009-02-20 07:31 PST (History)
1 user (show)

See Also:

v1 patch (4.74 KB, patch)
2009-02-19 16:51 PST, Darin Fisher (:fishd, Google)
eric: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Fisher (:fishd, Google) 2009-02-19 16:35:29 PST
Misc improvements to CString

1- Make it possible to initialize a CString from a CStringBuffer
2- Make it possible to get a CStringBuffer from a CString
3- Change CStringBuffer::data() to return a const pointer to ward off mutation
4- Remove unused releaseBuffer() methods.
5- Make CStringBuffer::create() private to force consumers to get a CStringBuffer from a CString.
Comment 1 Darin Fisher (:fishd, Google) 2009-02-19 16:51:37 PST
Created attachment 27816 [details]
v1 patch
Comment 2 Darin Fisher (:fishd, Google) 2009-02-19 16:52:53 PST
There is no consumer yet for CString::buffer() and the corresponding constructor, but I am brewing such a consumer that will live in the chromium WebKit layer.
Comment 3 Eric Seidel (no email) 2009-02-19 16:59:57 PST
Comment on attachment 27816 [details]
v1 patch

This looks fine.  It's kinda sad how we're growing a parallel string class here, but that happened long ago, and was inevitable based on how many APIs outside of WebKit depend on char* strings.  (And doesn't really relate to this patch.)

releaseBuffer() was not used anywhere?  I'm surprised.

Looks fine.
Comment 4 Eric Seidel (no email) 2009-02-19 17:04:13 PST
I see releaseBuffer was added:

2008-03-25  Brady Eidson  <beidson@apple.com>

        Reviewed by Anders

        Add the ability to transform a CString into a SharedBuffer to avoid copying data
        This is valuable to avoid copying a block of data for an upcoming patch

        * platform/SharedBuffer.cpp:
        * platform/SharedBuffer.h:

        * platform/text/CString.cpp:
        * platform/text/CString.h:

But I don't see the upcomming patch. :)
Comment 5 Darin Fisher (:fishd, Google) 2009-02-20 07:31:53 PST
Brady, please let me know if you want releaseBuffer added back.

Landed as http://trac.webkit.org/changeset/41105