Title: [165665] trunk/Source/WebCore
Revision
165665
Author
jaep...@webkit.org
Date
2014-03-14 17:35:48 -0700 (Fri, 14 Mar 2014)

Log Message

[Texmap] Remove duplicated code in TextureMapperLayer
https://bugs.webkit.org/show_bug.cgi?id=130173

Reviewed by Martin Robinson.

This patch is a simple refactoring to remove duplicated code in
TextureMapperLayer.

* platform/graphics/texmap/TextureMapperLayer.cpp:
(WebCore::TextureMapperLayer::~TextureMapperLayer):
(WebCore::TextureMapperLayer::removeFromParent):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (165664 => 165665)


--- trunk/Source/WebCore/ChangeLog	2014-03-14 23:55:30 UTC (rev 165664)
+++ trunk/Source/WebCore/ChangeLog	2014-03-15 00:35:48 UTC (rev 165665)
@@ -1,3 +1,17 @@
+2014-03-14  Jae Hyun Park  <jaep...@webkit.org>
+
+        [Texmap] Remove duplicated code in TextureMapperLayer
+        https://bugs.webkit.org/show_bug.cgi?id=130173
+
+        Reviewed by Martin Robinson.
+
+        This patch is a simple refactoring to remove duplicated code in
+        TextureMapperLayer.
+
+        * platform/graphics/texmap/TextureMapperLayer.cpp:
+        (WebCore::TextureMapperLayer::~TextureMapperLayer):
+        (WebCore::TextureMapperLayer::removeFromParent):
+
 2014-03-14  Simon Fraser  <simon.fra...@apple.com>
 
         Release-assert if someone starts the WebThread in the WebProcess

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp (165664 => 165665)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp	2014-03-14 23:55:30 UTC (rev 165664)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp	2014-03-15 00:35:48 UTC (rev 165665)
@@ -462,10 +462,9 @@
 TextureMapperLayer::~TextureMapperLayer()
 {
     for (int i = m_children.size() - 1; i >= 0; --i)
-        m_children[i]->m_parent = 0;
+        m_children[i]->m_parent = nullptr;
 
-    if (m_parent)
-        m_parent->m_children.remove(m_parent->m_children.find(this));
+    removeFromParent();
 }
 
 TextureMapper* TextureMapperLayer::textureMapper() const
@@ -494,16 +493,12 @@
 void TextureMapperLayer::removeFromParent()
 {
     if (m_parent) {
-        unsigned i;
-        for (i = 0; i < m_parent->m_children.size(); i++) {
-            if (this == m_parent->m_children[i]) {
-                m_parent->m_children.remove(i);
-                break;
-            }
-        }
-
-        m_parent = 0;
+        size_t index = m_parent->m_children.find(this);
+        ASSERT(index != notFound);
+        m_parent->m_children.remove(index);
     }
+
+    m_parent = nullptr;
 }
 
 void TextureMapperLayer::removeAllChildren()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to