+2015-03-10 Alex Christensen <achristensen@webkit.org>
+
+ Use unsigned for HashSet size.
+ https://bugs.webkit.org/show_bug.cgi?id=142518
+
+ Reviewed by Benjamin Poulain.
+
+ * dfg/DFGAvailabilityMap.cpp:
+ (JSC::DFG::AvailabilityMap::prune):
+ * ftl/FTLOSRExitCompiler.cpp:
+ (JSC::FTL::compileStub):
+ * heap/MarkedBlockSet.h:
+ (JSC::MarkedBlockSet::remove):
+ * runtime/WeakMapData.h:
+
2015-03-10 Mark Lam <mark.lam@apple.com>
Use std::numeric_limits<unsigned>::max() instead of (unsigned)-1.
possibleNodes.add(m_locals[i].node());
}
- int oldPossibleNodesSize;
+ unsigned oldPossibleNodesSize;
do {
oldPossibleNodesSize = possibleNodes.size();
for (auto pair : m_heap) {
toMaterialize.add(materialization);
while (!toMaterialize.isEmpty()) {
- int previousToMaterializeSize = toMaterialize.size();
+ unsigned previousToMaterializeSize = toMaterialize.size();
Vector<ExitTimeObjectMaterialization*> worklist;
worklist.appendRange(toMaterialize.begin(), toMaterialize.end());
inline void MarkedBlockSet::remove(MarkedBlock* block)
{
- int oldCapacity = m_set.capacity();
+ unsigned oldCapacity = m_set.capacity();
m_set.remove(block);
if (m_set.capacity() != oldCapacity) // Indicates we've removed a lot of blocks.
recomputeFilter();
private:
virtual void visitWeakReferences(SlotVisitor&) override;
virtual void finalizeUnconditionally() override;
- int m_liveKeyCount;
+ unsigned m_liveKeyCount;
WeakMapData* m_target;
};
DeadKeyCleaner m_deadKeyCleaner;
+2015-03-10 Alex Christensen <achristensen@webkit.org>
+
+ Use unsigned for HashSet size.
+ https://bugs.webkit.org/show_bug.cgi?id=142518
+
+ Reviewed by Benjamin Poulain.
+
+ * wtf/HashCountedSet.h:
+ (WTF::Traits>::size):
+ (WTF::Traits>::capacity):
+ * wtf/HashMap.h:
+ (WTF::X>::size):
+ (WTF::X>::capacity):
+ * wtf/HashSet.h:
+ (WTF::V>::size):
+ (WTF::V>::capacity):
+ * wtf/HashTable.h:
+ (WTF::HashTable::Stats::recordCollisionAtCount):
+ (WTF::HashTable::Stats::dumpStats):
+ (WTF::HashTable::size):
+ (WTF::HashTable::capacity):
+ (WTF::KeyTraits>::deallocateTable):
+ (WTF::KeyTraits>::checkTableConsistencyExceptSize):
+ * wtf/HashTraits.h:
+ * wtf/ListHashSet.h:
+ (WTF::U>::size):
+ (WTF::U>::capacity):
+
2015-03-10 Said Abou-Hallawa <sabouhallawa@apple.com>
Remove PassRefPtr from svg/properties classes.
void swap(HashCountedSet&);
- int size() const;
- int capacity() const;
+ unsigned size() const;
+ unsigned capacity() const;
bool isEmpty() const;
// Iterators iterate over pairs of values and counts.
}
template<typename Value, typename HashFunctions, typename Traits>
- inline int HashCountedSet<Value, HashFunctions, Traits>::size() const
+ inline unsigned HashCountedSet<Value, HashFunctions, Traits>::size() const
{
return m_impl.size();
}
template<typename Value, typename HashFunctions, typename Traits>
- inline int HashCountedSet<Value, HashFunctions, Traits>::capacity() const
+ inline unsigned HashCountedSet<Value, HashFunctions, Traits>::capacity() const
{
return m_impl.capacity();
}
void swap(HashMap&);
- int size() const;
- int capacity() const;
+ unsigned size() const;
+ unsigned capacity() const;
bool isEmpty() const;
// iterators iterate over pairs of keys and values
}
template<typename T, typename U, typename V, typename W, typename X>
-inline int HashMap<T, U, V, W, X>::size() const
+inline unsigned HashMap<T, U, V, W, X>::size() const
{
return m_impl.size();
}
template<typename T, typename U, typename V, typename W, typename X>
-inline int HashMap<T, U, V, W, X>::capacity() const
+inline unsigned HashMap<T, U, V, W, X>::capacity() const
{
return m_impl.capacity();
}
void swap(HashSet&);
- int size() const;
- int capacity() const;
+ unsigned size() const;
+ unsigned capacity() const;
bool isEmpty() const;
iterator begin() const;
}
template<typename T, typename U, typename V>
- inline int HashSet<T, U, V>::size() const
+ inline unsigned HashSet<T, U, V>::size() const
{
return m_impl.size();
}
template<typename T, typename U, typename V>
- inline int HashSet<T, U, V>::capacity() const
+ inline unsigned HashSet<T, U, V>::capacity() const
{
return m_impl.capacity();
}
{
}
- int numAccesses;
- int numRehashes;
- int numRemoves;
- int numReinserts;
+ unsigned numAccesses;
+ unsigned numRehashes;
+ unsigned numRemoves;
+ unsigned numReinserts;
- int maxCollisions;
- int numCollisions;
- int collisionGraph[4096];
+ unsigned maxCollisions;
+ unsigned numCollisions;
+ unsigned collisionGraph[4096];
- void recordCollisionAtCount(int count)
+ void recordCollisionAtCount(unsigned count)
{
if (count > maxCollisions)
maxCollisions = count;
dataLogF("%d accesses\n", numAccesses);
dataLogF("%d total collisions, average %.2f probes per access\n", numCollisions, 1.0 * (numAccesses + numCollisions) / numAccesses);
dataLogF("longest collision chain: %d\n", maxCollisions);
- for (int i = 1; i <= maxCollisions; i++) {
+ for (unsigned i = 1; i <= maxCollisions; i++) {
dataLogF(" %d lookups with exactly %d collisions (%.2f%% , %.2f%% with this many or more)\n", collisionGraph[i], i, 100.0 * (collisionGraph[i] - collisionGraph[i+1]) / numAccesses, 100.0 * collisionGraph[i] / numAccesses);
}
dataLogF("%d rehashes\n", numRehashes);
const_iterator begin() const { return isEmpty() ? end() : makeConstIterator(m_table); }
const_iterator end() const { return makeKnownGoodConstIterator(m_table + m_tableSize); }
- int size() const { return m_keyCount; }
- int capacity() const { return m_tableSize; }
+ unsigned size() const { return m_keyCount; }
+ unsigned capacity() const { return m_tableSize; }
bool isEmpty() const { return !m_keyCount; }
AddResult add(const ValueType& value) { return add<IdentityTranslatorType>(Extractor::extract(value), value); }
#endif
private:
- static ValueType* allocateTable(int size);
- static void deallocateTable(ValueType* table, int size);
+ static ValueType* allocateTable(unsigned size);
+ static void deallocateTable(ValueType* table, unsigned size);
typedef std::pair<ValueType*, bool> LookupType;
typedef std::pair<LookupType, unsigned> FullLookupType;
ValueType* expand(ValueType* entry = nullptr);
void shrink() { rehash(m_tableSize / 2, nullptr); }
- ValueType* rehash(int newTableSize, ValueType* entry);
+ ValueType* rehash(unsigned newTableSize, ValueType* entry);
ValueType* reinsert(ValueType&&);
static void initializeBucket(ValueType& bucket);
static void invalidateIterators() { }
#endif
- static const int m_maxLoad = 2;
- static const int m_minLoad = 6;
+ static const unsigned m_maxLoad = 2;
+ static const unsigned m_minLoad = 6;
ValueType* m_table;
- int m_tableSize;
- int m_tableSizeMask;
- int m_keyCount;
- int m_deletedCount;
+ unsigned m_tableSize;
+ unsigned m_tableSizeMask;
+ unsigned m_keyCount;
+ unsigned m_deletedCount;
#if CHECK_HASHTABLE_ITERATORS
public:
struct HashTableCapacityForSize {
static const unsigned value = HashTableCapacityForSizeSplitter<size, !(size & (size - 1))>::value;
COMPILE_ASSERT(size > 0, HashTableNonZeroMinimumCapacity);
- COMPILE_ASSERT(!static_cast<int>(value >> 31), HashTableNoCapacityOverflow);
+ COMPILE_ASSERT(!static_cast<unsigned>(value >> 31), HashTableNoCapacityOverflow);
COMPILE_ASSERT(value > (2 * size), HashTableCapacityHoldsContentSize);
};
{
checkKey<HashTranslator>(key);
- int k = 0;
- int sizeMask = m_tableSizeMask;
+ unsigned k = 0;
+ unsigned sizeMask = m_tableSizeMask;
ValueType* table = m_table;
unsigned h = HashTranslator::hash(key);
- int i = h & sizeMask;
+ unsigned i = h & sizeMask;
if (!table)
return 0;
ASSERT(m_table);
checkKey<HashTranslator>(key);
- int k = 0;
+ unsigned k = 0;
ValueType* table = m_table;
- int sizeMask = m_tableSizeMask;
+ unsigned sizeMask = m_tableSizeMask;
unsigned h = HashTranslator::hash(key);
- int i = h & sizeMask;
+ unsigned i = h & sizeMask;
#if DUMP_HASHTABLE_STATS
++HashTableStats::numAccesses;
- int probeCount = 0;
+ unsigned probeCount = 0;
#endif
#if DUMP_HASHTABLE_STATS_PER_TABLE
ASSERT(m_table);
checkKey<HashTranslator>(key);
- int k = 0;
+ unsigned k = 0;
ValueType* table = m_table;
- int sizeMask = m_tableSizeMask;
+ unsigned sizeMask = m_tableSizeMask;
unsigned h = HashTranslator::hash(key);
- int i = h & sizeMask;
+ unsigned i = h & sizeMask;
#if DUMP_HASHTABLE_STATS
++HashTableStats::numAccesses;
ASSERT(m_table);
- int k = 0;
+ unsigned k = 0;
ValueType* table = m_table;
- int sizeMask = m_tableSizeMask;
+ unsigned sizeMask = m_tableSizeMask;
unsigned h = HashTranslator::hash(key);
- int i = h & sizeMask;
+ unsigned i = h & sizeMask;
#if DUMP_HASHTABLE_STATS
++HashTableStats::numAccesses;
}
template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
- auto HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::allocateTable(int size) -> ValueType*
+ auto HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::allocateTable(unsigned size) -> ValueType*
{
// would use a template member function with explicit specializations here, but
// gcc doesn't appear to support that
if (Traits::emptyValueIsZero)
return static_cast<ValueType*>(fastZeroedMalloc(size * sizeof(ValueType)));
ValueType* result = static_cast<ValueType*>(fastMalloc(size * sizeof(ValueType)));
- for (int i = 0; i < size; i++)
+ for (unsigned i = 0; i < size; i++)
initializeBucket(result[i]);
return result;
}
template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
- void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::deallocateTable(ValueType* table, int size)
+ void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::deallocateTable(ValueType* table, unsigned size)
{
- for (int i = 0; i < size; ++i) {
+ for (unsigned i = 0; i < size; ++i) {
if (!isDeletedBucket(table[i]))
table[i].~ValueType();
}
template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
auto HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::expand(ValueType* entry) -> ValueType*
{
- int newSize;
+ unsigned newSize;
if (m_tableSize == 0)
newSize = KeyTraits::minimumTableSize;
else if (mustRehashInPlace())
}
template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
- auto HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::rehash(int newTableSize, ValueType* entry) -> ValueType*
+ auto HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::rehash(unsigned newTableSize, ValueType* entry) -> ValueType*
{
internalCheckTableConsistencyExceptSize();
- int oldTableSize = m_tableSize;
+ unsigned oldTableSize = m_tableSize;
ValueType* oldTable = m_table;
#if DUMP_HASHTABLE_STATS
m_table = allocateTable(newTableSize);
Value* newEntry = nullptr;
- for (int i = 0; i != oldTableSize; ++i) {
+ for (unsigned i = 0; i != oldTableSize; ++i) {
if (isEmptyOrDeletedBucket(oldTable[i])) {
ASSERT(&oldTable[i] != entry);
continue;
if (!m_table)
return;
- int count = 0;
- int deletedCount = 0;
- for (int j = 0; j < m_tableSize; ++j) {
+ unsigned count = 0;
+ unsigned deletedCount = 0;
+ for (unsigned j = 0; j < m_tableSize; ++j) {
ValueType* entry = m_table + j;
if (isEmptyBucket(*entry))
continue;
// The starting table size. Can be overridden when we know beforehand that
// a hash table will have at least N entries.
- static const int minimumTableSize = 8;
+ static const unsigned minimumTableSize = 8;
};
// Default integer traits disallow both 0 and -1 as keys (max value instead of -1 for unsigned).
static const bool emptyValueIsZero = FirstTraits::emptyValueIsZero && SecondTraits::emptyValueIsZero;
static EmptyValueType emptyValue() { return std::make_pair(FirstTraits::emptyValue(), SecondTraits::emptyValue()); }
- static const int minimumTableSize = FirstTraits::minimumTableSize;
+ static const unsigned minimumTableSize = FirstTraits::minimumTableSize;
static void constructDeletedValue(TraitType& slot) { FirstTraits::constructDeletedValue(slot.first); }
static bool isDeletedValue(const TraitType& value) { return FirstTraits::isDeletedValue(value.first); }
static const bool emptyValueIsZero = KeyTraits::emptyValueIsZero && ValueTraits::emptyValueIsZero;
static EmptyValueType emptyValue() { return KeyValuePair<typename KeyTraits::EmptyValueType, typename ValueTraits::EmptyValueType>(KeyTraits::emptyValue(), ValueTraits::emptyValue()); }
- static const int minimumTableSize = KeyTraits::minimumTableSize;
+ static const unsigned minimumTableSize = KeyTraits::minimumTableSize;
static void constructDeletedValue(TraitType& slot) { KeyTraits::constructDeletedValue(slot.key); }
static bool isDeletedValue(const TraitType& value) { return KeyTraits::isDeletedValue(value.key); }
void swap(ListHashSet&);
- int size() const;
- int capacity() const;
+ unsigned size() const;
+ unsigned capacity() const;
bool isEmpty() const;
iterator begin() { return makeIterator(m_head); }
}
template<typename T, typename U>
-inline int ListHashSet<T, U>::size() const
+inline unsigned ListHashSet<T, U>::size() const
{
return m_impl.size();
}
template<typename T, typename U>
-inline int ListHashSet<T, U>::capacity() const
+inline unsigned ListHashSet<T, U>::capacity() const
{
return m_impl.capacity();
}
+2015-03-10 Alex Christensen <achristensen@webkit.org>
+
+ Use unsigned for HashSet size.
+ https://bugs.webkit.org/show_bug.cgi?id=142518
+
+ Reviewed by Benjamin Poulain.
+
+ * Modules/websockets/WebSocketDeflateFramer.cpp:
+ (WebCore::WebSocketExtensionDeflateFrame::processResponse):
+ * bindings/js/SerializedScriptValue.cpp:
+ (WebCore::CloneSerializer::checkForDuplicate):
+ (WebCore::CloneSerializer::writeConstantPoolIndex):
+ * dom/ScriptRunner.cpp:
+ (WebCore::ScriptRunner::~ScriptRunner):
+ * loader/ResourceLoadScheduler.h:
+ * platform/graphics/Font.cpp:
+ (WebCore::Font::systemFallbackFontForCharacter):
+ * platform/graphics/FontCache.cpp:
+ (WebCore::FontCache::purgeInactiveFontDataIfNeeded):
+ (WebCore::FontCache::purgeInactiveFontData):
+ * platform/graphics/FontCache.h:
+ * platform/graphics/freetype/FontCacheFreeType.cpp:
+ (WebCore::FontCache::systemFallbackForCharacters):
+ * platform/graphics/ios/FontCacheIOS.mm:
+ (WebCore::FontCache::getSystemFontFallbackForCharacters):
+ (WebCore::FontCache::systemFallbackForCharacters):
+ (WebCore::FontCache::similarFont):
+ * platform/graphics/mac/FontCacheMac.mm:
+ (WebCore::shouldAutoActivateFontIfNeeded):
+ (WebCore::FontCache::systemFallbackForCharacters):
+ (WebCore::FontCache::similarFont):
+ * platform/graphics/win/FontCacheWin.cpp:
+ (WebCore::FontCache::systemFallbackForCharacters):
+ * rendering/RenderDeprecatedFlexibleBox.cpp:
+ (WebCore::FlexBoxIterator::next):
+ * rendering/RenderTableSection.cpp:
+ (WebCore::RenderTableSection::computeOverflowFromCells):
+
2015-03-10 Eric Carlson <eric.carlson@apple.com>
[Mac] Refactor media controls code
}
m_responseProcessed = true;
- int expectedNumParameters = 0;
+ unsigned expectedNumParameters = 0;
int windowBits = 15;
HashMap<String, String>::const_iterator parameter = serverParameters.find("max_window_bits");
if (parameter != serverParameters.end()) {
// Handle duplicate references
if (found != m_objectPool.end()) {
write(ObjectReferenceTag);
- ASSERT(static_cast<int32_t>(found->value) < m_objectPool.size());
+ ASSERT(found->value < m_objectPool.size());
writeObjectIndex(found->value);
return true;
}
template <class T> void writeConstantPoolIndex(const T& constantPool, unsigned i)
{
- ASSERT(static_cast<int32_t>(i) < constantPool.size());
+ ASSERT(i < constantPool.size());
if (constantPool.size() <= 0xFF)
write(static_cast<uint8_t>(i));
else if (constantPool.size() <= 0xFFFF)
m_document.decrementLoadEventDelayCount();
for (size_t i = 0; i < m_scriptsToExecuteInOrder.size(); ++i)
m_document.decrementLoadEventDelayCount();
- for (int i = 0; i < m_pendingAsyncScripts.size(); ++i)
+ for (unsigned i = 0; i < m_pendingAsyncScripts.size(); ++i)
m_document.decrementLoadEventDelayCount();
}
typedef HashSet<RefPtr<ResourceLoader>> RequestMap;
RequestMap m_requestsLoading;
const String m_name;
- const int m_maxRequestsInFlight;
+ const unsigned m_maxRequestsInFlight;
};
enum CreateHostPolicy {
if (!fallbackFont) {
UChar codeUnits[2];
- int codeUnitsLength;
+ unsigned codeUnitsLength;
if (U_IS_BMP(character)) {
codeUnits[0] = FontCascade::normalizeSpaces(character);
codeUnitsLength = 1;
#if PLATFORM(IOS)
-const int cMaxInactiveFontData = 120;
-const int cTargetInactiveFontData = 100;
+const unsigned cMaxInactiveFontData = 120;
+const unsigned cTargetInactiveFontData = 100;
#else
-const int cMaxInactiveFontData = 225;
-const int cTargetInactiveFontData = 200;
+const unsigned cMaxInactiveFontData = 225;
+const unsigned cTargetInactiveFontData = 200;
#endif
-const int cMaxUnderMemoryPressureInactiveFontData = 50;
-const int cTargetUnderMemoryPressureInactiveFontData = 30;
+const unsigned cMaxUnderMemoryPressureInactiveFontData = 50;
+const unsigned cTargetUnderMemoryPressureInactiveFontData = 30;
RefPtr<Font> FontCache::fontForFamily(const FontDescription& fontDescription, const AtomicString& family, bool checkingAlternateName)
{
void FontCache::purgeInactiveFontDataIfNeeded()
{
bool underMemoryPressure = MemoryPressureHandler::singleton().isUnderMemoryPressure();
- int inactiveFontDataLimit = underMemoryPressure ? cMaxUnderMemoryPressureInactiveFontData : cMaxInactiveFontData;
+ unsigned inactiveFontDataLimit = underMemoryPressure ? cMaxUnderMemoryPressureInactiveFontData : cMaxInactiveFontData;
if (cachedFonts().size() < inactiveFontDataLimit)
return;
- int inactiveCount = inactiveFontCount();
+ unsigned inactiveCount = inactiveFontCount();
if (inactiveCount <= inactiveFontDataLimit)
return;
- int targetFontDataLimit = underMemoryPressure ? cTargetUnderMemoryPressureInactiveFontData : cTargetInactiveFontData;
+ unsigned targetFontDataLimit = underMemoryPressure ? cTargetUnderMemoryPressureInactiveFontData : cTargetInactiveFontData;
purgeInactiveFontData(inactiveCount - targetFontDataLimit);
}
-void FontCache::purgeInactiveFontData(int purgeCount)
+void FontCache::purgeInactiveFontData(unsigned purgeCount)
{
pruneUnreferencedEntriesFromFontCascadeCache();
pruneSystemFallbackFonts();
WEBCORE_EXPORT static FontCache& singleton();
// This method is implemented by the platform.
- RefPtr<Font> systemFallbackForCharacters(const FontDescription&, const Font* originalFontData, bool isPlatformFont, const UChar* characters, int length);
+ RefPtr<Font> systemFallbackForCharacters(const FontDescription&, const Font* originalFontData, bool isPlatformFont, const UChar* characters, unsigned length);
// Also implemented by the platform.
void platformInit();
WEBCORE_EXPORT size_t fontCount();
WEBCORE_EXPORT size_t inactiveFontCount();
- WEBCORE_EXPORT void purgeInactiveFontData(int count = INT_MAX);
+ WEBCORE_EXPORT void purgeInactiveFontData(unsigned count = UINT_MAX);
#if PLATFORM(WIN)
RefPtr<Font> fontFromDescriptionAndLogFont(const FontDescription&, const LOGFONT&, AtomicString& outFontFamilyName);
// These methods are implemented by each platform.
#if PLATFORM(IOS)
FontPlatformData* getCustomFallbackFont(const UInt32, const FontDescription&);
- PassRefPtr<Font> getSystemFontFallbackForCharacters(const FontDescription&, const Font*, const UChar* characters, int length);
+ PassRefPtr<Font> getSystemFontFallbackForCharacters(const FontDescription&, const Font*, const UChar* characters, unsigned length);
#endif
std::unique_ptr<FontPlatformData> createFontPlatformData(const FontDescription&, const AtomicString& family);
return FcFontSetMatch(0, sets, 1, pattern, &fontConfigResult);
}
-RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font* originalFontData, bool, const UChar* characters, int length)
+RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font* originalFontData, bool, const UChar* characters, unsigned length)
{
RefPtr<FcPattern> pattern = adoptRef(createFontConfigPatternForCharacters(characters, length));
const FontPlatformData& fontData = originalFontData->platformData();
return characterSet;
}
-PassRefPtr<Font> FontCache::getSystemFontFallbackForCharacters(const FontDescription& description, const Font* originalFontData, const UChar* characters, int length)
+PassRefPtr<Font> FontCache::getSystemFontFallbackForCharacters(const FontDescription& description, const Font* originalFontData, const UChar* characters, unsigned length)
{
const FontPlatformData& platformData = originalFontData->platformData();
CTFontRef ctFont = platformData.font();
return LanguageSpecificFont::None;
}
-RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font* originalFontData, bool, const UChar* characters, int length)
+RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font* originalFontData, bool, const UChar* characters, unsigned length)
{
// Unlike OS X, our fallback font on iPhone is Arial Unicode, which doesn't have some apple-specific glyphs like F8FF.
// Fall back to the Apple Fallback font in this case.
- if (length > 0 && requiresCustomFallbackFont(*characters)) {
+ if (length && requiresCustomFallbackFont(*characters)) {
auto* fallback = getCustomFallbackFont(*characters, description);
if (!fallback)
return nullptr;
}
LanguageSpecificFont languageSpecificFont = LanguageSpecificFont::None;
- if (length > 0)
+ if (length)
languageSpecificFont = languageSpecificFallbackFont(c);
RefPtr<Font> font;
static String* matchWords[3] = { &arabic.get(), &pashto.get(), &urdu.get() };
static NeverDestroyed<AtomicString> geezaPlain("GeezaPro", AtomicString::ConstructFromLiteral);
static NeverDestroyed<AtomicString> geezaBold("GeezaPro-Bold", AtomicString::ConstructFromLiteral);
- for (int j = 0; j < 3 && !font; ++j) {
+ for (unsigned j = 0; j < 3 && !font; ++j) {
if (family.contains(*matchWords[j], false))
font = fontForFamily(description, isFontWeightBold(description.weight()) ? geezaBold : geezaPlain);
}
#endif
static NeverDestroyed<HashSet<AtomicString>> knownFamilies;
- static const int maxCacheSize = 128;
+ static const unsigned maxCacheSize = 128;
ASSERT(knownFamilies.get().size() <= maxCacheSize);
if (knownFamilies.get().size() == maxCacheSize)
knownFamilies.get().remove(knownFamilies.get().begin());
return knownFamilies.get().add(family).isNewEntry;
}
-RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font* originalFontData, bool isPlatformFont, const UChar* characters, int length)
+RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font* originalFontData, bool isPlatformFont, const UChar* characters, unsigned length)
{
UChar32 character;
U16_GET(characters, 0, 0, length, character);
continue;
static String* matchWords[3] = { new String("Arabic"), new String("Pashto"), new String("Urdu") };
DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, geezaStr, ("Geeza Pro", AtomicString::ConstructFromLiteral));
- for (int j = 0; j < 3 && !font; ++j) {
+ for (unsigned j = 0; j < 3 && !font; ++j) {
if (family.contains(*matchWords[j], false))
font = fontForFamily(description, geezaStr);
}
return hfont;
}
-RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font* originalFontData, bool, const UChar* characters, int length)
+RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font* originalFontData, bool, const UChar* characters, unsigned length)
{
UChar character = characters[0];
RefPtr<Font> fontData;
if (!m_ordinalIteration)
m_currentOrdinal = m_forward ? 1 : m_largestOrdinal;
else {
- if (m_ordinalIteration >= m_ordinalValues.size() + 1)
+ if (m_ordinalIteration > m_ordinalValues.size())
return 0;
// Only copy+sort the values once per layout even if the iterator is reset.
RenderDeprecatedFlexibleBox* m_box;
RenderBox* m_currentChild;
bool m_forward;
- unsigned int m_currentOrdinal;
- unsigned int m_largestOrdinal;
- HashSet<unsigned int> m_ordinalValues;
- Vector<unsigned int> m_sortedOrdinalValues;
- int m_ordinalIteration;
+ unsigned m_currentOrdinal;
+ unsigned m_largestOrdinal;
+ HashSet<unsigned> m_ordinalValues;
+ Vector<unsigned> m_sortedOrdinalValues;
+ unsigned m_ordinalIteration;
};
RenderDeprecatedFlexibleBox::RenderDeprecatedFlexibleBox(Element& element, Ref<RenderStyle>&& style)
clearOverflow();
m_overflowingCells.clear();
unsigned totalCellsCount = nEffCols * totalRows;
- int maxAllowedOverflowingCellsCount = totalCellsCount < gMinTableSizeToUseFastPaintPathWithOverflowingCell ? 0 : gMaxAllowedOverflowingCellRatioForFastPaintPath * totalCellsCount;
+ unsigned maxAllowedOverflowingCellsCount = totalCellsCount < gMinTableSizeToUseFastPaintPathWithOverflowingCell ? 0 : gMaxAllowedOverflowingCellRatioForFastPaintPath * totalCellsCount;
#ifndef NDEBUG
bool hasOverflowingCell = false;
+2015-03-10 Alex Christensen <achristensen@webkit.org>
+
+ Use unsigned for HashSet size.
+ https://bugs.webkit.org/show_bug.cgi?id=142518
+
+ Reviewed by Benjamin Poulain.
+
+ * TestWebKitAPI/Tests/WTF/HashMap.cpp:
+ (TestWebKitAPI::TEST):
+ * TestWebKitAPI/Tests/WTF/HashSet.cpp:
+ (TestWebKitAPI::testInitialCapacity):
+ * TestWebKitAPI/Tests/WTF/ListHashSet.cpp:
+ (TestWebKitAPI::TEST):
+
2015-03-10 Daniel Bates <dabates@apple.com>
[iOS] Add WebKitSystemInterface for iOS 8.2
{ 4, "four" },
};
- EXPECT_EQ(4, map.size());
+ EXPECT_EQ(4u, map.size());
EXPECT_EQ("one", map.get(1));
EXPECT_EQ("two", map.get(2));
HashSet<int, DefaultHash<int>::Hash, InitialCapacityTestHashTraits<initialCapacity> > testSet;
// Initial capacity is null.
- ASSERT_EQ(0, testSet.capacity());
+ ASSERT_EQ(0u, testSet.capacity());
// Adding items up to size should never change the capacity.
for (size_t i = 0; i < size; ++i) {
result = list.appendOrMoveToLast(3);
ASSERT_TRUE(result.isNewEntry);
- ASSERT_EQ(list.size(), 3);
+ ASSERT_EQ(list.size(), 3u);
// The list should be in order 1, 2, 3.
ListHashSet<int>::iterator iterator = list.begin();
ASSERT_TRUE(result.isNewEntry);
result = list.appendOrMoveToLast(1);
ASSERT_FALSE(result.isNewEntry);
- ASSERT_EQ(1, list.size());
+ ASSERT_EQ(1u, list.size());
list.add(2);
list.add(3);
- ASSERT_EQ(3, list.size());
+ ASSERT_EQ(3u, list.size());
// Appending 2 move it to the end.
ASSERT_EQ(3, list.last());
ASSERT_FALSE(result.isNewEntry);
result = list.appendOrMoveToLast(1);
ASSERT_FALSE(result.isNewEntry);
- ASSERT_EQ(3, list.size());
+ ASSERT_EQ(3u, list.size());
ListHashSet<int>::iterator iterator = list.begin();
ASSERT_EQ(3, *iterator);
result = list.prependOrMoveToFirst(3);
ASSERT_TRUE(result.isNewEntry);
- ASSERT_EQ(list.size(), 3);
+ ASSERT_EQ(list.size(), 3u);
// The list should be in order 3, 1, 2.
ListHashSet<int>::iterator iterator = list.begin();
ASSERT_TRUE(result.isNewEntry);
result = list.prependOrMoveToFirst(1);
ASSERT_FALSE(result.isNewEntry);
- ASSERT_EQ(1, list.size());
+ ASSERT_EQ(1u, list.size());
list.add(2);
list.add(3);
- ASSERT_EQ(3, list.size());
+ ASSERT_EQ(3u, list.size());
// Prepending 2 move it to the beginning.
ASSERT_EQ(1, list.first());
ASSERT_FALSE(result.isNewEntry);
result = list.prependOrMoveToFirst(3);
ASSERT_FALSE(result.isNewEntry);
- ASSERT_EQ(3, list.size());
+ ASSERT_EQ(3u, list.size());
ListHashSet<int>::iterator iterator = list.begin();
ASSERT_EQ(3, *iterator);