Bug 111919 - Coordinated Graphics: Unify messages related object's lifecycles into CoordinatedGraphicsState.
Summary: Coordinated Graphics: Unify messages related object's lifecycles into Coordin...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 104360 111948
  Show dependency treegraph
 
Reported: 2013-03-09 00:06 PST by Gwang Yoon Hwang
Modified: 2013-06-05 04:52 PDT (History)
12 users (show)

See Also:


Attachments
Patch (56.23 KB, patch)
2013-03-09 00:49 PST, Gwang Yoon Hwang
no flags Details | Formatted Diff | Diff
Patch (46.92 KB, patch)
2013-03-09 15:30 PST, Gwang Yoon Hwang
no flags Details | Formatted Diff | Diff
Patch (41.38 KB, patch)
2013-03-10 16:44 PDT, Gwang Yoon Hwang
no flags Details | Formatted Diff | Diff
Patch (41.32 KB, patch)
2013-03-11 00:17 PDT, Gwang Yoon Hwang
no flags Details | Formatted Diff | Diff
Patch (41.72 KB, patch)
2013-03-11 16:51 PDT, Gwang Yoon Hwang
no flags Details | Formatted Diff | Diff
Patch (41.77 KB, patch)
2013-03-14 22:30 PDT, Gwang Yoon Hwang
no flags Details | Formatted Diff | Diff
Patch (40.82 KB, patch)
2013-06-05 02:56 PDT, Gwang Yoon Hwang
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gwang Yoon Hwang 2013-03-09 00:06:31 PST
CoordinatedLayerTreeHostProxy has several methods, which simply passes
    these calls to CoordinatedGraphicsScene.
    
    This patch removes methods in CoordinatedLayerTreeHostProxy just for
    message chaining. Instead of that, messages for creation/deletion of objects
    (Layers, CustomFilters, UpdateAtlas, and ImageBacking) are unified into
    CommitCoordinatedGraphicsState.
    
    And this patch also removes codes for WebCoordinatedSurface in
    CoordinatedLayerTreeHost, except for a factory method.
    CoordinatedGraphicsArgumentCoders [en|de]codes CoordinatedSurface itself
    using WebCoordinatedSurface.
Comment 1 Gwang Yoon Hwang 2013-03-09 00:49:27 PST
Created attachment 192339 [details]
Patch
Comment 2 Noam Rosenthal 2013-03-09 01:06:37 PST
Comment on attachment 192339 [details]
Patch

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

This patch combines too many changes, though I support each of these changes individually.

> Source/WebKit2/ChangeLog:11
> +        This patch removes codes for WebCoordinatedSurface in
> +        CoordinatedLayerTreeHost, except for a factory method.
> +        Now, CoordinatedGraphicsArgumentCoders [en|de]codes CoordinatedSurface itself
> +        using WebCoordinatedSurface.

Does this really need to be part of this patch?

> Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:134
> -    if (m_coordinator) {
> +    if (m_client) {

Let's review this rename separately. I think it's ambiguous because CoordinatedGraphicsLayer already has a GraphicsLayerClient.

> Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp:276
> +void CoordinatedGraphicsScene::syncCustomFilterPrograms(const CoordinatedGraphicsState& state)

We really need to rename all those sync functions to flush... but that can be done separately.

> Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp:597
> -void CoordinatedGraphicsScene::clearImageBackingContents(CoordinatedImageBackingID imageID)
> +void CoordinatedGraphicsScene::clearImageBacking(CoordinatedImageBackingID imageID)

I prefer the old name, we clear the contents and not the reference.

> Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.h:42
> -    class Coordinator {
> +    class Client {

This rename is ok.

> Source/WebCore/platform/graphics/texmap/coordinated/UpdateAtlas.cpp:33
> -UpdateAtlas::UpdateAtlas(UpdateAtlasClient* client, int dimension, CoordinatedSurface::Flags flags)
> +UpdateAtlas::UpdateAtlas(Client* client, int dimension, CoordinatedSurface::Flags flags)

Ditto

> Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp:1087
> +#if ENABLE(CSS_SHADERS)
> +    encoder << static_cast<uint64_t>(state.customFiltersToCreate.size());
> +    for (size_t i = 0; i < state.customFiltersToCreate.size(); ++i) {
> +        encoder << state.customFiltersToCreate[i].first;
> +        encoder << state.customFiltersToCreate[i].second;
>      }
> +    encoder << state.customFiltersToRemove;
> +#endif

Have you run composited CSS shader tests to make sure they don't break?

> Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:140
> +    void resetPendingStateChanges();

I would call this clear instead of reset.
Comment 3 Gwang Yoon Hwang 2013-03-09 15:30:34 PST
Created attachment 192355 [details]
Patch
Comment 4 Gwang Yoon Hwang 2013-03-09 15:38:02 PST
(In reply to comment #2)
> (From update of attachment 192339 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=192339&action=review
> 
> This patch combines too many changes, though I support each of these changes individually.
> 
> > Source/WebKit2/ChangeLog:11
> > +        This patch removes codes for WebCoordinatedSurface in
> > +        CoordinatedLayerTreeHost, except for a factory method.
> > +        Now, CoordinatedGraphicsArgumentCoders [en|de]codes CoordinatedSurface itself
> > +        using WebCoordinatedSurface.
> 
> Does this really need to be part of this patch?
> 

Yes, because this patch makes CoordinatedGraphicsState to handle CoordinatedSurface, WebCoordinatedSurface is hidden from CoordinatedLayerTreeHost[Proxy]. 

> > Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:134
> > -    if (m_coordinator) {
> > +    if (m_client) {
> 
> Let's review this rename separately. I think it's ambiguous because CoordinatedGraphicsLayer already has a GraphicsLayerClient.
> 
> > Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp:276
> > +void CoordinatedGraphicsScene::syncCustomFilterPrograms(const CoordinatedGraphicsState& state)
> 
> We really need to rename all those sync functions to flush... but that can be done separately.
> 
I see.
Let's find out better names for that.

> > Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp:597
> > -void CoordinatedGraphicsScene::clearImageBackingContents(CoordinatedImageBackingID imageID)
> > +void CoordinatedGraphicsScene::clearImageBacking(CoordinatedImageBackingID imageID)
> 
> I prefer the old name, we clear the contents and not the reference.
> 
I agree. Good point. Changed.


> > Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp:1087
> > +#if ENABLE(CSS_SHADERS)
> > +    encoder << static_cast<uint64_t>(state.customFiltersToCreate.size());
> > +    for (size_t i = 0; i < state.customFiltersToCreate.size(); ++i) {
> > +        encoder << state.customFiltersToCreate[i].first;
> > +        encoder << state.customFiltersToCreate[i].second;
> >      }
> > +    encoder << state.customFiltersToRemove;
> > +#endif
> 
> Have you run composited CSS shader tests to make sure they don't break?

Yes, there was no regression in css3/filters tests.

> > Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:140
> > +    void resetPendingStateChanges();
> 
> I would call this clear instead of reset.
Good naming. I changed.
Comment 5 Noam Rosenthal 2013-03-10 08:46:03 PDT
Comment on attachment 192355 [details]
Patch

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

> Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.h:77
> -    Coordinator* m_coordinator;
> +    Client* m_client;

These renames are OK but let's do them in a different patch.

> Source/WebCore/platform/graphics/texmap/coordinated/UpdateAtlas.cpp:33
> -UpdateAtlas::UpdateAtlas(UpdateAtlasClient* client, int dimension, CoordinatedSurface::Flags flags)
> +UpdateAtlas::UpdateAtlas(Client* client, int dimension, CoordinatedSurface::Flags flags)

Ditto. OK to do both renames in the same patch, but not in the same patch as the state unification, as it makes commit history harder to read.

> Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:641
> -bool CoordinatedLayerTreeHost::createUpdateAtlas(uint32_t atlasID, PassRefPtr<CoordinatedSurface> coordinatedSurface)
> +void CoordinatedLayerTreeHost::createUpdateAtlas(uint32_t atlasID, PassRefPtr<CoordinatedSurface> surface)
>  {
> -    WebCoordinatedSurface* webCoordinatedSurface = static_cast<WebCoordinatedSurface*>(coordinatedSurface.get());
> -    WebCoordinatedSurface::Handle handle;
> -    if (!webCoordinatedSurface->createHandle(handle))
> -        return false;
> -    m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::CreateUpdateAtlas(atlasID, handle));
> -    return true;
> +    m_state.updateAtlasesToCreate.append(std::make_pair(atlasID, surface));

This feels like a change in behavior that belongs in a different patch.
Comment 6 Gwang Yoon Hwang 2013-03-10 16:44:16 PDT
Created attachment 192391 [details]
Patch
Comment 7 Gwang Yoon Hwang 2013-03-10 16:59:19 PDT
(In reply to comment #5)
> (From update of attachment 192355 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=192355&action=review
> 
> > Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.h:77
> > -    Coordinator* m_coordinator;
> > +    Client* m_client;
> 
> These renames are OK but let's do them in a different patch.
> 
> > Source/WebCore/platform/graphics/texmap/coordinated/UpdateAtlas.cpp:33
> > -UpdateAtlas::UpdateAtlas(UpdateAtlasClient* client, int dimension, CoordinatedSurface::Flags flags)
> > +UpdateAtlas::UpdateAtlas(Client* client, int dimension, CoordinatedSurface::Flags flags)
> 
> Ditto. OK to do both renames in the same patch, but not in the same patch as the state unification, as it makes commit history harder to read.
> 

I got it. I'm sorry i've missed your previous comment.
I made separate refactoring bug for that
https://bugs.webkit.org/show_bug.cgi?id=111948


> > Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:641
> > -bool CoordinatedLayerTreeHost::createUpdateAtlas(uint32_t atlasID, PassRefPtr<CoordinatedSurface> coordinatedSurface)
> > +void CoordinatedLayerTreeHost::createUpdateAtlas(uint32_t atlasID, PassRefPtr<CoordinatedSurface> surface)
> >  {
> > -    WebCoordinatedSurface* webCoordinatedSurface = static_cast<WebCoordinatedSurface*>(coordinatedSurface.get());
> > -    WebCoordinatedSurface::Handle handle;
> > -    if (!webCoordinatedSurface->createHandle(handle))
> > -        return false;
> > -    m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::CreateUpdateAtlas(atlasID, handle));
> > -    return true;
> > +    m_state.updateAtlasesToCreate.append(std::make_pair(atlasID, surface));
> 
> This feels like a change in behavior that belongs in a different patch.

This is needed in this patch. Because this patch delays encoding of CoordinatedSurface message until flush timing, we cannot know whether it is success in this timing.
Comment 8 Noam Rosenthal 2013-03-10 23:57:55 PDT
Comment on attachment 192391 [details]
Patch

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

OK, this looks good to me. Please ask a WK2 owner for sign off.

> Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:443
> +    // If a layer gets created and deleted in the same cycle, we can simply remove it from layersToCreate.

This is clear from the code, you don't need this comment.
Comment 9 Gwang Yoon Hwang 2013-03-11 00:17:37 PDT
Created attachment 192412 [details]
Patch
Comment 10 Gwang Yoon Hwang 2013-03-11 00:19:24 PDT
(In reply to comment #8)
> (From update of attachment 192391 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=192391&action=review
> 
> OK, this looks good to me. Please ask a WK2 owner for sign off.
> 
> > Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:443
> > +    // If a layer gets created and deleted in the same cycle, we can simply remove it from layersToCreate.
> 
> This is clear from the code, you don't need this comment.

Comment has been removed.
Thanks for review!
Comment 11 Gwang Yoon Hwang 2013-03-11 16:51:52 PDT
Created attachment 192595 [details]
Patch
Comment 12 Build Bot 2013-03-12 04:28:56 PDT
Comment on attachment 192595 [details]
Patch

Attachment 192595 [details] did not pass mac-ews (mac):
Output: http://webkit-commit-queue.appspot.com/results/17041239

New failing tests:
editing/selection/selection-modify-crash.html
Comment 13 Gwang Yoon Hwang 2013-03-14 22:30:32 PDT
Created attachment 193233 [details]
Patch

Rebased after r145871
Comment 14 Gwang Yoon Hwang 2013-06-05 02:56:48 PDT
Created attachment 203777 [details]
Patch
Comment 15 Noam Rosenthal 2013-06-05 03:02:22 PDT
Comment on attachment 203777 [details]
Patch

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

Great! but has a couple of unrelated changes

> Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:118
> -    // If sending the message fails, try again in the next update.
> -    bool success = m_coordinator->updateImageBacking(id(), m_surface);
> -    m_isDirty = !success;
> +    m_coordinator->updateImageBacking(id(), m_surface);
> +    m_isDirty = false;

This seems unrelated

> Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:402
> +    size_t index = m_state.layersToCreate.find(layer->id());
> +    if (index != notFound) {
> +        m_state.layersToCreate.remove(index);
> +        return;
> +    }
> +
> +    m_state.layersToRemove.append(layer->id());

This seems unrelated as well
Comment 16 Gwang Yoon Hwang 2013-06-05 03:22:15 PDT
(In reply to comment #15)
> (From update of attachment 203777 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=203777&action=review
> 
> Great! but has a couple of unrelated changes
> 
> > Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:118
> > -    // If sending the message fails, try again in the next update.
> > -    bool success = m_coordinator->updateImageBacking(id(), m_surface);
> > -    m_isDirty = !success;
> > +    m_coordinator->updateImageBacking(id(), m_surface);
> > +    m_isDirty = false;
> 
> This seems unrelated
>
Because this patch does defers creating a handle of WebCoordinatedSurface to sync time, we cannot check whether it is failed, so fallback logic was removed.

I think cleaning m_isDirty is necessary because it indicates ImageBacking posts its update.
 
> > Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:402
> > +    size_t index = m_state.layersToCreate.find(layer->id());
> > +    if (index != notFound) {
> > +        m_state.layersToCreate.remove(index);
> > +        return;
> > +    }
> > +
> > +    m_state.layersToRemove.append(layer->id());
> 
> This seems unrelated as well

I think it makes sense, because it is a reused logic from 
 Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:288
Comment 17 Noam Rosenthal 2013-06-05 04:01:12 PDT
Comment on attachment 203777 [details]
Patch

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

>>> Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:118
>>> +    m_isDirty = false;
>> 
>> This seems unrelated
> 
> Because this patch does defers creating a handle of WebCoordinatedSurface to sync time, we cannot check whether it is failed, so fallback logic was removed.
> 
> I think cleaning m_isDirty is necessary because it indicates ImageBacking posts its update.

OK.
Comment 18 WebKit Commit Bot 2013-06-05 04:52:55 PDT
Comment on attachment 203777 [details]
Patch

Clearing flags on attachment: 203777

Committed r151212: <http://trac.webkit.org/changeset/151212>
Comment 19 WebKit Commit Bot 2013-06-05 04:52:59 PDT
All reviewed patches have been landed.  Closing bug.