Bug 68135 - [chromium] CCLayerTreeHost shouldn't be RefCounted
Summary: [chromium] CCLayerTreeHost shouldn't be RefCounted
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: James Robinson
URL:
Keywords:
Depends on:
Blocks: 66995
  Show dependency treegraph
 
Reported: 2011-09-14 18:05 PDT by James Robinson
Modified: 2013-04-11 15:20 PDT (History)
7 users (show)

See Also:


Attachments
just FYI, webgl printing is broken (39.25 KB, patch)
2011-09-14 18:06 PDT, James Robinson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James Robinson 2011-09-14 18:05:16 PDT
[chromium] CCLayerTreeHost shouldn't be RefCounted
Comment 1 James Robinson 2011-09-14 18:06:15 PDT
Created attachment 107431 [details]
just FYI, webgl printing is broken
Comment 2 Adrienne Walker 2011-09-15 10:05:47 PDT
Comment on attachment 107431 [details]
just FYI, webgl printing is broken

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

> Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp:-89
> -    RenderLayerBacking* backing = static_cast<RenderLayerBacking*>(m_owner->client());
> -    if (!backing || backing->paintingGoesToWindow())
> -        return;
> -

Can you remind me why we had these checks originally, but why we don't need them now?

> Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp:-156
> -void VideoLayerChromium::setLayerTreeHost(CCLayerTreeHost* host)
> -{
> -    if (host && layerTreeHost() != host) {
> -        for (size_t i = 0; i < 3; ++i) {
> -            m_textures[i].m_visibleSize = IntSize();
> -            m_textures[i].m_texture = ManagedTexture::create(host->contentsTextureManager());
> -        }
> -    }

We don't need this because we don't ever destroy the CCLayerTreeHost once we've created it? I guess I probably should have removed that earlier, then.

> Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp:127
> +    if (CCLayerTreeHost::animating() && m_contextSupportsRateLimitingExtension && !m_rateLimitingTimer.isActive())

This static function call here has some code smell to it, but from comments elsewhere it looks like this is only temporary.

> Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp:235
> -void CCLayerTreeHost::clearRenderSurfacesRecursive(LayerChromium* layer)
> +void CCLayerTreeHost::clearStuffRecursive(LayerChromium* layer)

Why is the original name not valid?

> Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp:576
>  bool WebMediaPlayerClientImpl::acceleratedRenderingInUse()
>  {
> -    return m_videoLayer.get() && m_videoLayer->layerTreeHost();
> +    return m_videoLayer;
>  }

Given that we never clear the LayerTreeHost (or LayerRendererChromium in the past) from WebViewImpl, this makes the condition consistent on the first time a page goes composited before the LayerTreeHost gets created.  However, my only confusion is why the check for the LTH/LRC was needed in the first place.

> Source/WebKit/chromium/src/WebViewImpl.h:575
> -    RefPtr<WebCore::CCLayerTreeHost> m_layerTreeHost;
> +    OwnPtr<WebCore::CCLayerTreeHost> m_layerTreeHost;

\o/
Comment 3 Antoine Labour 2011-09-15 10:55:59 PDT
(In reply to comment #2)
> (From update of attachment 107431 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=107431&action=review
> 
> > Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp:-89
> > -    RenderLayerBacking* backing = static_cast<RenderLayerBacking*>(m_owner->client());
> > -    if (!backing || backing->paintingGoesToWindow())
> > -        return;
> > -
> 
> Can you remind me why we had these checks originally, but why we don't need them now?

BTW they've already been removed by https://bug-67750-attachments.webkit.org/attachment.cgi?id=107377 (see comments in the bug).
> 
> > Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp:-156
> > -void VideoLayerChromium::setLayerTreeHost(CCLayerTreeHost* host)
> > -{
> > -    if (host && layerTreeHost() != host) {
> > -        for (size_t i = 0; i < 3; ++i) {
> > -            m_textures[i].m_visibleSize = IntSize();
> > -            m_textures[i].m_texture = ManagedTexture::create(host->contentsTextureManager());
> > -        }
> > -    }
> 
> We don't need this because we don't ever destroy the CCLayerTreeHost once we've created it? I guess I probably should have removed that earlier, then.
> 
> > Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp:127
> > +    if (CCLayerTreeHost::animating() && m_contextSupportsRateLimitingExtension && !m_rateLimitingTimer.isActive())
> 
> This static function call here has some code smell to it, but from comments elsewhere it looks like this is only temporary.
>  
> > Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp:235
> > -void CCLayerTreeHost::clearRenderSurfacesRecursive(LayerChromium* layer)
> > +void CCLayerTreeHost::clearStuffRecursive(LayerChromium* layer)
> 
> Why is the original name not valid?

That function was removed by https://bug-67883-attachments.webkit.org/attachment.cgi?id=107434 anyway.
If you rebase, you can trim a bunch of stuff!

> 
> > Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp:576
> >  bool WebMediaPlayerClientImpl::acceleratedRenderingInUse()
> >  {
> > -    return m_videoLayer.get() && m_videoLayer->layerTreeHost();
> > +    return m_videoLayer;
> >  }
> 
> Given that we never clear the LayerTreeHost (or LayerRendererChromium in the past) from WebViewImpl, this makes the condition consistent on the first time a page goes composited before the LayerTreeHost gets created.  However, my only confusion is why the check for the LTH/LRC was needed in the first place.
> 
> > Source/WebKit/chromium/src/WebViewImpl.h:575
> > -    RefPtr<WebCore::CCLayerTreeHost> m_layerTreeHost;
> > +    OwnPtr<WebCore::CCLayerTreeHost> m_layerTreeHost;
> 
> \o/
Comment 4 James Robinson 2011-09-15 13:17:52 PDT
(In reply to comment #2)
> > Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp:-156
> > -void VideoLayerChromium::setLayerTreeHost(CCLayerTreeHost* host)
> > -{
> > -    if (host && layerTreeHost() != host) {
> > -        for (size_t i = 0; i < 3; ++i) {
> > -            m_textures[i].m_visibleSize = IntSize();
> > -            m_textures[i].m_texture = ManagedTexture::create(host->contentsTextureManager());
> > -        }
> > -    }
> 
> We don't need this because we don't ever destroy the CCLayerTreeHost once we've created it? I guess I probably should have removed that earlier, then.

It's not a straight delete - I added some code in reserveTexture() as well.

> 
> > Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp:127
> > +    if (CCLayerTreeHost::animating() && m_contextSupportsRateLimitingExtension && !m_rateLimitingTimer.isActive())
> 
> This static function call here has some code smell to it, but from comments elsewhere it looks like this is only temporary.

I actually think that this is permanent.  "am I animating right now?" is a process-wide piece of state, so I think having a static getter is reasonable (we can only animate from one thread and even if we have a bunch of different WebViewImpls only one can animate at a time)

> > Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp:576
> >  bool WebMediaPlayerClientImpl::acceleratedRenderingInUse()
> >  {
> > -    return m_videoLayer.get() && m_videoLayer->layerTreeHost();
> > +    return m_videoLayer;
> >  }
> 
> Given that we never clear the LayerTreeHost (or LayerRendererChromium in the past) from WebViewImpl, this makes the condition consistent on the first time a page goes composited before the LayerTreeHost gets created.  However, my only confusion is why the check for the LTH/LRC was needed in the first place.

I have no idea actually - I've never really looked at WebMediaPlayerClientImpl before and most of the code in it seems really wrong.  I only changed this because stuff didn't compile, and this change makes the tests continue to pass.  I will take a more careful look at what this is trying to do before landing.