Unreviewed, rolling out r248970.
authorryanhaddad@apple.com <ryanhaddad@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Aug 2019 00:23:15 +0000 (00:23 +0000)
committerryanhaddad@apple.com <ryanhaddad@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Aug 2019 00:23:15 +0000 (00:23 +0000)
Caused
lldb_webkit_unittest.TestSummaryProviders.serial_test_WTFOptionSetProvider_empty
to fail.

Reverted changeset:

"[lldb-webkit] OptionSet summary shows size 0 sometimes for
non-empty set"
https://bugs.webkit.org/show_bug.cgi?id=200742
https://trac.webkit.org/changeset/248970

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248980 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/lldb/lldb_webkit.py

index 2fe5e0a..0f40cc4 100644 (file)
@@ -1,3 +1,18 @@
+2019-08-21  Ryan Haddad  <ryanhaddad@apple.com>
+
+        Unreviewed, rolling out r248970.
+
+        Caused
+        lldb_webkit_unittest.TestSummaryProviders.serial_test_WTFOptionSetProvider_empty
+        to fail.
+
+        Reverted changeset:
+
+        "[lldb-webkit] OptionSet summary shows size 0 sometimes for
+        non-empty set"
+        https://bugs.webkit.org/show_bug.cgi?id=200742
+        https://trac.webkit.org/changeset/248970
+
 2019-08-21  Jonathan Bedard  <jbedard@apple.com>
 
         results.webkit.org: Add database table to save zip archives to
index f5ae2c1..dbe4f02 100644 (file)
@@ -735,7 +735,6 @@ class WebCoreDocumentProvider:
 class FlagEnumerationProvider(object):
     def __init__(self, valobj, internal_dict):
         self.valobj = valobj
-        self._elements = []
         self.update()
 
     # Subclasses must override this to return a dictionary that maps emumerator values to names.
@@ -751,24 +750,6 @@ class FlagEnumerationProvider(object):
     def _update(self):
         pass
 
-    # Subclasses can override this to provide the index that corresponds to the specified name.
-    # If this method is overridden then it is also expected that _get_child_at_index() will be
-    # overridden to provide the value for the index returned by this method. Note that the
-    # returned index must be greater than or equal to self.size in order to avoid breaking
-    # printing of synthetic children.
-    def _get_child_index(self, name):
-        return None
-
-    # Subclasses can override this to provide the SBValue for the specified index. It is only
-    # meaningful to override this method if _get_child_index() is also overridden.
-    def _get_child_at_index(self, index):
-        return None
-
-    @property
-    def size(self):
-        return len(self._elements)
-
-    # LLDB overrides
     def has_children(self):
         return bool(self._elements)
 
@@ -776,7 +757,10 @@ class FlagEnumerationProvider(object):
         return len(self._elements)
 
     def get_child_index(self, name):
-        return self._get_child_index(name)
+        try:
+            return int(name.lstrip('[').rstrip(']'))
+        except:
+            return None
 
     def get_child_at_index(self, index):
         if index < 0 or not self.valobj.IsValid():
@@ -784,11 +768,14 @@ class FlagEnumerationProvider(object):
         if index < len(self._elements):
             (name, value) = self._elements[index]
             return self.valobj.CreateValueFromExpression(name, str(value))
-        return self._get_child_at_index(index)
+        return None
 
     def update(self):
         self._update()
 
+        self._elements = []
+        self.size = 0
+
         enumerator_value_to_name_map = self._enumerator_value_to_name_map()
         if not enumerator_value_to_name_map:
             return
@@ -806,6 +793,8 @@ class FlagEnumerationProvider(object):
             elements.append((enumerator_value_to_name_map[current], current))  # e.g. ('Spelling', 4)
             bitmask = bitmask & (bitmask - 1)  # Turn off the rightmost set bit.
         self._elements = elements
+        self.size = len(elements)
+
 
 class WTFOptionSetProvider(FlagEnumerationProvider):
     def _enumerator_value_to_name_map(self):
@@ -823,16 +812,6 @@ class WTFOptionSetProvider(FlagEnumerationProvider):
     def _update(self):
         self.storage = self.valobj.GetChildMemberWithName('m_storage')  # May be an invalid value.
 
-    def _get_child_index(self, name):
-        if name == 'm_storage':
-            return self.size
-        return None
-
-    def _get_child_at_index(self, index):
-        if index == self.size:
-            return self.storage
-        return None
-
 
 class RawBitmaskProviderBase(FlagEnumerationProvider):
     ENUMERATOR_VALUE_TO_NAME_MAP = {}