Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(769)

Side by Side Diff: Source/WebCore/inspector/InspectorValues.cpp

Issue 7145019: Merge 88444 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/782/
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 void InspectorBasicValue::writeJSON(Vector<UChar>* output) const 613 void InspectorBasicValue::writeJSON(Vector<UChar>* output) const
614 { 614 {
615 ASSERT(type() == TypeBoolean || type() == TypeNumber); 615 ASSERT(type() == TypeBoolean || type() == TypeNumber);
616 if (type() == TypeBoolean) { 616 if (type() == TypeBoolean) {
617 if (m_boolValue) 617 if (m_boolValue)
618 output->append(trueString, 4); 618 output->append(trueString, 4);
619 else 619 else
620 output->append(falseString, 5); 620 output->append(falseString, 5);
621 } else if (type() == TypeNumber) { 621 } else if (type() == TypeNumber) {
622 NumberToStringBuffer buffer; 622 NumberToStringBuffer buffer;
623 unsigned length = DecimalNumber(m_doubleValue).toStringDecimal(buffer, W TF::NumberToStringBufferLength); 623 DecimalNumber decimal = m_doubleValue;
624 unsigned length = 0;
625 if (decimal.bufferLengthForStringDecimal() > WTF::NumberToStringBufferLe ngth) {
626 // Not enough room for decimal. Use exponential format.
627 if (decimal.bufferLengthForStringExponential() > WTF::NumberToString BufferLength) {
628 // Fallback for an abnormal case if it's too little even for exp onential.
629 output->append("NaN", 3);
630 return;
631 }
632 length = decimal.toStringExponential(buffer, WTF::NumberToStringBuff erLength);
633 } else
634 length = decimal.toStringDecimal(buffer, WTF::NumberToStringBufferLe ngth);
624 output->append(buffer, length); 635 output->append(buffer, length);
625 } 636 }
626 } 637 }
627 638
628 bool InspectorString::asString(String* output) const 639 bool InspectorString::asString(String* output) const
629 { 640 {
630 *output = m_stringValue; 641 *output = m_stringValue;
631 return true; 642 return true;
632 } 643 }
633 644
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 770
760 PassRefPtr<InspectorValue> InspectorArray::get(size_t index) 771 PassRefPtr<InspectorValue> InspectorArray::get(size_t index)
761 { 772 {
762 ASSERT(index < m_data.size()); 773 ASSERT(index < m_data.size());
763 return m_data[index]; 774 return m_data[index];
764 } 775 }
765 776
766 } // namespace WebCore 777 } // namespace WebCore
767 778
768 #endif // ENABLE(INSPECTOR) 779 #endif // ENABLE(INSPECTOR)
OLDNEW
« no previous file with comments | « Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698