Bug 89562 - Regression(r116408): Ctrl-A (select all) on large text file hangs the tab with high CPU usage
Summary: Regression(r116408): Ctrl-A (select all) on large text file hangs the tab wit...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: All Windows 7
: P1 Normal
Assignee: Alexander Pavlov (apavlov)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-20 05:36 PDT by Alexander Pavlov (apavlov)
Modified: 2012-06-20 14:42 PDT (History)
7 users (show)

See Also:


Attachments
Patch (3.78 KB, patch)
2012-06-20 09:32 PDT, Alexander Pavlov (apavlov)
no flags Details | Formatted Diff | Diff
Patch (3.99 KB, patch)
2012-06-20 11:01 PDT, Tony Chang
no flags Details | Formatted Diff | Diff
Patch (4.96 KB, patch)
2012-06-20 12:42 PDT, Jacky Jiang
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Pavlov (apavlov) 2012-06-20 05:36:18 PDT
What steps will reproduce the problem?
1. Go to https://easylist-downloads.adblockplus.org/dutchadblocklist+easylist.txt or any other long *.txt URL
2. Press ctrl-A

What is the expected result?
Text gets selected

What happens instead?
Tab uses large amounts of CPU. Text doesn't get selected (at least not within a few minutes)

Please provide any additional information below. Attach a screenshot if possible.
-Worked fine in Chrome 20.
-Works fine for small text files.

Upstreaming http://code.google.com/p/chromium/issues/detail?id=129650
Comment 1 Alexander Pavlov (apavlov) 2012-06-20 09:32:10 PDT
Created attachment 148583 [details]
Patch
Comment 2 Build Bot 2012-06-20 10:01:10 PDT
Comment on attachment 148583 [details]
Patch

Attachment 148583 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/13002247
Comment 3 Alexey Proskuryakov 2012-06-20 10:22:27 PDT
This patch changes two platforms' code. Is that expected to cover all affected platforms?
Comment 4 Alexander Pavlov (apavlov) 2012-06-20 10:24:20 PDT
(In reply to comment #3)
> This patch changes two platforms' code. Is that expected to cover all affected platforms?

I believe we only have two Windows ports. At least, the offending patch changed exactly these two methods.
Comment 5 Alexey Proskuryakov 2012-06-20 10:27:23 PDT
> At least, the offending patch changed exactly these two methods.

OK
Comment 6 Tony Chang 2012-06-20 10:38:33 PDT
Comment on attachment 148583 [details]
Patch

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

> Source/WebCore/platform/chromium/ClipboardUtilitiesChromium.cpp:65
> +        ++index;
>      }

Nit: I would just make this a for loop.

> Source/WebCore/platform/chromium/ClipboardUtilitiesChromium.cpp:66
> +    str.swap(result.toString());

Looks like this doesn't compile, I bet you can't swap without holding a reference. I'll try and upload a fix.
Comment 7 Alexander Pavlov (apavlov) 2012-06-20 10:48:31 PDT
(In reply to comment #6)
> (From update of attachment 148583 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=148583&action=review
> 
> > Source/WebCore/platform/chromium/ClipboardUtilitiesChromium.cpp:65
> > +        ++index;
> >      }
> 
> Nit: I would just make this a for loop.

Oops, should have changed it... Will fix.

> > Source/WebCore/platform/chromium/ClipboardUtilitiesChromium.cpp:66
> > +    str.swap(result.toString());
> 
> Looks like this doesn't compile, I bet you can't swap without holding a reference. I'll try and upload a fix.

ANSI ISO/IEC 14882 section 13.3.3.1.4 allows binding a temporary to a const reference. As a data point, this built fine for me using MSVS 2008.
Comment 8 Tony Chang 2012-06-20 11:01:08 PDT
Created attachment 148606 [details]
Patch
Comment 9 Tony Chang 2012-06-20 11:02:48 PDT
(In reply to comment #7)
> (In reply to comment #6)
> > (From update of attachment 148583 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=148583&action=review
> > 
> > > Source/WebCore/platform/chromium/ClipboardUtilitiesChromium.cpp:66
> > > +    str.swap(result.toString());
> > 
> > Looks like this doesn't compile, I bet you can't swap without holding a reference. I'll try and upload a fix.
> 
> ANSI ISO/IEC 14882 section 13.3.3.1.4 allows binding a temporary to a const reference. As a data point, this built fine for me using MSVS 2008.

It turns out that we can just assign the value since WTF::String is internally ref counted.  I verified that this works for me on Linux (removed some of the #ifs to test).
Comment 10 WebKit Review Bot 2012-06-20 12:33:20 PDT
Comment on attachment 148606 [details]
Patch

Clearing flags on attachment: 148606

Committed r120850: <http://trac.webkit.org/changeset/120850>
Comment 11 WebKit Review Bot 2012-06-20 12:33:25 PDT
All reviewed patches have been landed.  Closing bug.
Comment 12 Jacky Jiang 2012-06-20 12:42:21 PDT
Reopening to attach new patch.
Comment 13 Jacky Jiang 2012-06-20 12:42:32 PDT
Created attachment 148630 [details]
Patch
Comment 14 Jacky Jiang 2012-06-20 12:44:46 PDT
Comment on attachment 148630 [details]
Patch

Oops, it was uploaded to the wrong bug by the tool... Sorry!