Bug 137664

Summary: Add StringCapture helper for thread-safe lambda capture
Product: WebKit Reporter: Antti Koivisto <koivisto>
Component: Web Template FrameworkAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, benjamin, cmarcelo, commit-queue, zan
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch andersca: review+

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