Changeset 151212 in webkit
- Timestamp:
- Jun 5, 2013 4:52:55 AM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r151210 r151212 1 2013-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 1 37 2013-06-05 Andreas Kling <akling@apple.com> 2 38 -
trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp
r150015 r151212 244 244 245 245 #if ENABLE(CSS_SHADERS) 246 void 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 246 255 void CoordinatedGraphicsScene::injectCachedCustomFilterPrograms(const FilterOperations& filters) const 247 256 { … … 497 506 } 498 507 508 void 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 499 517 void CoordinatedGraphicsScene::createUpdateAtlas(uint32_t atlasID, PassRefPtr<CoordinatedSurface> surface) 500 518 { … … 507 525 ASSERT(m_surfaces.contains(atlasID)); 508 526 m_surfaces.remove(atlasID); 527 } 528 529 void 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]); 509 542 } 510 543 … … 585 618 m_renderedContentsScrollPosition = state.scrollPosition; 586 619 620 createLayers(state.layersToCreate); 621 deleteLayers(state.layersToRemove); 622 587 623 if (state.rootCompositingLayer != m_rootLayerID) 588 624 setRootLayerID(state.rootCompositingLayer); 589 625 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 592 631 593 632 for (size_t i = 0; i < state.layersToUpdate.size(); ++i) -
trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h
r150015 r151212 1 1 /* 2 2 Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) 3 Copyright (C) 2013 Company 100, Inc. 3 4 4 5 This library is free software; you can redistribute it and/or … … 81 82 void commitSceneState(const CoordinatedGraphicsState&); 82 83 84 void setBackgroundColor(const Color&); 85 void setDrawsBackground(bool enable) { m_setDrawsBackground = enable; } 86 87 private: 88 void setRootLayerID(CoordinatedLayerID); 83 89 void createLayers(const Vector<CoordinatedLayerID>&); 84 90 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 #endif91 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);103 91 void setLayerState(CoordinatedLayerID, const CoordinatedGraphicsLayerState&); 104 92 void setLayerChildrenIfNeeded(TextureMapperLayer*, const CoordinatedGraphicsLayerState&); … … 116 104 #endif 117 105 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 118 123 119 124 TextureMapperLayer* layerByID(CoordinatedLayerID id) -
trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h
r148748 r151212 41 41 #if ENABLE(CSS_FILTERS) 42 42 #include "FilterOperations.h" 43 #endif 44 45 #if ENABLE(CSS_FILTERS) 46 #include "CustomFilterProgramInfo.h" 43 47 #endif 44 48 … … 184 188 IntRect coveredRect; 185 189 190 Vector<CoordinatedLayerID> layersToCreate; 186 191 Vector<std::pair<CoordinatedLayerID, CoordinatedGraphicsLayerState> > layersToUpdate; 192 Vector<CoordinatedLayerID> layersToRemove; 193 194 Vector<CoordinatedImageBackingID> imagesToCreate; 195 Vector<CoordinatedImageBackingID> imagesToRemove; 187 196 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 188 206 }; 189 207 -
trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp
r141637 r151212 29 29 #include "CoordinatedImageBacking.h" 30 30 31 #include "CoordinatedGraphicsState.h" 31 32 #include "GraphicsContext.h" 32 33 … … 114 115 m_nativeImagePtr = m_image->nativeImageForCurrentFrame(); 115 116 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; 119 119 } 120 120 -
trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.h
r144787 r151212 43 43 public: 44 44 virtual void createImageBacking(CoordinatedImageBackingID) = 0; 45 virtual boolupdateImageBacking(CoordinatedImageBackingID, PassRefPtr<CoordinatedSurface>) = 0;45 virtual void updateImageBacking(CoordinatedImageBackingID, PassRefPtr<CoordinatedSurface>) = 0; 46 46 virtual void clearImageBackingContents(CoordinatedImageBackingID) = 0; 47 47 virtual void removeImageBacking(CoordinatedImageBackingID) = 0; -
trunk/Source/WebCore/platform/graphics/texmap/coordinated/UpdateAtlas.cpp
r141543 r151212 24 24 #if USE(COORDINATED_GRAPHICS) 25 25 26 #include "CoordinatedGraphicsState.h" 26 27 #include "GraphicsContext.h" 27 28 #include "IntRect.h" … … 39 40 m_surface = CoordinatedSurface::create(size, flags); 40 41 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); 44 43 } 45 44 -
trunk/Source/WebCore/platform/graphics/texmap/coordinated/UpdateAtlas.h
r141543 r151212 34 34 class UpdateAtlasClient { 35 35 public: 36 virtual boolcreateUpdateAtlas(uint32_t atlasID, PassRefPtr<CoordinatedSurface>) = 0;36 virtual void createUpdateAtlas(uint32_t atlasID, PassRefPtr<CoordinatedSurface>) = 0; 37 37 virtual void removeUpdateAtlas(uint32_t atlasID) = 0; 38 38 }; -
trunk/Source/WebKit2/ChangeLog
r151197 r151212 1 2013-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 1 46 2013-06-04 Simon Cooper <scooper@apple.com> 2 47 -
trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp
r149694 r151212 1027 1027 } 1028 1028 1029 static 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 1048 static 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 1029 1065 void ArgumentCoder<CoordinatedGraphicsState>::encode(ArgumentEncoder& encoder, const CoordinatedGraphicsState& state) 1030 1066 { … … 1033 1069 encoder << state.contentsSize; 1034 1070 encoder << state.coveredRect; 1071 1072 encoder << state.layersToCreate; 1035 1073 encoder << state.layersToUpdate; 1074 encoder << state.layersToRemove; 1075 1076 encoder << state.imagesToCreate; 1077 encoder << state.imagesToRemove; 1036 1078 1037 1079 // We need to encode WebCoordinatedSurface::Handle right after it's creation. 1038 1080 // That's why we cannot use simple std::pair encoder. 1039 1081 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 1053 1103 } 1054 1104 … … 1067 1117 return false; 1068 1118 1119 if (!decoder.decode(state.layersToCreate)) 1120 return false; 1121 1069 1122 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)) 1070 1132 return false; 1071 1133 … … 1074 1136 return false; 1075 1137 1076 for (uint64_t i = 0; i < sizeOfImagesToUpdate; i++) {1138 for (uint64_t i = 0; i < sizeOfImagesToUpdate; ++i) { 1077 1139 CoordinatedImageBackingID imageID; 1078 1140 if (!decoder.decode(imageID)) 1079 1141 return false; 1080 1142 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 1086 1147 state.imagesToUpdate.append(std::make_pair(imageID, surface.release())); 1087 1148 } 1088 1149 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 1089 1191 return true; 1090 1192 } -
trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp
r150015 r151212 1 1 /* 2 2 Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) 3 Copyright (C) 2013 Company 100, Inc. 3 4 4 5 This library is free software; you can redistribute it and/or … … 63 64 } 64 65 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 #endif95 96 66 void CoordinatedLayerTreeHostProxy::commitCoordinatedGraphicsState(const CoordinatedGraphicsState& graphicsState) 97 67 { … … 101 71 m_drawingAreaProxy->page()->didRenderFrame(graphicsState.contentsSize, graphicsState.coveredRect); 102 72 #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));123 73 } 124 74 -
trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h
r150015 r151212 1 1 /* 2 2 Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) 3 Copyright (C) 2013 Company 100, Inc. 3 4 4 5 This library is free software; you can redistribute it and/or … … 56 57 virtual ~CoordinatedLayerTreeHostProxy(); 57 58 58 // Messages From CoordinatedLayerTreeHost59 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 #endif65 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 72 59 void commitCoordinatedGraphicsState(const WebCore::CoordinatedGraphicsState&); 73 void setAnimationsLocked(bool);74 60 void setBackgroundColor(const WebCore::Color&); 75 61 -
trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.messages.in
r150015 r151212 1 1 # 2 2 # Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) 3 # Copyright (C) 2013 Company 100, Inc. 3 4 # 4 5 # This library is free software; you can redistribute it and/or … … 22 23 23 24 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 #endif32 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)38 25 SetBackgroundColor(WebCore::Color color) 39 26 } -
trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp
r151132 r151212 241 241 TemporaryChange<bool> protector(m_isFlushingLayerChanges, true); 242 242 243 createCompositingLayers();244 243 initializeRootCompositingLayerIfNeeded(); 245 244 … … 251 250 252 251 flushPendingImageBackingChanges(); 253 deleteCompositingLayers();254 252 255 253 if (m_shouldSyncFrame) { … … 266 264 m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::CommitCoordinatedGraphicsState(m_state)); 267 265 268 m_state.layersToUpdate.clear(); 269 m_state.imagesToUpdate.clear(); 270 266 clearPendingStateChanges(); 271 267 m_waitingForUIProcess = true; 272 268 m_shouldSyncFrame = false; … … 281 277 } 282 278 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; 279 void 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 315 297 } 316 298 … … 383 365 customFilterProgramProxy->setClient(this); 384 366 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())); 386 368 } else { 387 369 // If the client was not disconnected then this coordinator must be the client for it. … … 396 378 // send a message to the other process to delete it. 397 379 m_customFilterPrograms.remove(customFilterProgramProxy); 398 m_ webPage->send(Messages::CoordinatedLayerTreeHostProxy::RemoveCustomFilterProgram(customFilterProgramProxy->id()));380 m_state.customFiltersToRemove.append(customFilterProgramProxy->id()); 399 381 } 400 382 … … 411 393 { 412 394 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()); 414 403 scheduleLayerFlush(); 415 404 } … … 495 484 void CoordinatedLayerTreeHost::createImageBacking(CoordinatedImageBackingID imageID) 496 485 { 486 m_state.imagesToCreate.append(imageID); 487 } 488 489 void CoordinatedLayerTreeHost::updateImageBacking(CoordinatedImageBackingID imageID, PassRefPtr<CoordinatedSurface> coordinatedSurface) 490 { 497 491 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 495 void CoordinatedLayerTreeHost::clearImageBackingContents(CoordinatedImageBackingID imageID) 502 496 { 503 497 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); 517 499 } 518 500 … … 523 505 524 506 ASSERT(m_imageBackings.contains(imageID)); 525 m_shouldSyncFrame = true;526 507 m_imageBackings.remove(imageID); 527 m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::RemoveImageBacking(imageID)); 508 509 m_state.imagesToRemove.append(imageID); 528 510 } 529 511 … … 559 541 layer->setCoordinator(this); 560 542 m_registeredLayers.add(layer->id(), layer); 561 m_ layersToCreate.append(layer->id());543 m_state.layersToCreate.append(layer->id()); 562 544 layer->setNeedsVisibleRectAdjustment(); 563 545 scheduleLayerFlush(); … … 585 567 } 586 568 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; 569 void CoordinatedLayerTreeHost::createUpdateAtlas(uint32_t atlasID, PassRefPtr<CoordinatedSurface> coordinatedSurface) 570 { 571 m_state.updateAtlasesToCreate.append(std::make_pair(atlasID, coordinatedSurface)); 595 572 } 596 573 … … 599 576 if (m_isPurging) 600 577 return; 601 m_ webPage->send(Messages::CoordinatedLayerTreeHostProxy::RemoveUpdateAtlas(atlasID));578 m_state.updateAtlasesToRemove.append(atlasID); 602 579 } 603 580 -
trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h
r150015 r151212 1 1 /* 2 2 Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) 3 Copyright (C) 2013 Company 100, Inc. 3 4 4 5 This library is free software; you can redistribute it and/or … … 113 114 // CoordinatedImageBacking::Coordinator 114 115 virtual void createImageBacking(WebCore::CoordinatedImageBackingID) OVERRIDE; 115 virtual boolupdateImageBacking(WebCore::CoordinatedImageBackingID, PassRefPtr<WebCore::CoordinatedSurface>) OVERRIDE;116 virtual void updateImageBacking(WebCore::CoordinatedImageBackingID, PassRefPtr<WebCore::CoordinatedSurface>) OVERRIDE; 116 117 virtual void clearImageBackingContents(WebCore::CoordinatedImageBackingID) OVERRIDE; 117 118 virtual void removeImageBacking(WebCore::CoordinatedImageBackingID) OVERRIDE; … … 128 129 129 130 // UpdateAtlasClient 130 virtual boolcreateUpdateAtlas(uint32_t atlasID, PassRefPtr<WebCore::CoordinatedSurface>) OVERRIDE;131 virtual void createUpdateAtlas(uint32_t atlasID, PassRefPtr<WebCore::CoordinatedSurface>) OVERRIDE; 131 132 virtual void removeUpdateAtlas(uint32_t atlasID); 132 133 … … 139 140 void destroyPageOverlayLayer(); 140 141 bool flushPendingLayerChanges(); 141 void createCompositingLayers(); 142 void deleteCompositingLayers(); 142 void clearPendingStateChanges(); 143 143 void cancelPendingLayerFlush(); 144 144 void performScheduledLayerFlush(); … … 172 172 typedef HashMap<WebCore::CoordinatedLayerID, WebCore::CoordinatedGraphicsLayer*> LayerMap; 173 173 LayerMap m_registeredLayers; 174 Vector<WebCore::CoordinatedLayerID> m_layersToCreate;175 Vector<WebCore::CoordinatedLayerID> m_layersToDelete;176 174 typedef HashMap<WebCore::CoordinatedImageBackingID, RefPtr<WebCore::CoordinatedImageBacking> > ImageBackingMap; 177 175 ImageBackingMap m_imageBackings;
Note: See TracChangeset
for help on using the changeset viewer.