Changeset 199320 in webkit
- Timestamp:
- Apr 11, 2016 4:22:16 PM (8 years ago)
- Location:
- trunk/Source
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r199303 r199320 1 2016-04-11 Brian Burg <bburg@apple.com> 2 3 Web Inspector: get rid of InspectorBasicValue and InspectorString subclasses 4 https://bugs.webkit.org/show_bug.cgi?id=156407 5 <rdar://problem/25627659> 6 7 Reviewed by Joseph Pecoraro. 8 9 There's no point having these subclasses as they don't save any space. 10 Add a StringImpl to the union and merge some implementations of writeJSON. 11 12 Rename m_data to m_map and explicitly name the union as InspectorValue::m_value. 13 If the value is a string and the string is not empty or null (i.e., it has a 14 StringImpl), then we need to ref() and deref() the string as the InspectorValue 15 is created or destroyed. 16 17 Move uses of the subclass to InspectorValue and delete redundant methods. 18 Now, most InspectorValue methods are non-virtual so they can be templated. 19 20 * bindings/ScriptValue.cpp: 21 (Deprecated::jsToInspectorValue): 22 * inspector/InjectedScriptBase.cpp: 23 (Inspector::InjectedScriptBase::makeCall): 24 Don't used deleted subclasses. 25 26 * inspector/InspectorValues.cpp: 27 (Inspector::InspectorValue::null): 28 (Inspector::InspectorValue::create): 29 (Inspector::InspectorValue::asValue): 30 (Inspector::InspectorValue::asBoolean): 31 (Inspector::InspectorValue::asDouble): 32 (Inspector::InspectorValue::asInteger): 33 (Inspector::InspectorValue::asString): 34 These only need one implementation now. 35 36 (Inspector::InspectorValue::writeJSON): 37 Still a virtual method since Object and Array need their members. 38 39 (Inspector::InspectorObjectBase::InspectorObjectBase): 40 (Inspector::InspectorBasicValue::asBoolean): Deleted. 41 (Inspector::InspectorBasicValue::asDouble): Deleted. 42 (Inspector::InspectorBasicValue::asInteger): Deleted. 43 (Inspector::InspectorBasicValue::writeJSON): Deleted. 44 (Inspector::InspectorString::asString): Deleted. 45 (Inspector::InspectorString::writeJSON): Deleted. 46 (Inspector::InspectorString::create): Deleted. 47 (Inspector::InspectorBasicValue::create): Deleted. 48 49 * inspector/InspectorValues.h: 50 (Inspector::InspectorObjectBase::find): 51 (Inspector::InspectorObjectBase::setBoolean): 52 (Inspector::InspectorObjectBase::setInteger): 53 (Inspector::InspectorObjectBase::setDouble): 54 (Inspector::InspectorObjectBase::setString): 55 (Inspector::InspectorObjectBase::setValue): 56 (Inspector::InspectorObjectBase::setObject): 57 (Inspector::InspectorObjectBase::setArray): 58 (Inspector::InspectorArrayBase::pushBoolean): 59 (Inspector::InspectorArrayBase::pushInteger): 60 (Inspector::InspectorArrayBase::pushDouble): 61 (Inspector::InspectorArrayBase::pushString): 62 (Inspector::InspectorArrayBase::pushValue): 63 (Inspector::InspectorArrayBase::pushObject): 64 (Inspector::InspectorArrayBase::pushArray): 65 Use new factory methods. 66 67 * replay/EncodedValue.cpp: 68 (JSC::ScalarEncodingTraits<bool>::encodeValue): 69 (JSC::ScalarEncodingTraits<double>::encodeValue): 70 (JSC::ScalarEncodingTraits<float>::encodeValue): 71 (JSC::ScalarEncodingTraits<int32_t>::encodeValue): 72 (JSC::ScalarEncodingTraits<int64_t>::encodeValue): 73 (JSC::ScalarEncodingTraits<uint32_t>::encodeValue): 74 (JSC::ScalarEncodingTraits<uint64_t>::encodeValue): 75 * replay/EncodedValue.h: 76 Use new factory methods. 77 1 78 2016-04-11 Filip Pizlo <fpizlo@apple.com> 2 79 -
trunk/Source/JavaScriptCore/bindings/ScriptValue.cpp
r199276 r199320 113 113 return InspectorValue::null(); 114 114 if (value.isBoolean()) 115 return Inspector BasicValue::create(value.asBoolean());115 return InspectorValue::create(value.asBoolean()); 116 116 if (value.isNumber() && value.isDouble()) 117 return Inspector BasicValue::create(value.asNumber());117 return InspectorValue::create(value.asNumber()); 118 118 if (value.isNumber() && value.isMachineInt()) 119 return Inspector BasicValue::create(static_cast<int>(value.asMachineInt()));119 return InspectorValue::create(static_cast<int>(value.asMachineInt())); 120 120 if (value.isString()) 121 return Inspector String::create(value.getString(scriptState));121 return InspectorValue::create(value.getString(scriptState)); 122 122 123 123 if (value.isObject()) { -
trunk/Source/JavaScriptCore/inspector/InjectedScriptBase.cpp
r199276 r199320 100 100 *result = resultValue.toInspectorValue(m_injectedScriptObject.scriptState()); 101 101 if (!*result) 102 *result = Inspector String::create(String::format("Object has too long reference chain (must not be longer than %d)", InspectorValue::maxDepth));102 *result = InspectorValue::create(String::format("Object has too long reference chain (must not be longer than %d)", InspectorValue::maxDepth)); 103 103 } else 104 *result = Inspector String::create("Exception while making a call.");104 *result = InspectorValue::create("Exception while making a call."); 105 105 } 106 106 -
trunk/Source/JavaScriptCore/inspector/InspectorValues.cpp
r199276 r199320 364 364 break; 365 365 case BOOL_TRUE: 366 result = Inspector BasicValue::create(true);366 result = InspectorValue::create(true); 367 367 break; 368 368 case BOOL_FALSE: 369 result = Inspector BasicValue::create(false);369 result = InspectorValue::create(false); 370 370 break; 371 371 case NUMBER: { … … 374 374 if (!ok) 375 375 return nullptr; 376 result = Inspector BasicValue::create(value);376 result = InspectorValue::create(value); 377 377 break; 378 378 } … … 382 382 if (!ok) 383 383 return nullptr; 384 result = Inspector String::create(value);384 result = InspectorValue::create(value); 385 385 break; 386 386 } … … 499 499 } // anonymous namespace 500 500 501 bool InspectorValue::asBoolean(bool&) const 502 { 503 return false; 504 } 505 506 bool InspectorValue::asDouble(double&) const 507 { 508 return false; 509 } 510 511 bool InspectorValue::asDouble(float&) const 512 { 513 return false; 514 } 515 516 bool InspectorValue::asInteger(int&) const 517 { 518 return false; 519 } 520 521 bool InspectorValue::asInteger(unsigned&) const 522 { 523 return false; 524 } 525 526 bool InspectorValue::asInteger(long&) const 527 { 528 return false; 529 } 530 531 bool InspectorValue::asInteger(long long&) const 532 { 533 return false; 534 } 535 536 bool InspectorValue::asInteger(unsigned long&) const 537 { 538 return false; 539 } 540 541 bool InspectorValue::asInteger(unsigned long long&) const 542 { 543 return false; 544 } 545 546 bool InspectorValue::asString(String&) const 547 { 548 return false; 549 } 550 551 bool InspectorValue::asValue(RefPtr<InspectorValue>& output) 552 { 553 output = this; 501 Ref<InspectorValue> InspectorValue::null() 502 { 503 return adoptRef(*new InspectorValue); 504 } 505 506 Ref<InspectorValue> InspectorValue::create(bool value) 507 { 508 return adoptRef(*new InspectorValue(value)); 509 } 510 511 Ref<InspectorValue> InspectorValue::create(int value) 512 { 513 return adoptRef(*new InspectorValue(value)); 514 } 515 516 Ref<InspectorValue> InspectorValue::create(double value) 517 { 518 return adoptRef(*new InspectorValue(value)); 519 } 520 521 Ref<InspectorValue> InspectorValue::create(const String& value) 522 { 523 return adoptRef(*new InspectorValue(value)); 524 } 525 526 Ref<InspectorValue> InspectorValue::create(const char* value) 527 { 528 return adoptRef(*new InspectorValue(value)); 529 } 530 531 bool InspectorValue::asValue(RefPtr<Inspector::InspectorValue> & value) 532 { 533 value = this; 554 534 return true; 555 535 } … … 588 568 } 589 569 570 bool InspectorValue::asBoolean(bool& output) const 571 { 572 if (type() != Type::Boolean) 573 return false; 574 575 output = m_value.boolean; 576 return true; 577 } 578 579 bool InspectorValue::asDouble(double& output) const 580 { 581 if (type() != Type::Double) 582 return false; 583 584 output = m_value.number; 585 return true; 586 } 587 588 bool InspectorValue::asDouble(float& output) const 589 { 590 if (type() != Type::Double) 591 return false; 592 593 output = static_cast<float>(m_value.number); 594 return true; 595 } 596 597 bool InspectorValue::asInteger(int& output) const 598 { 599 if (type() != Type::Integer && type() != Type::Double) 600 return false; 601 602 output = static_cast<int>(m_value.number); 603 return true; 604 } 605 606 bool InspectorValue::asInteger(unsigned& output) const 607 { 608 if (type() != Type::Integer && type() != Type::Double) 609 return false; 610 611 output = static_cast<unsigned>(m_value.number); 612 return true; 613 } 614 615 bool InspectorValue::asInteger(long& output) const 616 { 617 if (type() != Type::Integer && type() != Type::Double) 618 return false; 619 620 output = static_cast<long>(m_value.number); 621 return true; 622 } 623 624 bool InspectorValue::asInteger(long long& output) const 625 { 626 if (type() != Type::Integer && type() != Type::Double) 627 return false; 628 629 output = static_cast<long long>(m_value.number); 630 return true; 631 } 632 633 bool InspectorValue::asInteger(unsigned long& output) const 634 { 635 if (type() != Type::Integer && type() != Type::Double) 636 return false; 637 638 output = static_cast<unsigned long>(m_value.number); 639 return true; 640 } 641 642 bool InspectorValue::asInteger(unsigned long long& output) const 643 { 644 if (type() != Type::Integer && type() != Type::Double) 645 return false; 646 647 output = static_cast<unsigned long long>(m_value.number); 648 return true; 649 } 650 651 bool InspectorValue::asString(String& output) const 652 { 653 if (type() != Type::String) 654 return false; 655 656 output = m_value.string; 657 return true; 658 } 659 590 660 void InspectorValue::writeJSON(StringBuilder& output) const 591 661 { 592 ASSERT(m_type == Type::Null); 593 594 output.appendLiteral("null"); 595 } 596 597 bool InspectorBasicValue::asBoolean(bool& output) const 598 { 599 if (type() != Type::Boolean) 600 return false; 601 602 output = m_booleanValue; 603 return true; 604 } 605 606 bool InspectorBasicValue::asDouble(double& output) const 607 { 608 if (type() != Type::Double) 609 return false; 610 611 output = m_doubleValue; 612 return true; 613 } 614 615 bool InspectorBasicValue::asDouble(float& output) const 616 { 617 if (type() != Type::Double) 618 return false; 619 620 output = static_cast<float>(m_doubleValue); 621 return true; 622 } 623 624 bool InspectorBasicValue::asInteger(int& output) const 625 { 626 if (type() != Type::Integer && type() != Type::Double) 627 return false; 628 629 output = static_cast<int>(m_doubleValue); 630 return true; 631 } 632 633 bool InspectorBasicValue::asInteger(unsigned& output) const 634 { 635 if (type() != Type::Integer && type() != Type::Double) 636 return false; 637 638 output = static_cast<unsigned>(m_doubleValue); 639 return true; 640 } 641 642 bool InspectorBasicValue::asInteger(long& output) const 643 { 644 if (type() != Type::Integer && type() != Type::Double) 645 return false; 646 647 output = static_cast<long>(m_doubleValue); 648 return true; 649 } 650 651 bool InspectorBasicValue::asInteger(long long& output) const 652 { 653 if (type() != Type::Integer && type() != Type::Double) 654 return false; 655 656 output = static_cast<long long>(m_doubleValue); 657 return true; 658 } 659 660 bool InspectorBasicValue::asInteger(unsigned long& output) const 661 { 662 if (type() != Type::Integer && type() != Type::Double) 663 return false; 664 665 output = static_cast<unsigned long>(m_doubleValue); 666 return true; 667 } 668 669 bool InspectorBasicValue::asInteger(unsigned long long& output) const 670 { 671 if (type() != Type::Integer && type() != Type::Double) 672 return false; 673 674 output = static_cast<unsigned long long>(m_doubleValue); 675 return true; 676 } 677 678 void InspectorBasicValue::writeJSON(StringBuilder& output) const 679 { 680 ASSERT(type() == Type::Boolean || type() == Type::Double || type() == Type::Integer); 681 682 if (type() == Type::Boolean) { 683 if (m_booleanValue) 662 switch (m_type) { 663 case Type::Null: 664 output.appendLiteral("null"); 665 break; 666 case Type::Boolean: 667 if (m_value.boolean) 684 668 output.appendLiteral("true"); 685 669 else 686 670 output.appendLiteral("false"); 687 } else if (type() == Type::Double || type() == Type::Integer) { 671 break; 672 case Type::String: 673 doubleQuoteString(m_value.string, output); 674 break; 675 case Type::Double: 676 case Type::Integer: { 688 677 NumberToLStringBuffer buffer; 689 if (!std::isfinite(m_ doubleValue)) {678 if (!std::isfinite(m_value.number)) { 690 679 output.appendLiteral("null"); 691 680 return; 692 681 } 693 DecimalNumber decimal = m_ doubleValue;682 DecimalNumber decimal = m_value.number; 694 683 unsigned length = 0; 695 684 if (decimal.bufferLengthForStringDecimal() > WTF::NumberToStringBufferLength) { … … 704 693 length = decimal.toStringDecimal(buffer, WTF::NumberToStringBufferLength); 705 694 output.append(buffer, length); 706 } 707 } 708 709 bool InspectorString::asString(String& output) const 710 { 711 output = m_stringValue; 712 return true; 713 } 714 715 void InspectorString::writeJSON(StringBuilder& output) const 716 { 717 ASSERT(type() == Type::String); 718 doubleQuoteString(m_stringValue, output); 695 break; 696 } 697 default: 698 ASSERT_NOT_REACHED(); 699 } 719 700 } 720 701 … … 776 757 bool InspectorObjectBase::getValue(const String& name, RefPtr<InspectorValue>& output) const 777 758 { 778 Dictionary::const_iterator findResult = m_ data.find(name);779 if (findResult == m_ data.end())759 Dictionary::const_iterator findResult = m_map.find(name); 760 if (findResult == m_map.end()) 780 761 return false; 781 762 … … 786 767 void InspectorObjectBase::remove(const String& name) 787 768 { 788 m_ data.remove(name);769 m_map.remove(name); 789 770 m_order.removeFirst(name); 790 771 } … … 794 775 output.append('{'); 795 776 for (size_t i = 0; i < m_order.size(); ++i) { 796 auto findResult = m_ data.find(m_order[i]);797 ASSERT(findResult != m_ data.end());777 auto findResult = m_map.find(m_order[i]); 778 ASSERT(findResult != m_map.end()); 798 779 if (i) 799 780 output.append(','); … … 806 787 807 788 InspectorObjectBase::InspectorObjectBase() 808 : Inspector Value(Type::Object)809 , m_ data()789 : Inspector::InspectorValue(Type::Object) 790 , m_map() 810 791 , m_order() 811 792 { … … 826 807 { 827 808 output.append('['); 828 for (Vector<RefPtr<InspectorValue>>::const_iterator it = m_ data.begin(); it != m_data.end(); ++it) {829 if (it != m_ data.begin())809 for (Vector<RefPtr<InspectorValue>>::const_iterator it = m_map.begin(); it != m_map.end(); ++it) { 810 if (it != m_map.begin()) 830 811 output.append(','); 831 812 (*it)->writeJSON(output); … … 836 817 InspectorArrayBase::InspectorArrayBase() 837 818 : InspectorValue(Type::Array) 838 , m_ data()819 , m_map() 839 820 { 840 821 } … … 842 823 RefPtr<InspectorValue> InspectorArrayBase::get(size_t index) const 843 824 { 844 ASSERT_WITH_SECURITY_IMPLICATION(index < m_ data.size());845 return m_ data[index];825 ASSERT_WITH_SECURITY_IMPLICATION(index < m_map.size()); 826 return m_map[index]; 846 827 } 847 828 … … 856 837 } 857 838 858 Ref<InspectorValue> InspectorValue::null()859 {860 return adoptRef(*new InspectorValue);861 }862 863 Ref<InspectorString> InspectorString::create(const String& value)864 {865 return adoptRef(*new InspectorString(value));866 }867 868 Ref<InspectorString> InspectorString::create(const char* value)869 {870 return adoptRef(*new InspectorString(value));871 }872 873 Ref<InspectorBasicValue> InspectorBasicValue::create(bool value)874 {875 return adoptRef(*new InspectorBasicValue(value));876 }877 878 Ref<InspectorBasicValue> InspectorBasicValue::create(int value)879 {880 return adoptRef(*new InspectorBasicValue(value));881 }882 883 Ref<InspectorBasicValue> InspectorBasicValue::create(double value)884 {885 return adoptRef(*new InspectorBasicValue(value));886 }887 888 839 } // namespace Inspector -
trunk/Source/JavaScriptCore/inspector/InspectorValues.h
r199276 r199320 52 52 static const int maxDepth = 1000; 53 53 54 InspectorValue() 55 : m_type(Type::Null) { } 56 virtual ~InspectorValue() { } 54 virtual ~InspectorValue() 55 { 56 switch (m_type) { 57 case Type::Null: 58 case Type::Boolean: 59 case Type::Double: 60 case Type::Integer: 61 break; 62 case Type::String: 63 if (m_value.string) 64 m_value.string->deref(); 65 break; 66 case Type::Object: 67 case Type::Array: 68 break; 69 } 70 } 57 71 58 72 static Ref<InspectorValue> null(); 73 static Ref<InspectorValue> create(bool); 74 static Ref<InspectorValue> create(int); 75 static Ref<InspectorValue> create(double); 76 static Ref<InspectorValue> create(const String&); 77 static Ref<InspectorValue> create(const char*); 59 78 60 79 enum class Type { … … 65 84 String, 66 85 Object, 67 Array 86 Array, 68 87 }; 69 88 70 89 Type type() const { return m_type; } 71 72 90 bool isNull() const { return m_type == Type::Null; } 73 91 74 virtual bool asBoolean(bool&) const; 75 virtual bool asInteger(int&) const; 76 virtual bool asInteger(unsigned&) const; 77 virtual bool asInteger(long&) const; 78 virtual bool asInteger(long long&) const; 79 virtual bool asInteger(unsigned long&) const; 80 virtual bool asInteger(unsigned long long&) const; 81 virtual bool asDouble(double&) const; 82 virtual bool asDouble(float&) const; 83 virtual bool asString(String&) const; 84 virtual bool asValue(RefPtr<InspectorValue>&); 92 bool asBoolean(bool&) const; 93 bool asInteger(int&) const; 94 bool asInteger(unsigned&) const; 95 bool asInteger(long&) const; 96 bool asInteger(long long&) const; 97 bool asInteger(unsigned long&) const; 98 bool asInteger(unsigned long long&) const; 99 bool asDouble(double&) const; 100 bool asDouble(float&) const; 101 bool asString(String&) const; 102 bool asValue(RefPtr<InspectorValue>&); 103 85 104 virtual bool asObject(RefPtr<InspectorObject>&); 86 105 virtual bool asArray(RefPtr<InspectorArray>&); … … 92 111 93 112 protected: 94 explicit InspectorValue(Type type) : m_type(type) { } 113 InspectorValue() 114 : m_type(Type::Null) { } 115 116 explicit InspectorValue(Type type) 117 : m_type(type) { } 118 119 explicit InspectorValue(bool value) 120 : m_type(Type::Boolean) 121 { 122 m_value.boolean = value; 123 } 124 125 explicit InspectorValue(int value) 126 : m_type(Type::Integer) 127 { 128 m_value.number = static_cast<double>(value); 129 } 130 131 explicit InspectorValue(double value) 132 : m_type(Type::Double) 133 { 134 m_value.number = value; 135 } 136 137 explicit InspectorValue(const String& value) 138 : m_type(Type::String) 139 { 140 m_value.string = value.impl(); 141 if (m_value.string) 142 m_value.string->ref(); 143 } 144 145 explicit InspectorValue(const char* value) 146 : m_type(Type::String) 147 { 148 String wrapper(value); 149 m_value.string = wrapper.impl(); 150 if (m_value.string) 151 m_value.string->ref(); 152 } 95 153 96 154 private: 97 Type m_type; 98 }; 99 100 class JS_EXPORT_PRIVATE InspectorBasicValue : public InspectorValue { 101 public: 102 103 static Ref<InspectorBasicValue> create(bool); 104 static Ref<InspectorBasicValue> create(int); 105 static Ref<InspectorBasicValue> create(double); 106 107 bool asBoolean(bool&) const override; 108 // Numbers from the frontend are always parsed as doubles, so we allow 109 // clients to convert to integral values with this function. 110 bool asInteger(int&) const override; 111 bool asInteger(unsigned&) const override; 112 bool asInteger(long&) const override; 113 bool asInteger(long long&) const override; 114 bool asInteger(unsigned long&) const override; 115 bool asInteger(unsigned long long&) const override; 116 bool asDouble(double&) const override; 117 bool asDouble(float&) const override; 118 119 void writeJSON(StringBuilder& output) const override; 120 121 private: 122 explicit InspectorBasicValue(bool value) 123 : InspectorValue(Type::Boolean) 124 , m_booleanValue(value) { } 125 126 explicit InspectorBasicValue(int value) 127 : InspectorValue(Type::Integer) 128 , m_doubleValue(static_cast<double>(value)) { } 129 130 explicit InspectorBasicValue(double value) 131 : InspectorValue(Type::Double) 132 , m_doubleValue(value) { } 133 155 Type m_type { Type::Null }; 134 156 union { 135 bool m_booleanValue; 136 double m_doubleValue; 137 }; 138 }; 139 140 class JS_EXPORT_PRIVATE InspectorString : public InspectorValue { 141 public: 142 static Ref<InspectorString> create(const String&); 143 static Ref<InspectorString> create(const char*); 144 145 bool asString(String& output) const override; 146 147 void writeJSON(StringBuilder& output) const override; 148 149 private: 150 explicit InspectorString(const String& value) 151 : InspectorValue(Type::String) 152 , m_stringValue(value) { } 153 154 explicit InspectorString(const char* value) 155 : InspectorValue(Type::String) 156 , m_stringValue(value) { } 157 158 String m_stringValue; 157 bool boolean; 158 double number; 159 StringImpl* string; 160 } m_value; 159 161 }; 160 162 … … 214 216 void writeJSON(StringBuilder& output) const override; 215 217 216 iterator begin() { return m_ data.begin(); }217 iterator end() { return m_ data.end(); }218 const_iterator begin() const { return m_ data.begin(); }219 const_iterator end() const { return m_ data.end(); }220 221 int size() const { return m_ data.size(); }218 iterator begin() { return m_map.begin(); } 219 iterator end() { return m_map.end(); } 220 const_iterator begin() const { return m_map.begin(); } 221 const_iterator end() const { return m_map.end(); } 222 223 int size() const { return m_map.size(); } 222 224 223 225 protected: … … 225 227 226 228 private: 227 Dictionary m_ data;229 Dictionary m_map; 228 230 Vector<String> m_order; 229 231 }; … … 266 268 typedef Vector<RefPtr<InspectorValue>>::const_iterator const_iterator; 267 269 268 unsigned length() const { return static_cast<unsigned>(m_ data.size()); }270 unsigned length() const { return static_cast<unsigned>(m_map.size()); } 269 271 270 272 protected: … … 285 287 void writeJSON(StringBuilder& output) const override; 286 288 287 iterator begin() { return m_ data.begin(); }288 iterator end() { return m_ data.end(); }289 const_iterator begin() const { return m_ data.begin(); }290 const_iterator end() const { return m_ data.end(); }289 iterator begin() { return m_map.begin(); } 290 iterator end() { return m_map.end(); } 291 const_iterator begin() const { return m_map.begin(); } 292 const_iterator end() const { return m_map.end(); } 291 293 292 294 protected: … … 294 296 295 297 private: 296 Vector<RefPtr<InspectorValue>> m_ data;298 Vector<RefPtr<InspectorValue>> m_map; 297 299 }; 298 300 … … 320 322 inline InspectorObjectBase::iterator InspectorObjectBase::find(const String& name) 321 323 { 322 return m_ data.find(name);324 return m_map.find(name); 323 325 } 324 326 325 327 inline InspectorObjectBase::const_iterator InspectorObjectBase::find(const String& name) const 326 328 { 327 return m_ data.find(name);329 return m_map.find(name); 328 330 } 329 331 330 332 inline void InspectorObjectBase::setBoolean(const String& name, bool value) 331 333 { 332 setValue(name, Inspector BasicValue::create(value));334 setValue(name, InspectorValue::create(value)); 333 335 } 334 336 335 337 inline void InspectorObjectBase::setInteger(const String& name, int value) 336 338 { 337 setValue(name, Inspector BasicValue::create(value));339 setValue(name, InspectorValue::create(value)); 338 340 } 339 341 340 342 inline void InspectorObjectBase::setDouble(const String& name, double value) 341 343 { 342 setValue(name, Inspector BasicValue::create(value));344 setValue(name, InspectorValue::create(value)); 343 345 } 344 346 345 347 inline void InspectorObjectBase::setString(const String& name, const String& value) 346 348 { 347 setValue(name, Inspector String::create(value));349 setValue(name, InspectorValue::create(value)); 348 350 } 349 351 … … 351 353 { 352 354 ASSERT(value); 353 if (m_ data.set(name, WTFMove(value)).isNewEntry)355 if (m_map.set(name, WTFMove(value)).isNewEntry) 354 356 m_order.append(name); 355 357 } … … 358 360 { 359 361 ASSERT(value); 360 if (m_ data.set(name, WTFMove(value)).isNewEntry)362 if (m_map.set(name, WTFMove(value)).isNewEntry) 361 363 m_order.append(name); 362 364 } … … 365 367 { 366 368 ASSERT(value); 367 if (m_ data.set(name, WTFMove(value)).isNewEntry)369 if (m_map.set(name, WTFMove(value)).isNewEntry) 368 370 m_order.append(name); 369 371 } … … 371 373 inline void InspectorArrayBase::pushBoolean(bool value) 372 374 { 373 m_ data.append(InspectorBasicValue::create(value));375 m_map.append(InspectorValue::create(value)); 374 376 } 375 377 376 378 inline void InspectorArrayBase::pushInteger(int value) 377 379 { 378 m_ data.append(InspectorBasicValue::create(value));380 m_map.append(InspectorValue::create(value)); 379 381 } 380 382 381 383 inline void InspectorArrayBase::pushDouble(double value) 382 384 { 383 m_ data.append(InspectorBasicValue::create(value));385 m_map.append(InspectorValue::create(value)); 384 386 } 385 387 386 388 inline void InspectorArrayBase::pushString(const String& value) 387 389 { 388 m_ data.append(InspectorString::create(value));390 m_map.append(InspectorValue::create(value)); 389 391 } 390 392 … … 392 394 { 393 395 ASSERT(value); 394 m_ data.append(WTFMove(value));396 m_map.append(WTFMove(value)); 395 397 } 396 398 … … 398 400 { 399 401 ASSERT(value); 400 m_ data.append(WTFMove(value));402 m_map.append(WTFMove(value)); 401 403 } 402 404 … … 404 406 { 405 407 ASSERT(value); 406 m_ data.append(WTFMove(value));408 m_map.append(WTFMove(value)); 407 409 } 408 410 -
trunk/Source/JavaScriptCore/replay/EncodedValue.cpp
r199276 r199320 68 68 template<> EncodedValue ScalarEncodingTraits<bool>::encodeValue(const bool& value) 69 69 { 70 return EncodedValue(Inspector BasicValue::create(value));70 return EncodedValue(InspectorValue::create(value)); 71 71 } 72 72 73 73 template<> EncodedValue ScalarEncodingTraits<double>::encodeValue(const double& value) 74 74 { 75 return EncodedValue(Inspector BasicValue::create(value));75 return EncodedValue(InspectorValue::create(value)); 76 76 } 77 77 78 78 template<> EncodedValue ScalarEncodingTraits<float>::encodeValue(const float& value) 79 79 { 80 return EncodedValue(Inspector BasicValue::create((double)value));80 return EncodedValue(InspectorValue::create((double)value)); 81 81 } 82 82 83 83 template<> EncodedValue ScalarEncodingTraits<int32_t>::encodeValue(const int32_t& value) 84 84 { 85 return EncodedValue(Inspector BasicValue::create((double)value));85 return EncodedValue(InspectorValue::create((double)value)); 86 86 } 87 87 88 88 template<> EncodedValue ScalarEncodingTraits<int64_t>::encodeValue(const int64_t& value) 89 89 { 90 return EncodedValue(Inspector BasicValue::create((double)value));90 return EncodedValue(InspectorValue::create((double)value)); 91 91 } 92 92 93 93 template<> EncodedValue ScalarEncodingTraits<uint32_t>::encodeValue(const uint32_t& value) 94 94 { 95 return EncodedValue(Inspector BasicValue::create((double)value));95 return EncodedValue(InspectorValue::create((double)value)); 96 96 } 97 97 98 98 template<> EncodedValue ScalarEncodingTraits<uint64_t>::encodeValue(const uint64_t& value) 99 99 { 100 return EncodedValue(Inspector BasicValue::create((double)value));100 return EncodedValue(InspectorValue::create((double)value)); 101 101 } 102 102 -
trunk/Source/JavaScriptCore/replay/EncodedValue.h
r199276 r199320 60 60 static EncodedValue createString(const String& value) 61 61 { 62 return EncodedValue(Inspector::Inspector String::create(value));62 return EncodedValue(Inspector::InspectorValue::create(value)); 63 63 } 64 64 65 65 static EncodedValue createString(const char* value) 66 66 { 67 return EncodedValue(Inspector::Inspector String::create(value));67 return EncodedValue(Inspector::InspectorValue::create(value)); 68 68 } 69 69 -
trunk/Source/WebCore/ChangeLog
r199317 r199320 1 2016-04-11 Brian Burg <bburg@apple.com> 2 3 Web Inspector: get rid of InspectorBasicValue and InspectorString subclasses 4 https://bugs.webkit.org/show_bug.cgi?id=156407 5 <rdar://problem/25627659> 6 7 Reviewed by Joseph Pecoraro. 8 9 * inspector/InspectorDatabaseAgent.cpp: Don't use deleted subclasses. 10 1 11 2016-04-11 Commit Queue <commit-queue@webkit.org> 2 12 -
trunk/Source/WebCore/inspector/InspectorDatabaseAgent.cpp
r199276 r199320 88 88 RefPtr<InspectorValue> inspectorValue; 89 89 switch (value.type()) { 90 case SQLValue::StringValue: inspectorValue = Inspector String::create(value.string()); break;91 case SQLValue::NumberValue: inspectorValue = Inspector BasicValue::create(value.number()); break;90 case SQLValue::StringValue: inspectorValue = InspectorValue::create(value.string()); break; 91 case SQLValue::NumberValue: inspectorValue = InspectorValue::create(value.number()); break; 92 92 case SQLValue::NullValue: inspectorValue = InspectorValue::null(); break; 93 93 }
Note: See TracChangeset
for help on using the changeset viewer.