Ignore:
Timestamp:
Apr 8, 2016, 12:59:25 PM (9 years ago)
Author:
BJ Burg
Message:

Web Inspector: get rid of InspectorBasicValue and InspectorString subclasses
https://bugs.webkit.org/show_bug.cgi?id=156407
<rdar://problem/25627659>

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

There's no point having these subclasses as they don't save any space.
Add m_stringValue to the union and merge some implementations of writeJSON.
Move uses of the subclass to InspectorValue and delete redundant methods.
Now, most InspectorValue methods are non-virtual so they can be templated.

  • bindings/ScriptValue.cpp:

(Deprecated::jsToInspectorValue):

  • inspector/InjectedScriptBase.cpp:

(Inspector::InjectedScriptBase::makeCall):
Don't used deleted subclasses.

  • inspector/InspectorValues.cpp:

(Inspector::InspectorValue::null):
(Inspector::InspectorValue::create):
(Inspector::InspectorValue::asValue):
(Inspector::InspectorValue::asBoolean):
(Inspector::InspectorValue::asDouble):
(Inspector::InspectorValue::asInteger):
(Inspector::InspectorValue::asString):
These only need one implementation now.

(Inspector::InspectorValue::writeJSON):
Still a virtual method since Object and Array need their members.

(Inspector::InspectorObjectBase::InspectorObjectBase):
(Inspector::InspectorBasicValue::asBoolean): Deleted.
(Inspector::InspectorBasicValue::asDouble): Deleted.
(Inspector::InspectorBasicValue::asInteger): Deleted.
(Inspector::InspectorBasicValue::writeJSON): Deleted.
(Inspector::InspectorString::asString): Deleted.
(Inspector::InspectorString::writeJSON): Deleted.
(Inspector::InspectorString::create): Deleted.
(Inspector::InspectorBasicValue::create): Deleted.

  • inspector/InspectorValues.h:

(Inspector::InspectorObjectBase::setBoolean):
(Inspector::InspectorObjectBase::setInteger):
(Inspector::InspectorObjectBase::setDouble):
(Inspector::InspectorObjectBase::setString):
(Inspector::InspectorArrayBase::pushBoolean):
(Inspector::InspectorArrayBase::pushInteger):
(Inspector::InspectorArrayBase::pushDouble):
(Inspector::InspectorArrayBase::pushString):
Use new factory methods.

  • replay/EncodedValue.cpp:

(JSC::ScalarEncodingTraits<bool>::encodeValue):
(JSC::ScalarEncodingTraits<double>::encodeValue):
(JSC::ScalarEncodingTraits<float>::encodeValue):
(JSC::ScalarEncodingTraits<int32_t>::encodeValue):
(JSC::ScalarEncodingTraits<int64_t>::encodeValue):
(JSC::ScalarEncodingTraits<uint32_t>::encodeValue):
(JSC::ScalarEncodingTraits<uint64_t>::encodeValue):

  • replay/EncodedValue.h:

Use new factory methods.

Source/WebCore:

  • inspector/InspectorDatabaseAgent.cpp: Don't use deleted subclasses.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/bindings/ScriptValue.cpp

    r197614 r199242  
    113113        return InspectorValue::null();
    114114    if (value.isBoolean())
    115         return InspectorBasicValue::create(value.asBoolean());
     115        return InspectorValue::create(value.asBoolean());
    116116    if (value.isNumber() && value.isDouble())
    117         return InspectorBasicValue::create(value.asNumber());
     117        return InspectorValue::create(value.asNumber());
    118118    if (value.isNumber() && value.isMachineInt())
    119         return InspectorBasicValue::create(static_cast<int>(value.asMachineInt()));
     119        return InspectorValue::create(static_cast<int>(value.asMachineInt()));
    120120    if (value.isString())
    121         return InspectorString::create(value.getString(scriptState));
     121        return InspectorValue::create(value.getString(scriptState));
    122122
    123123    if (value.isObject()) {
Note: See TracChangeset for help on using the changeset viewer.