Bug 126644 - Add WTF::StringView and use it for grammar checking
Summary: Add WTF::StringView and use it for grammar checking
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Anders Carlsson
URL:
Keywords:
Depends on:
Blocks: 118570
  Show dependency treegraph
 
Reported: 2014-01-08 09:10 PST by Anders Carlsson
Modified: 2014-01-22 13:21 PST (History)
9 users (show)

See Also:


Attachments
Patch (28.29 KB, patch)
2014-01-08 09:23 PST, Anders Carlsson
no flags Details | Formatted Diff | Diff
Patch (28.62 KB, patch)
2014-01-08 09:29 PST, Anders Carlsson
no flags Details | Formatted Diff | Diff
Patch (28.65 KB, patch)
2014-01-08 11:26 PST, Anders Carlsson
koivisto: review+
eflews.bot: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anders Carlsson 2014-01-08 09:10:21 PST
Add WTF::StringView and use it for grammar checking
Comment 1 Anders Carlsson 2014-01-08 09:23:32 PST
Created attachment 220638 [details]
Patch
Comment 2 WebKit Commit Bot 2014-01-08 09:24:24 PST
Attachment 220638 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WTF/ChangeLog', u'Source/WTF/GNUmakefile.list.am', u'Source/WTF/WTF.vcxproj/WTF.vcxproj', u'Source/WTF/WTF.vcxproj/WTF.vcxproj.filters', u'Source/WTF/WTF.xcodeproj/project.pbxproj', u'Source/WTF/wtf/CMakeLists.txt', u'Source/WTF/wtf/Forward.h', u'Source/WTF/wtf/text/StringView.h', u'Source/WebCore/ChangeLog', u'Source/WebCore/editing/TextCheckingHelper.cpp', u'Source/WebCore/loader/EmptyClients.h', u'Source/WebCore/platform/text/TextCheckerClient.h', u'Source/WebKit/efl/ChangeLog', u'Source/WebKit/efl/WebCoreSupport/EditorClientEfl.h', u'Source/WebKit/mac/ChangeLog', u'Source/WebKit/mac/WebCoreSupport/WebEditorClient.h', u'Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm', u'Source/WebKit2/ChangeLog', u'Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp', u'Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h', '--commit-queue']" exit_code: 1
ERROR: Source/WTF/wtf/text/StringView.h:27:  StringView_h is incorrect. #defined constants should use all uppercase names with words separated by underscores.  [readability/naming/define/constants] [4]
Total errors found: 1 in 20 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 EFL EWS Bot 2014-01-08 09:29:09 PST
Comment on attachment 220638 [details]
Patch

Attachment 220638 [details] did not pass efl-ews (efl):
Output: http://webkit-queues.appspot.com/results/5268129038991360
Comment 4 Anders Carlsson 2014-01-08 09:29:22 PST
Created attachment 220639 [details]
Patch
Comment 5 WebKit Commit Bot 2014-01-08 09:31:00 PST
Attachment 220639 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WTF/ChangeLog', u'Source/WTF/GNUmakefile.list.am', u'Source/WTF/WTF.vcxproj/WTF.vcxproj', u'Source/WTF/WTF.vcxproj/WTF.vcxproj.filters', u'Source/WTF/WTF.xcodeproj/project.pbxproj', u'Source/WTF/wtf/CMakeLists.txt', u'Source/WTF/wtf/Forward.h', u'Source/WTF/wtf/text/StringView.h', u'Source/WebCore/ChangeLog', u'Source/WebCore/editing/TextCheckingHelper.cpp', u'Source/WebCore/loader/EmptyClients.h', u'Source/WebCore/platform/text/TextCheckerClient.h', u'Source/WebKit/efl/ChangeLog', u'Source/WebKit/efl/WebCoreSupport/EditorClientEfl.h', u'Source/WebKit/mac/ChangeLog', u'Source/WebKit/mac/WebCoreSupport/WebEditorClient.h', u'Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm', u'Source/WebKit2/ChangeLog', u'Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp', u'Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h', '--commit-queue']" exit_code: 1
ERROR: Source/WTF/wtf/text/StringView.h:27:  StringView_h is incorrect. #defined constants should use all uppercase names with words separated by underscores.  [readability/naming/define/constants] [4]
Total errors found: 1 in 20 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 Anders Carlsson 2014-01-08 09:34:34 PST
Comment on attachment 220639 [details]
Patch

Oops, this obviously won't work for 8-bit strings that can be 1-byte aligned.
Comment 7 Anders Carlsson 2014-01-08 11:26:09 PST
Created attachment 220646 [details]
Patch
Comment 8 Antti Koivisto 2014-01-08 12:33:03 PST
Comment on attachment 220646 [details]
Patch

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

> Source/WTF/ChangeLog:11
> +        Add a new StringView class which is an immutable reference to either an 8-bit or a 16-bit string.
> +
> +        This makes it easier to pass substrings around without having to either copy string data
> +        or upconvert and use UChar pointers.

Might be good to mention std::string_view proposal since the name may be surprising.

> Source/WTF/wtf/text/StringView.h:36
> +// (This means that strings longer than 2 Gigabytes can not be represented. If that turns out to be
> +// a problem we can investigate alternative solutions).

Those parentheses seem unnecessary.
Comment 9 EFL EWS Bot 2014-01-08 12:53:14 PST
Comment on attachment 220646 [details]
Patch

Attachment 220646 [details] did not pass efl-wk2-ews (efl-wk2):
Output: http://webkit-queues.appspot.com/results/5487205254430720
Comment 10 Anders Carlsson 2014-01-08 13:15:27 PST
Committed r161518: <http://trac.webkit.org/changeset/161518>