Bug 80613 - [chromium] Clean up culling tests and templatize to test impl constructs
Summary: [chromium] Clean up culling tests and templatize to test impl constructs
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: Dana Jansens
URL:
Keywords:
Depends on: 80173 80752 80774
Blocks: 80741
  Show dependency treegraph
 
Reported: 2012-03-08 11:03 PST by Dana Jansens
Modified: 2012-03-12 08:50 PDT (History)
6 users (show)

See Also:


Attachments
Patch (218.76 KB, patch)
2012-03-08 11:05 PST, Dana Jansens
no flags Details | Formatted Diff | Diff
Patch (224.26 KB, patch)
2012-03-08 11:09 PST, Dana Jansens
no flags Details | Formatted Diff | Diff
Patch (223.88 KB, patch)
2012-03-09 10:14 PST, Dana Jansens
no flags Details | Formatted Diff | Diff
Patch (220.74 KB, patch)
2012-03-09 13:54 PST, Dana Jansens
no flags Details | Formatted Diff | Diff
Patch (220.89 KB, patch)
2012-03-10 11:14 PST, Dana Jansens
no flags Details | Formatted Diff | Diff
Patch (221.39 KB, patch)
2012-03-11 17:16 PDT, Dana Jansens
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dana Jansens 2012-03-08 11:03:20 PST
[chromium] Clean up culling tests and templatize to test impl constructs
Comment 1 Dana Jansens 2012-03-08 11:05:01 PST
Created attachment 130854 [details]
Patch

This is a large unit test cleanup, plus templatization so that we can run all the CCOcclusionTracker tests with both main and impl thread constructs.

While cleaning up, I made the test contain fewer LOC that are not relevant to the particular test, with helper methods in the parent test class.

Coverage remains the same.
Comment 2 Dana Jansens 2012-03-08 11:05:41 PST
This is built on top of bug #80173 so EWS should wait for it to land.
Comment 3 Dana Jansens 2012-03-08 11:09:43 PST
Created attachment 130855 [details]
Patch
Comment 4 Dana Jansens 2012-03-09 10:14:26 PST
Created attachment 131053 [details]
Patch
Comment 5 Dana Jansens 2012-03-09 10:44:00 PST
http://p.prom.corp.google.com/2124004
Comment 6 Adrienne Walker 2012-03-09 11:01:16 PST
Comment on attachment 131053 [details]
Patch

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

> Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp:275
> +    PassOwnPtr<LayerChromium> create(LayerChromium* parent)
> +    {
> +        RefPtr<LayerChromium> layer = LayerChromium::create();
> +        return adoptPtr(layer.release().leakRef());
> +    }

This is super super sketchy.  I know that this is "just" test code, but I don't like mixing RefPtr and OwnPtr like this, since the potential for accidentally freeing something with a RefPtr that some OwnPtr is still pointing at seems really huge.  And, even if ASAN doesn't get any indigestion from the current code, I don't trust future code to behave properly.

Can CCOcclusionTrackerTest typedef LayerPtr and PassLayerPtr to be the right OwnPtr or RefPtr, avoiding this problem? I think this would also allow you to merge some functions and m_layerChromium/m_layerImpl.

> Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp:317
> +        CCProxy::setCurrentThreadIsImplThread(true); \

I think you can use DebugScopedSetImplThread instead of calling setCurrentThreadIsImplThread anywhere in this patch.
Comment 7 Dana Jansens 2012-03-09 13:53:47 PST
(In reply to comment #6)
> (From update of attachment 131053 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=131053&action=review
> 
> > Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp:275
> > +    PassOwnPtr<LayerChromium> create(LayerChromium* parent)
> > +    {
> > +        RefPtr<LayerChromium> layer = LayerChromium::create();
> > +        return adoptPtr(layer.release().leakRef());
> > +    }
> 
> This is super super sketchy.  I know that this is "just" test code, but I don't like mixing RefPtr and OwnPtr like this, since the potential for accidentally freeing something with a RefPtr that some OwnPtr is still pointing at seems really huge.  And, even if ASAN doesn't get any indigestion from the current code, I don't trust future code to behave properly.
>
> Can CCOcclusionTrackerTest typedef LayerPtr and PassLayerPtr to be the right OwnPtr or RefPtr, avoiding this problem? I think this would also allow you to merge some functions and m_layerChromium/m_layerImpl.

Thanks for the brilliant idea to dump all the types into two classes and make the template on them. That really helped make this possible. Got rid of all the leakPtr weirdness.
 
> > Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp:317
> > +        CCProxy::setCurrentThreadIsImplThread(true); \
> 
> I think you can use DebugScopedSetImplThread instead of calling setCurrentThreadIsImplThread anywhere in this patch.

Done! Thanks for pointing it out.
Comment 8 Dana Jansens 2012-03-09 13:54:30 PST
Created attachment 131100 [details]
Patch
Comment 9 Dana Jansens 2012-03-09 13:55:56 PST
go/pastebin/2123005
Comment 10 Adrienne Walker 2012-03-09 14:19:53 PST
Comment on attachment 131100 [details]
Patch

Looks way better.  Thanks!  R=me
Comment 11 WebKit Review Bot 2012-03-09 17:24:24 PST
Comment on attachment 131100 [details]
Patch

Clearing flags on attachment: 131100

Committed r110353: <http://trac.webkit.org/changeset/110353>
Comment 12 WebKit Review Bot 2012-03-09 17:24:29 PST
All reviewed patches have been landed.  Closing bug.
Comment 13 Dana Jansens 2012-03-10 10:36:32 PST
Reopening to fix compile on other platforms.
Comment 14 Dana Jansens 2012-03-10 11:14:59 PST
Created attachment 131179 [details]
Patch

Fix build on mac. Missing this-> on calcDrawEtc() calls.
Comment 15 WebKit Review Bot 2012-03-10 18:37:54 PST
Comment on attachment 131179 [details]
Patch

Clearing flags on attachment: 131179

Committed r110384: <http://trac.webkit.org/changeset/110384>
Comment 16 WebKit Review Bot 2012-03-10 18:38:00 PST
All reviewed patches have been landed.  Closing bug.
Comment 17 Dana Jansens 2012-03-11 15:55:23 PDT
Reopening to fix win build!
Comment 18 Dana Jansens 2012-03-11 17:16:08 PDT
Created attachment 131261 [details]
Patch

Fix build on win. Missing a default constructor in each of the test classes. Ran a win & mac try job.
Comment 19 WebKit Review Bot 2012-03-12 08:50:44 PDT
Comment on attachment 131261 [details]
Patch

Clearing flags on attachment: 131261

Committed r110433: <http://trac.webkit.org/changeset/110433>
Comment 20 WebKit Review Bot 2012-03-12 08:50:59 PDT
All reviewed patches have been landed.  Closing bug.