Changeset 60687 in webkit


Ignore:
Timestamp:
Jun 4, 2010 10:23:10 AM (14 years ago)
Author:
loislo@chromium.org
Message:

2010-06-04 Ilya Tikhonovsky <loislo@chromium.org>

Reviewed by Pavel Feldman.

WebInspector: Web Inspector: it would be better to push object properties to JSON string in order of insertion.
https://bugs.webkit.org/show_bug.cgi?id=40140

  • inspector/InspectorValues.cpp: (WebCore::InspectorObject::writeJSON):
  • inspector/InspectorValues.h: (WebCore::InspectorObject::setBool): (WebCore::InspectorObject::setNumber): (WebCore::InspectorObject::setString): (WebCore::InspectorObject::set):
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r60684 r60687  
     12010-06-04  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        WebInspector: Web Inspector: it would be better to push object properties to JSON string in order of insertion.
     6        https://bugs.webkit.org/show_bug.cgi?id=40140
     7
     8        * inspector/InspectorValues.cpp:
     9        (WebCore::InspectorObject::writeJSON):
     10        * inspector/InspectorValues.h:
     11        (WebCore::InspectorObject::setBool):
     12        (WebCore::InspectorObject::setNumber):
     13        (WebCore::InspectorObject::setString):
     14        (WebCore::InspectorObject::set):
     15
    1162010-06-04  Tony Gentilcore  <tonyg@chromium.org>
    217
  • trunk/WebCore/inspector/InspectorValues.cpp

    r60452 r60687  
    109109{
    110110    output->append('{');
    111     for (Dictionary::const_iterator it = m_data.begin(); it != m_data.end(); ++it) {
     111    for (size_t i = 0; i < m_order.size(); ++i) {
     112        Dictionary::const_iterator it = m_data.find(m_order[i]);
     113        ASSERT(it != m_data.end());
    112114        if (it != m_data.begin())
    113115            output->append(',');
  • trunk/WebCore/inspector/InspectorValues.h

    r60452 r60687  
    146146    typedef HashMap<String, RefPtr<InspectorValue> > Dictionary;
    147147    Dictionary m_data;
     148    Vector<String> m_order;
    148149};
    149150
     
    171172inline void InspectorObject::setBool(const String& name, bool value)
    172173{
    173     m_data.set(name, InspectorBasicValue::create(value));
     174    set(name, InspectorBasicValue::create(value));
    174175}
    175176
    176177inline void InspectorObject::setNumber(const String& name, double value)
    177178{
    178     m_data.set(name, InspectorBasicValue::create(value));
     179    set(name, InspectorBasicValue::create(value));
    179180}
    180181
    181182inline void InspectorObject::setString(const String& name, const String& value)
    182183{
    183     m_data.set(name, InspectorString::create(value));
     184    set(name, InspectorString::create(value));
    184185}
    185186
    186187inline void InspectorObject::set(const String& name, PassRefPtr<InspectorValue> value)
    187188{
    188     m_data.set(name, value);
     189    if (m_data.set(name, value).second)
     190        m_order.append(name);
    189191}
    190192
Note: See TracChangeset for help on using the changeset viewer.