Bug 137664 - Add StringCapture helper for thread-safe lambda capture
Summary: Add StringCapture helper for thread-safe lambda capture
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-13 11:45 PDT by Antti Koivisto
Modified: 2014-10-13 16:02 PDT (History)
5 users (show)

See Also:


Attachments
patch (2.08 KB, patch)
2014-10-13 13:43 PDT, Antti Koivisto
andersca: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antti Koivisto 2014-10-13 11:45:12 PDT
.
Comment 1 Antti Koivisto 2014-10-13 13:43:23 PDT
Created attachment 239740 [details]
patch
Comment 2 WebKit Commit Bot 2014-10-13 13:45:08 PDT
Attachment 239740 [details] did not pass style-queue:


ERROR: Source/WTF/wtf/text/WTFString.h:642:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/text/WTFString.h:643:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
Total errors found: 2 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Anders Carlsson 2014-10-13 13:47:22 PDT
Comment on attachment 239740 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=239740&action=review

> Source/WTF/wtf/text/WTFString.h:637
> +// For thread-safe lambda capture:

Could use a FIXME saying that once we use C++14 we don't need this.

> Source/WTF/wtf/text/WTFString.h:642
> +    explicit StringCapture(const String& string) : m_string(string) { }

I think you should add a move constructor as well.

> Source/WTF/wtf/text/WTFString.h:644
> +    const String& string() const { return m_string; }

Maybe add a

String string() releaseString { return m_string; }

as well? (Of course, in that case the lambda would have to be made mutable).
Comment 4 Antti Koivisto 2014-10-13 16:02:58 PDT
https://trac.webkit.org/r174660