Changeset 151212 in webkit


Ignore:
Timestamp:
Jun 5, 2013 4:52:55 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Source/WebCore: Coordinated Graphics: Unify messages related object's lifecycles into CoordinatedGraphicsState.
https://bugs.webkit.org/show_bug.cgi?id=111919

Patch by Gwang Yoon Hwang <ryumiel@company100.net> on 2013-06-05
Reviewed by Noam Rosenthal.

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.

No new tests, covered by existing tests.

  • platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp:

(WebCore::CoordinatedGraphicsScene::syncCustomFilterPrograms):
(WebCore::CoordinatedGraphicsScene::syncUpdateAtlases):
(WebCore::CoordinatedGraphicsScene::syncImageBackings):
(WebCore::CoordinatedGraphicsScene::commitSceneState):

  • platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h:
  • platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
  • platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:

(WebCore::CoordinatedImageBacking::update):

  • platform/graphics/texmap/coordinated/CoordinatedImageBacking.h:
  • platform/graphics/texmap/coordinated/UpdateAtlas.cpp:

(WebCore::UpdateAtlas::UpdateAtlas):

  • platform/graphics/texmap/coordinated/UpdateAtlas.h:

Source/WebKit2: [Coordinated Graphics] Unify messages related object's lifecycles into CoordinatedGraphicsState.
https://bugs.webkit.org/show_bug.cgi?id=111919

Patch by Gwang Yoon Hwang <ryumiel@company100.net> on 2013-06-05
Reviewed by Noam Rosenthal.

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.

No new tests, covered by existing tests.

  • Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp:

(CoreIPC::encodeCoordinatedSurface):
(CoreIPC::decodeCoordinatedSurface):
(CoreIPC::::encode):
(CoreIPC::::decode):

  • UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp:
  • UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h:
  • UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.messages.in:
  • WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:

(WebKit::CoordinatedLayerTreeHost::flushPendingLayerChanges):
(WebKit::CoordinatedLayerTreeHost::clearPendingStateChanges):
(WebKit::CoordinatedLayerTreeHost::checkCustomFilterProgramProxies):
(WebKit::CoordinatedLayerTreeHost::removeCustomFilterProgramProxy):
(WebKit::CoordinatedLayerTreeHost::detachLayer):
(WebKit::CoordinatedLayerTreeHost::createImageBacking):
(WebKit::CoordinatedLayerTreeHost::updateImageBacking):
(WebKit::CoordinatedLayerTreeHost::clearImageBackingContents):
(WebKit::CoordinatedLayerTreeHost::removeImageBacking):
(WebKit::CoordinatedLayerTreeHost::createGraphicsLayer):
(WebKit::CoordinatedLayerTreeHost::createUpdateAtlas):
(WebKit::CoordinatedLayerTreeHost::removeUpdateAtlas):

  • WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
Location:
trunk/Source
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r151210 r151212  
     12013-06-05  Gwang Yoon Hwang  <ryumiel@company100.net>
     2
     3        Coordinated Graphics: Unify messages related object's lifecycles into CoordinatedGraphicsState.
     4        https://bugs.webkit.org/show_bug.cgi?id=111919
     5
     6        Reviewed by Noam Rosenthal.
     7
     8        CoordinatedLayerTreeHostProxy has several methods, which simply passes
     9        these calls to CoordinatedGraphicsScene.
     10
     11        This patch removes methods in CoordinatedLayerTreeHostProxy just for
     12        message chaining. Instead of that, messages for creation/deletion of objects
     13        (Layers, CustomFilters, UpdateAtlas, and ImageBacking) are unified into
     14        CommitCoordinatedGraphicsState.
     15
     16        And this patch also removes codes for WebCoordinatedSurface in
     17        CoordinatedLayerTreeHost, except for a factory method.
     18        CoordinatedGraphicsArgumentCoders [en|de]codes CoordinatedSurface itself
     19        using WebCoordinatedSurface.
     20
     21        No new tests, covered by existing tests.
     22
     23        * platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp:
     24        (WebCore::CoordinatedGraphicsScene::syncCustomFilterPrograms):
     25        (WebCore::CoordinatedGraphicsScene::syncUpdateAtlases):
     26        (WebCore::CoordinatedGraphicsScene::syncImageBackings):
     27        (WebCore::CoordinatedGraphicsScene::commitSceneState):
     28        * platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h:
     29        * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
     30        * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
     31        (WebCore::CoordinatedImageBacking::update):
     32        * platform/graphics/texmap/coordinated/CoordinatedImageBacking.h:
     33        * platform/graphics/texmap/coordinated/UpdateAtlas.cpp:
     34        (WebCore::UpdateAtlas::UpdateAtlas):
     35        * platform/graphics/texmap/coordinated/UpdateAtlas.h:
     36
    1372013-06-05  Andreas Kling  <akling@apple.com>
    238
  • trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp

    r150015 r151212  
    244244
    245245#if ENABLE(CSS_SHADERS)
     246void CoordinatedGraphicsScene::syncCustomFilterPrograms(const CoordinatedGraphicsState& state)
     247{
     248    for (size_t i = 0; i < state.customFiltersToCreate.size(); ++i)
     249        createCustomFilterProgram(state.customFiltersToCreate[i].first, state.customFiltersToCreate[i].second);
     250
     251    for (size_t i = 0; i < state.customFiltersToRemove.size(); ++i)
     252        removeCustomFilterProgram(state.customFiltersToRemove[i]);
     253}
     254
    246255void CoordinatedGraphicsScene::injectCachedCustomFilterPrograms(const FilterOperations& filters) const
    247256{
     
    497506}
    498507
     508void CoordinatedGraphicsScene::syncUpdateAtlases(const CoordinatedGraphicsState& state)
     509{
     510    for (size_t i = 0; i < state.updateAtlasesToCreate.size(); ++i)
     511        createUpdateAtlas(state.updateAtlasesToCreate[i].first, state.updateAtlasesToCreate[i].second);
     512
     513    for (size_t i = 0; i < state.updateAtlasesToRemove.size(); ++i)
     514        removeUpdateAtlas(state.updateAtlasesToRemove[i]);
     515}
     516
    499517void CoordinatedGraphicsScene::createUpdateAtlas(uint32_t atlasID, PassRefPtr<CoordinatedSurface> surface)
    500518{
     
    507525    ASSERT(m_surfaces.contains(atlasID));
    508526    m_surfaces.remove(atlasID);
     527}
     528
     529void CoordinatedGraphicsScene::syncImageBackings(const CoordinatedGraphicsState& state)
     530{
     531    for (size_t i = 0; i < state.imagesToCreate.size(); ++i)
     532        createImageBacking(state.imagesToCreate[i]);
     533
     534    for (size_t i = 0; i < state.imagesToRemove.size(); ++i)
     535        removeImageBacking(state.imagesToRemove[i]);
     536
     537    for (size_t i = 0; i < state.imagesToUpdate.size(); ++i)
     538        updateImageBacking(state.imagesToUpdate[i].first, state.imagesToUpdate[i].second);
     539
     540    for (size_t i = 0; i < state.imagesToClear.size(); ++i)
     541        clearImageBackingContents(state.imagesToClear[i]);
    509542}
    510543
     
    585618    m_renderedContentsScrollPosition = state.scrollPosition;
    586619
     620    createLayers(state.layersToCreate);
     621    deleteLayers(state.layersToRemove);
     622
    587623    if (state.rootCompositingLayer != m_rootLayerID)
    588624        setRootLayerID(state.rootCompositingLayer);
    589625
    590     for (size_t i = 0; i < state.imagesToUpdate.size(); ++i)
    591         updateImageBacking(state.imagesToUpdate[i].first, state.imagesToUpdate[i].second);
     626    syncImageBackings(state);
     627    syncUpdateAtlases(state);
     628#if ENABLE(CSS_SHADERS)
     629    syncCustomFilterPrograms(state);
     630#endif
    592631
    593632    for (size_t i = 0; i < state.layersToUpdate.size(); ++i)
  • trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h

    r150015 r151212  
    11/*
    22    Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
     3    Copyright (C) 2013 Company 100, Inc.
    34
    45    This library is free software; you can redistribute it and/or
     
    8182    void commitSceneState(const CoordinatedGraphicsState&);
    8283
     84    void setBackgroundColor(const Color&);
     85    void setDrawsBackground(bool enable) { m_setDrawsBackground = enable; }
     86
     87private:
     88    void setRootLayerID(CoordinatedLayerID);
    8389    void createLayers(const Vector<CoordinatedLayerID>&);
    8490    void deleteLayers(const Vector<CoordinatedLayerID>&);
    85 
    86 #if ENABLE(CSS_SHADERS)
    87     void injectCachedCustomFilterPrograms(const FilterOperations& filters) const;
    88     void createCustomFilterProgram(int id, const CustomFilterProgramInfo&);
    89     void removeCustomFilterProgram(int id);
    90 #endif
    91 
    92     void createUpdateAtlas(uint32_t atlasID, PassRefPtr<CoordinatedSurface>);
    93     void removeUpdateAtlas(uint32_t atlasID);
    94     void createImageBacking(CoordinatedImageBackingID);
    95     void updateImageBacking(CoordinatedImageBackingID, PassRefPtr<CoordinatedSurface>);
    96     void clearImageBackingContents(CoordinatedImageBackingID);
    97     void removeImageBacking(CoordinatedImageBackingID);
    98     void setBackgroundColor(const Color&);
    99     void setDrawsBackground(bool enable) { m_setDrawsBackground = enable; }
    100 
    101 private:
    102     void setRootLayerID(CoordinatedLayerID);
    10391    void setLayerState(CoordinatedLayerID, const CoordinatedGraphicsLayerState&);
    10492    void setLayerChildrenIfNeeded(TextureMapperLayer*, const CoordinatedGraphicsLayerState&);
     
    116104#endif
    117105    void setLayerRepaintCountIfNeeded(TextureMapperLayer*, const CoordinatedGraphicsLayerState&);
     106
     107    void syncUpdateAtlases(const CoordinatedGraphicsState&);
     108    void createUpdateAtlas(uint32_t atlasID, PassRefPtr<CoordinatedSurface>);
     109    void removeUpdateAtlas(uint32_t atlasID);
     110
     111    void syncImageBackings(const CoordinatedGraphicsState&);
     112    void createImageBacking(CoordinatedImageBackingID);
     113    void updateImageBacking(CoordinatedImageBackingID, PassRefPtr<CoordinatedSurface>);
     114    void clearImageBackingContents(CoordinatedImageBackingID);
     115    void removeImageBacking(CoordinatedImageBackingID);
     116
     117#if ENABLE(CSS_SHADERS)
     118    void syncCustomFilterPrograms(const CoordinatedGraphicsState&);
     119    void injectCachedCustomFilterPrograms(const FilterOperations& filters) const;
     120    void createCustomFilterProgram(int id, const CustomFilterProgramInfo&);
     121    void removeCustomFilterProgram(int id);
     122#endif
    118123
    119124    TextureMapperLayer* layerByID(CoordinatedLayerID id)
  • trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h

    r148748 r151212  
    4141#if ENABLE(CSS_FILTERS)
    4242#include "FilterOperations.h"
     43#endif
     44
     45#if ENABLE(CSS_FILTERS)
     46#include "CustomFilterProgramInfo.h"
    4347#endif
    4448
     
    184188    IntRect coveredRect;
    185189
     190    Vector<CoordinatedLayerID> layersToCreate;
    186191    Vector<std::pair<CoordinatedLayerID, CoordinatedGraphicsLayerState> > layersToUpdate;
     192    Vector<CoordinatedLayerID> layersToRemove;
     193
     194    Vector<CoordinatedImageBackingID> imagesToCreate;
     195    Vector<CoordinatedImageBackingID> imagesToRemove;
    187196    Vector<std::pair<CoordinatedImageBackingID, RefPtr<CoordinatedSurface> > > imagesToUpdate;
     197    Vector<CoordinatedImageBackingID> imagesToClear;
     198
     199    Vector<std::pair<uint32_t /* atlasID */, RefPtr<CoordinatedSurface> > > updateAtlasesToCreate;
     200    Vector<uint32_t /* atlasID */> updateAtlasesToRemove;
     201
     202#if ENABLE(CSS_SHADERS)
     203    Vector<std::pair<uint32_t /* FilterID */, CustomFilterProgramInfo> > customFiltersToCreate;
     204    Vector<uint32_t> customFiltersToRemove;
     205#endif
    188206};
    189207
  • trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp

    r141637 r151212  
    2929#include "CoordinatedImageBacking.h"
    3030
     31#include "CoordinatedGraphicsState.h"
    3132#include "GraphicsContext.h"
    3233
     
    114115    m_nativeImagePtr = m_image->nativeImageForCurrentFrame();
    115116
    116     // If sending the message fails, try again in the next update.
    117     bool success = m_coordinator->updateImageBacking(id(), m_surface);
    118     m_isDirty = !success;
     117    m_coordinator->updateImageBacking(id(), m_surface);
     118    m_isDirty = false;
    119119}
    120120
  • trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.h

    r144787 r151212  
    4343    public:
    4444        virtual void createImageBacking(CoordinatedImageBackingID) = 0;
    45         virtual bool updateImageBacking(CoordinatedImageBackingID, PassRefPtr<CoordinatedSurface>) = 0;
     45        virtual void updateImageBacking(CoordinatedImageBackingID, PassRefPtr<CoordinatedSurface>) = 0;
    4646        virtual void clearImageBackingContents(CoordinatedImageBackingID) = 0;
    4747        virtual void removeImageBacking(CoordinatedImageBackingID) = 0;
  • trunk/Source/WebCore/platform/graphics/texmap/coordinated/UpdateAtlas.cpp

    r141543 r151212  
    2424#if USE(COORDINATED_GRAPHICS)
    2525
     26#include "CoordinatedGraphicsState.h"
    2627#include "GraphicsContext.h"
    2728#include "IntRect.h"
     
    3940    m_surface = CoordinatedSurface::create(size, flags);
    4041
    41     // FIXME: Currently, if sending the message fails, UpdateAtlas gives up drawing anything implicitly.
    42     if (!m_client->createUpdateAtlas(m_ID, m_surface))
    43         m_surface.clear();
     42    m_client->createUpdateAtlas(m_ID, m_surface);
    4443}
    4544
  • trunk/Source/WebCore/platform/graphics/texmap/coordinated/UpdateAtlas.h

    r141543 r151212  
    3434class UpdateAtlasClient {
    3535public:
    36     virtual bool createUpdateAtlas(uint32_t atlasID, PassRefPtr<CoordinatedSurface>) = 0;
     36    virtual void createUpdateAtlas(uint32_t atlasID, PassRefPtr<CoordinatedSurface>) = 0;
    3737    virtual void removeUpdateAtlas(uint32_t atlasID) = 0;
    3838};
  • trunk/Source/WebKit2/ChangeLog

    r151197 r151212  
     12013-06-05  Gwang Yoon Hwang  <ryumiel@company100.net>
     2
     3        [Coordinated Graphics] Unify messages related object's lifecycles into CoordinatedGraphicsState.
     4        https://bugs.webkit.org/show_bug.cgi?id=111919
     5
     6        Reviewed by Noam Rosenthal.
     7
     8        CoordinatedLayerTreeHostProxy has several methods, which simply passes
     9        these calls to CoordinatedGraphicsScene.
     10
     11        This patch removes methods in CoordinatedLayerTreeHostProxy just for
     12        message chaining. Instead of that, messages for creation/deletion of objects
     13        (Layers, CustomFilters, UpdateAtlas, and ImageBacking) are unified into
     14        CommitCoordinatedGraphicsState.
     15
     16        And this patch also removes codes for WebCoordinatedSurface in
     17        CoordinatedLayerTreeHost, except for a factory method.
     18        CoordinatedGraphicsArgumentCoders [en|de]codes CoordinatedSurface itself
     19        using WebCoordinatedSurface.
     20
     21        No new tests, covered by existing tests.
     22
     23        * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp:
     24        (CoreIPC::encodeCoordinatedSurface):
     25        (CoreIPC::decodeCoordinatedSurface):
     26        (CoreIPC::::encode):
     27        (CoreIPC::::decode):
     28        * UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp:
     29        * UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h:
     30        * UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.messages.in:
     31        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
     32        (WebKit::CoordinatedLayerTreeHost::flushPendingLayerChanges):
     33        (WebKit::CoordinatedLayerTreeHost::clearPendingStateChanges):
     34        (WebKit::CoordinatedLayerTreeHost::checkCustomFilterProgramProxies):
     35        (WebKit::CoordinatedLayerTreeHost::removeCustomFilterProgramProxy):
     36        (WebKit::CoordinatedLayerTreeHost::detachLayer):
     37        (WebKit::CoordinatedLayerTreeHost::createImageBacking):
     38        (WebKit::CoordinatedLayerTreeHost::updateImageBacking):
     39        (WebKit::CoordinatedLayerTreeHost::clearImageBackingContents):
     40        (WebKit::CoordinatedLayerTreeHost::removeImageBacking):
     41        (WebKit::CoordinatedLayerTreeHost::createGraphicsLayer):
     42        (WebKit::CoordinatedLayerTreeHost::createUpdateAtlas):
     43        (WebKit::CoordinatedLayerTreeHost::removeUpdateAtlas):
     44        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
     45
    1462013-06-04  Simon Cooper  <scooper@apple.com>
    247
  • trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp

    r149694 r151212  
    10271027}
    10281028
     1029static void encodeCoordinatedSurface(ArgumentEncoder& encoder, const RefPtr<CoordinatedSurface>& surface)
     1030{
     1031    bool isValidSurface = false;
     1032    if (!surface) {
     1033        encoder << isValidSurface;
     1034        return;
     1035    }
     1036
     1037    WebCoordinatedSurface* webCoordinatedSurface = static_cast<WebCoordinatedSurface*>(surface.get());
     1038    WebCoordinatedSurface::Handle handle;
     1039    if (webCoordinatedSurface->createHandle(handle))
     1040        isValidSurface = true;
     1041
     1042    encoder << isValidSurface;
     1043
     1044    if (isValidSurface)
     1045        encoder << handle;
     1046}
     1047
     1048static bool decodeCoordinatedSurface(ArgumentDecoder& decoder, RefPtr<CoordinatedSurface>& surface)
     1049{
     1050    bool isValidSurface;
     1051    if (!decoder.decode(isValidSurface))
     1052        return false;
     1053
     1054    if (!isValidSurface)
     1055        return true;
     1056
     1057    WebCoordinatedSurface::Handle handle;
     1058    if (!decoder.decode(handle))
     1059        return false;
     1060
     1061    surface = WebCoordinatedSurface::create(handle);
     1062    return true;
     1063}
     1064
    10291065void ArgumentCoder<CoordinatedGraphicsState>::encode(ArgumentEncoder& encoder, const CoordinatedGraphicsState& state)
    10301066{
     
    10331069    encoder << state.contentsSize;
    10341070    encoder << state.coveredRect;
     1071
     1072    encoder << state.layersToCreate;
    10351073    encoder << state.layersToUpdate;
     1074    encoder << state.layersToRemove;
     1075
     1076    encoder << state.imagesToCreate;
     1077    encoder << state.imagesToRemove;
    10361078
    10371079    // We need to encode WebCoordinatedSurface::Handle right after it's creation.
    10381080    // That's why we cannot use simple std::pair encoder.
    10391081    encoder << static_cast<uint64_t>(state.imagesToUpdate.size());
    1040 
    1041     typedef Vector<std::pair<CoordinatedImageBackingID, RefPtr<CoordinatedSurface> > > SurfaceUpdatePairVector;
    1042     SurfaceUpdatePairVector::const_iterator end = state.imagesToUpdate.end();
    1043     for (SurfaceUpdatePairVector::const_iterator it = state.imagesToUpdate.begin(); it != end; ++it) {
    1044 
    1045         WebCoordinatedSurface* webCoordinatedSurface = static_cast<WebCoordinatedSurface*>(it->second.get());
    1046         WebCoordinatedSurface::Handle handle;
    1047         if (!webCoordinatedSurface->createHandle(handle))
    1048             return;
    1049 
    1050         encoder << it->first;
    1051         encoder << handle;
    1052     }
     1082    for (size_t i = 0; i < state.imagesToUpdate.size(); ++i) {
     1083        encoder << state.imagesToUpdate[i].first;
     1084        encodeCoordinatedSurface(encoder, state.imagesToUpdate[i].second);
     1085    }
     1086    encoder << state.imagesToClear;
     1087
     1088    encoder << static_cast<uint64_t>(state.updateAtlasesToCreate.size());
     1089    for (size_t i = 0; i < state.updateAtlasesToCreate.size(); ++i) {
     1090        encoder << state.updateAtlasesToCreate[i].first;
     1091        encodeCoordinatedSurface(encoder, state.updateAtlasesToCreate[i].second);
     1092    }
     1093    encoder << state.updateAtlasesToRemove;
     1094
     1095#if ENABLE(CSS_SHADERS)
     1096    encoder << static_cast<uint64_t>(state.customFiltersToCreate.size());
     1097    for (size_t i = 0; i < state.customFiltersToCreate.size(); ++i) {
     1098        encoder << state.customFiltersToCreate[i].first;
     1099        encoder << state.customFiltersToCreate[i].second;
     1100    }
     1101    encoder << state.customFiltersToRemove;
     1102#endif
    10531103}
    10541104
     
    10671117        return false;
    10681118
     1119    if (!decoder.decode(state.layersToCreate))
     1120        return false;
     1121
    10691122    if (!decoder.decode(state.layersToUpdate))
     1123        return false;
     1124
     1125    if (!decoder.decode(state.layersToRemove))
     1126        return false;
     1127
     1128    if (!decoder.decode(state.imagesToCreate))
     1129        return false;
     1130
     1131    if (!decoder.decode(state.imagesToRemove))
    10701132        return false;
    10711133
     
    10741136        return false;
    10751137
    1076     for (uint64_t i = 0; i < sizeOfImagesToUpdate; i++) {
     1138    for (uint64_t i = 0; i < sizeOfImagesToUpdate; ++i) {
    10771139        CoordinatedImageBackingID imageID;
    10781140        if (!decoder.decode(imageID))
    10791141            return false;
    10801142
    1081         WebCoordinatedSurface::Handle handle;
    1082         if (!decoder.decode(handle))
    1083             return false;
    1084 
    1085         RefPtr<CoordinatedSurface> surface = WebCoordinatedSurface::create(handle);
     1143        RefPtr<CoordinatedSurface> surface;
     1144        if (!decodeCoordinatedSurface(decoder, surface))
     1145            return false;
     1146
    10861147        state.imagesToUpdate.append(std::make_pair(imageID, surface.release()));
    10871148    }
    10881149
     1150    if (!decoder.decode(state.imagesToClear))
     1151        return false;
     1152
     1153    uint64_t sizeOfUpdateAtlasesToCreate;
     1154    if (!decoder.decode(sizeOfUpdateAtlasesToCreate))
     1155        return false;
     1156
     1157    for (uint64_t i = 0; i < sizeOfUpdateAtlasesToCreate; ++i) {
     1158        uint32_t atlasID;
     1159        if (!decoder.decode(atlasID))
     1160            return false;
     1161
     1162        RefPtr<CoordinatedSurface> surface;
     1163        if (!decodeCoordinatedSurface(decoder, surface))
     1164            return false;
     1165
     1166        state.updateAtlasesToCreate.append(std::make_pair(atlasID, surface.release()));
     1167    }
     1168
     1169    if (!decoder.decode(state.updateAtlasesToRemove))
     1170        return false;
     1171
     1172#if ENABLE(CSS_SHADERS)
     1173    uint64_t sizeOfCustomFiltersToCreate;
     1174    if (!decoder.decode(sizeOfCustomFiltersToCreate))
     1175        return false;
     1176
     1177    for (uint64_t i = 0; i < sizeOfCustomFiltersToCreate; ++i) {
     1178        uint32_t filterID;
     1179        if (!decoder.decode(filterID))
     1180            return false;
     1181        CustomFilterProgramInfo filterInfo;
     1182        if (!decoder.decode(filterInfo))
     1183            return false;
     1184        state.customFiltersToCreate.append(std::make_pair(filterID, filterInfo));
     1185    }
     1186
     1187    if (!decoder.decode(state.updateAtlasesToRemove))
     1188        return false;
     1189#endif
     1190
    10891191    return true;
    10901192}
  • trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp

    r150015 r151212  
    11/*
    22    Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
     3    Copyright (C) 2013 Company 100, Inc.
    34
    45    This library is free software; you can redistribute it and/or
     
    6364}
    6465
    65 void CoordinatedLayerTreeHostProxy::createUpdateAtlas(uint32_t atlasID, const WebCoordinatedSurface::Handle& handle)
    66 {
    67     dispatchUpdate(bind(&CoordinatedGraphicsScene::createUpdateAtlas, m_scene.get(), atlasID, WebCoordinatedSurface::create(handle)));
    68 }
    69 
    70 void CoordinatedLayerTreeHostProxy::removeUpdateAtlas(uint32_t atlasID)
    71 {
    72     dispatchUpdate(bind(&CoordinatedGraphicsScene::removeUpdateAtlas, m_scene.get(), atlasID));
    73 }
    74 
    75 void CoordinatedLayerTreeHostProxy::createCompositingLayers(const Vector<CoordinatedLayerID>& ids)
    76 {
    77     dispatchUpdate(bind(&CoordinatedGraphicsScene::createLayers, m_scene.get(), ids));
    78 }
    79 
    80 void CoordinatedLayerTreeHostProxy::deleteCompositingLayers(const Vector<CoordinatedLayerID>& ids)
    81 {
    82     dispatchUpdate(bind(&CoordinatedGraphicsScene::deleteLayers, m_scene.get(), ids));
    83 }
    84 
    85 #if ENABLE(CSS_SHADERS)
    86 void CoordinatedLayerTreeHostProxy::removeCustomFilterProgram(int id)
    87 {
    88     dispatchUpdate(bind(&CoordinatedGraphicsScene::removeCustomFilterProgram, m_scene.get(), id));
    89 }
    90 void CoordinatedLayerTreeHostProxy::createCustomFilterProgram(int id, const CustomFilterProgramInfo& programInfo)
    91 {
    92     dispatchUpdate(bind(&CoordinatedGraphicsScene::createCustomFilterProgram, m_scene.get(), id, programInfo));
    93 }
    94 #endif
    95 
    9666void CoordinatedLayerTreeHostProxy::commitCoordinatedGraphicsState(const CoordinatedGraphicsState& graphicsState)
    9767{
     
    10171    m_drawingAreaProxy->page()->didRenderFrame(graphicsState.contentsSize, graphicsState.coveredRect);
    10272#endif
    103 }
    104 
    105 void CoordinatedLayerTreeHostProxy::createImageBacking(CoordinatedImageBackingID imageID)
    106 {
    107     dispatchUpdate(bind(&CoordinatedGraphicsScene::createImageBacking, m_scene.get(), imageID));
    108 }
    109 
    110 void CoordinatedLayerTreeHostProxy::updateImageBacking(CoordinatedImageBackingID imageID, const WebCoordinatedSurface::Handle& handle)
    111 {
    112     dispatchUpdate(bind(&CoordinatedGraphicsScene::updateImageBacking, m_scene.get(), imageID, WebCoordinatedSurface::create(handle)));
    113 }
    114 
    115 void CoordinatedLayerTreeHostProxy::clearImageBackingContents(CoordinatedImageBackingID imageID)
    116 {
    117     dispatchUpdate(bind(&CoordinatedGraphicsScene::clearImageBackingContents, m_scene.get(), imageID));
    118 }
    119 
    120 void CoordinatedLayerTreeHostProxy::removeImageBacking(CoordinatedImageBackingID imageID)
    121 {
    122     dispatchUpdate(bind(&CoordinatedGraphicsScene::removeImageBacking, m_scene.get(), imageID));
    12373}
    12474
  • trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h

    r150015 r151212  
    11/*
    22    Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
     3    Copyright (C) 2013 Company 100, Inc.
    34
    45    This library is free software; you can redistribute it and/or
     
    5657    virtual ~CoordinatedLayerTreeHostProxy();
    5758
    58     // Messages From CoordinatedLayerTreeHost
    59     void createCompositingLayers(const Vector<WebCore::CoordinatedLayerID>&);
    60     void deleteCompositingLayers(const Vector<WebCore::CoordinatedLayerID>&);
    61 #if ENABLE(CSS_SHADERS)
    62     void createCustomFilterProgram(int id, const WebCore::CustomFilterProgramInfo&);
    63     void removeCustomFilterProgram(int id);
    64 #endif
    65     void createUpdateAtlas(uint32_t atlasID, const WebCoordinatedSurface::Handle&);
    66     void removeUpdateAtlas(uint32_t atlasID);
    67     void createImageBacking(WebCore::CoordinatedImageBackingID);
    68     void updateImageBacking(WebCore::CoordinatedImageBackingID, const WebCoordinatedSurface::Handle&);
    69     void clearImageBackingContents(WebCore::CoordinatedImageBackingID);
    70     void removeImageBacking(WebCore::CoordinatedImageBackingID);
    71 
    7259    void commitCoordinatedGraphicsState(const WebCore::CoordinatedGraphicsState&);
    73     void setAnimationsLocked(bool);
    7460    void setBackgroundColor(const WebCore::Color&);
    7561
  • trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.messages.in

    r150015 r151212  
    11#
    22#    Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
     3#    Copyright (C) 2013 Company 100, Inc.
    34#
    45#    This library is free software; you can redistribute it and/or
     
    2223
    2324    CommitCoordinatedGraphicsState(WebCore::CoordinatedGraphicsState state)
    24 
    25     CreateCompositingLayers(Vector<uint32_t> ids)
    26     DeleteCompositingLayers(Vector<uint32_t> ids)
    27 
    28 #if ENABLE(CSS_SHADERS)
    29     CreateCustomFilterProgram(int id, WebCore::CustomFilterProgramInfo programInfo)
    30     RemoveCustomFilterProgram(int id)
    31 #endif
    32     CreateUpdateAtlas(uint32_t atlasID, WebKit::WebCoordinatedSurface::Handle handle)
    33     RemoveUpdateAtlas(uint32_t atlasID)
    34     CreateImageBacking(uint64_t imageID)
    35     UpdateImageBacking(uint64_t imageID, WebKit::WebCoordinatedSurface::Handle handle)
    36     ClearImageBackingContents(uint64_t imageID)
    37     RemoveImageBacking(uint64_t imageID)
    3825    SetBackgroundColor(WebCore::Color color)
    3926}
  • trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp

    r151132 r151212  
    241241    TemporaryChange<bool> protector(m_isFlushingLayerChanges, true);
    242242
    243     createCompositingLayers();
    244243    initializeRootCompositingLayerIfNeeded();
    245244
     
    251250
    252251    flushPendingImageBackingChanges();
    253     deleteCompositingLayers();
    254252
    255253    if (m_shouldSyncFrame) {
     
    266264        m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::CommitCoordinatedGraphicsState(m_state));
    267265
    268         m_state.layersToUpdate.clear();
    269         m_state.imagesToUpdate.clear();
    270 
     266        clearPendingStateChanges();
    271267        m_waitingForUIProcess = true;
    272268        m_shouldSyncFrame = false;
     
    281277}
    282278
    283 void CoordinatedLayerTreeHost::createCompositingLayers()
    284 {
    285     if (m_layersToCreate.isEmpty())
    286         return;
    287 
    288     // If a layer gets created and deleted in the same cycle, we can simply remove it from m_layersToCreate and m_layersToDelete.
    289     for (int i = m_layersToCreate.size() - 1; i >= 0; --i) {
    290         size_t index = m_layersToDelete.find(m_layersToCreate[i]);
    291         if (index != notFound) {
    292             m_layersToCreate.remove(i);
    293             m_layersToDelete.remove(index);
    294         }
    295     }
    296 
    297     m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::CreateCompositingLayers(m_layersToCreate));
    298     m_layersToCreate.clear();
    299     m_shouldSyncFrame = true;
    300 }
    301 
    302 void CoordinatedLayerTreeHost::deleteCompositingLayers()
    303 {
    304     if (m_layersToDelete.isEmpty())
    305         return;
    306 
    307     if (m_isPurging) {
    308         m_layersToDelete.clear();
    309         return;
    310     }
    311 
    312     m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::DeleteCompositingLayers(m_layersToDelete));
    313     m_layersToDelete.clear();
    314     m_shouldSyncFrame = true;
     279void CoordinatedLayerTreeHost::clearPendingStateChanges()
     280{
     281    m_state.layersToCreate.clear();
     282    m_state.layersToUpdate.clear();
     283    m_state.layersToRemove.clear();
     284
     285    m_state.imagesToCreate.clear();
     286    m_state.imagesToRemove.clear();
     287    m_state.imagesToUpdate.clear();
     288    m_state.imagesToClear.clear();
     289
     290    m_state.updateAtlasesToCreate.clear();
     291    m_state.updateAtlasesToRemove.clear();
     292
     293#if ENABLE(CSS_SHADERS)
     294    m_state.customFiltersToCreate.clear();
     295    m_state.customFiltersToRemove.clear();
     296#endif
    315297}
    316298
     
    383365            customFilterProgramProxy->setClient(this);
    384366            m_customFilterPrograms.add(customFilterProgramProxy.get());
    385             m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::CreateCustomFilterProgram(customFilterProgramProxy->id(), customOperation->validatedProgram()->validatedProgramInfo()));
     367            m_state.customFiltersToCreate.append(std::make_pair(customFilterProgramProxy->id(), customOperation->validatedProgram()->validatedProgramInfo()));
    386368        } else {
    387369            // If the client was not disconnected then this coordinator must be the client for it.
     
    396378    // send a message to the other process to delete it.
    397379    m_customFilterPrograms.remove(customFilterProgramProxy);
    398     m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::RemoveCustomFilterProgram(customFilterProgramProxy->id()));
     380    m_state.customFiltersToRemove.append(customFilterProgramProxy->id());
    399381}
    400382
     
    411393{
    412394    m_registeredLayers.remove(layer->id());
    413     m_layersToDelete.append(layer->id());
     395
     396    size_t index = m_state.layersToCreate.find(layer->id());
     397    if (index != notFound) {
     398        m_state.layersToCreate.remove(index);
     399        return;
     400    }
     401
     402    m_state.layersToRemove.append(layer->id());
    414403    scheduleLayerFlush();
    415404}
     
    495484void CoordinatedLayerTreeHost::createImageBacking(CoordinatedImageBackingID imageID)
    496485{
     486    m_state.imagesToCreate.append(imageID);
     487}
     488
     489void CoordinatedLayerTreeHost::updateImageBacking(CoordinatedImageBackingID imageID, PassRefPtr<CoordinatedSurface> coordinatedSurface)
     490{
    497491    m_shouldSyncFrame = true;
    498     m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::CreateImageBacking(imageID));
    499 }
    500 
    501 bool CoordinatedLayerTreeHost::updateImageBacking(CoordinatedImageBackingID imageID, PassRefPtr<CoordinatedSurface> coordinatedSurface)
     492    m_state.imagesToUpdate.append(std::make_pair(imageID, coordinatedSurface));
     493}
     494
     495void CoordinatedLayerTreeHost::clearImageBackingContents(CoordinatedImageBackingID imageID)
    502496{
    503497    m_shouldSyncFrame = true;
    504     WebCoordinatedSurface* webCoordinatedSurface = static_cast<WebCoordinatedSurface*>(coordinatedSurface.get());
    505     WebCoordinatedSurface::Handle handle;
    506     if (!webCoordinatedSurface->createHandle(handle))
    507         return false;
    508 
    509     m_state.imagesToUpdate.append(std::make_pair(imageID, coordinatedSurface));
    510     return true;
    511 }
    512 
    513 void CoordinatedLayerTreeHost::clearImageBackingContents(CoordinatedImageBackingID imageID)
    514 {
    515     m_shouldSyncFrame = true;
    516     m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::ClearImageBackingContents(imageID));
     498    m_state.imagesToClear.append(imageID);
    517499}
    518500
     
    523505
    524506    ASSERT(m_imageBackings.contains(imageID));
    525     m_shouldSyncFrame = true;
    526507    m_imageBackings.remove(imageID);
    527     m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::RemoveImageBacking(imageID));
     508
     509    m_state.imagesToRemove.append(imageID);
    528510}
    529511
     
    559541    layer->setCoordinator(this);
    560542    m_registeredLayers.add(layer->id(), layer);
    561     m_layersToCreate.append(layer->id());
     543    m_state.layersToCreate.append(layer->id());
    562544    layer->setNeedsVisibleRectAdjustment();
    563545    scheduleLayerFlush();
     
    585567}
    586568
    587 bool CoordinatedLayerTreeHost::createUpdateAtlas(uint32_t atlasID, PassRefPtr<CoordinatedSurface> coordinatedSurface)
    588 {
    589     WebCoordinatedSurface* webCoordinatedSurface = static_cast<WebCoordinatedSurface*>(coordinatedSurface.get());
    590     WebCoordinatedSurface::Handle handle;
    591     if (!webCoordinatedSurface->createHandle(handle))
    592         return false;
    593     m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::CreateUpdateAtlas(atlasID, handle));
    594     return true;
     569void CoordinatedLayerTreeHost::createUpdateAtlas(uint32_t atlasID, PassRefPtr<CoordinatedSurface> coordinatedSurface)
     570{
     571    m_state.updateAtlasesToCreate.append(std::make_pair(atlasID, coordinatedSurface));
    595572}
    596573
     
    599576    if (m_isPurging)
    600577        return;
    601     m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::RemoveUpdateAtlas(atlasID));
     578    m_state.updateAtlasesToRemove.append(atlasID);
    602579}
    603580
  • trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h

    r150015 r151212  
    11/*
    22    Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
     3    Copyright (C) 2013 Company 100, Inc.
    34
    45    This library is free software; you can redistribute it and/or
     
    113114    // CoordinatedImageBacking::Coordinator
    114115    virtual void createImageBacking(WebCore::CoordinatedImageBackingID) OVERRIDE;
    115     virtual bool updateImageBacking(WebCore::CoordinatedImageBackingID, PassRefPtr<WebCore::CoordinatedSurface>) OVERRIDE;
     116    virtual void updateImageBacking(WebCore::CoordinatedImageBackingID, PassRefPtr<WebCore::CoordinatedSurface>) OVERRIDE;
    116117    virtual void clearImageBackingContents(WebCore::CoordinatedImageBackingID) OVERRIDE;
    117118    virtual void removeImageBacking(WebCore::CoordinatedImageBackingID) OVERRIDE;
     
    128129
    129130    // UpdateAtlasClient
    130     virtual bool createUpdateAtlas(uint32_t atlasID, PassRefPtr<WebCore::CoordinatedSurface>) OVERRIDE;
     131    virtual void createUpdateAtlas(uint32_t atlasID, PassRefPtr<WebCore::CoordinatedSurface>) OVERRIDE;
    131132    virtual void removeUpdateAtlas(uint32_t atlasID);
    132133
     
    139140    void destroyPageOverlayLayer();
    140141    bool flushPendingLayerChanges();
    141     void createCompositingLayers();
    142     void deleteCompositingLayers();
     142    void clearPendingStateChanges();
    143143    void cancelPendingLayerFlush();
    144144    void performScheduledLayerFlush();
     
    172172    typedef HashMap<WebCore::CoordinatedLayerID, WebCore::CoordinatedGraphicsLayer*> LayerMap;
    173173    LayerMap m_registeredLayers;
    174     Vector<WebCore::CoordinatedLayerID> m_layersToCreate;
    175     Vector<WebCore::CoordinatedLayerID> m_layersToDelete;
    176174    typedef HashMap<WebCore::CoordinatedImageBackingID, RefPtr<WebCore::CoordinatedImageBacking> > ImageBackingMap;
    177175    ImageBackingMap m_imageBackings;
Note: See TracChangeset for help on using the changeset viewer.