• caio.oliveira@openbossa.org's avatar
    HashMap<>::add should return a more descriptive object · 4c11ee05
    caio.oliveira@openbossa.org authored
    https://bugs.webkit.org/show_bug.cgi?id=71063
    
    Reviewed by Ryosuke Niwa.
    
    Source/JavaScriptCore:
    
    Update code to use AddResult instead of a pair. Note that since WeakGCMap wraps
    the iterator type, there's a need for its own AddResult type -- instantiated from
    HashTableAddResult template class.
    
    * API/JSCallbackObject.h:
    (JSC::JSCallbackObjectData::JSPrivatePropertyMap::setPrivateProperty):
    * API/JSClassRef.cpp:
    (OpaqueJSClass::contextData):
    * bytecompiler/BytecodeGenerator.cpp:
    (JSC::BytecodeGenerator::addVar):
    (JSC::BytecodeGenerator::addGlobalVar):
    (JSC::BytecodeGenerator::addConstant):
    (JSC::BytecodeGenerator::addConstantValue):
    (JSC::BytecodeGenerator::emitLoad):
    (JSC::BytecodeGenerator::addStringConstant):
    (JSC::BytecodeGenerator::emitLazyNewFunction):
    * bytecompiler/NodesCodegen.cpp:
    (JSC::PropertyListNode::emitBytecode):
    * debugger/Debugger.cpp:
    * dfg/DFGAssemblyHelpers.cpp:
    (JSC::DFG::AssemblyHelpers::decodedCodeMapFor):
    * dfg/DFGByteCodeParser.cpp:
    (JSC::DFG::ByteCodeParser::cellConstant):
    (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
    * jit/JITStubs.cpp:
    (JSC::JITThunks::ctiStub):
    (JSC::JITThunks::hostFunctionStub):
    * parser/Parser.cpp:
    (JSC::::parseStrictObjectLiteral):
    * parser/Parser.h:
    (JSC::Scope::declareParameter):
    * runtime/Identifier.cpp:
    (JSC::Identifier::add):
    (JSC::Identifier::add8):
    (JSC::Identifier::addSlowCase):
    * runtime/Identifier.h:
    (JSC::Identifier::add):
    (JSC::IdentifierTable::add):
    * runtime/JSArray.cpp:
    (JSC::SparseArrayValueMap::add):
    (JSC::SparseArrayValueMap::put):
    (JSC::SparseArrayValueMap::putDirect):
    (JSC::JSArray::enterDictionaryMode):
    (JSC::JSArray::defineOwnNumericProperty):
    * runtime/JSArray.h:
    (SparseArrayValueMap):
    * runtime/PropertyNameArray.cpp:
    (JSC::PropertyNameArray::add):
    * runtime/StringRecursionChecker.h:
    (JSC::StringRecursionChecker::performCheck):
    * runtime/Structure.cpp:
    (JSC::StructureTransitionTable::add):
    * runtime/WeakGCMap.h:
    (WeakGCMap):
    (JSC::WeakGCMap::add):
    (JSC::WeakGCMap::set):
    * tools/ProfileTreeNode.h:
    (JSC::ProfileTreeNode::sampleChild):
    
    Source/WebCore:
    
    Update code to use AddResult instead of a pair. No new tests, just a refactoring.
    
    * Modules/webdatabase/SQLTransactionCoordinator.cpp:
    (WebCore::SQLTransactionCoordinator::acquireLock):
    * Modules/webdatabase/chromium/QuotaTracker.cpp:
    (WebCore::QuotaTracker::updateDatabaseSize):
    * bindings/js/DOMObjectHashTableMap.h:
    (WebCore::DOMObjectHashTableMap::get):
    * bindings/js/JSDOMBinding.cpp:
    (WebCore::cacheDOMStructure):
    * bindings/js/JSDOMBinding.h:
    (WebCore::cacheWrapper):
    * bindings/js/JSDOMGlobalObject.h:
    (WebCore::getDOMConstructor):
    * bindings/js/PageScriptDebugServer.cpp:
    (WebCore::PageScriptDebugServer::addListener):
    * bindings/js/ScriptDebugServer.cpp:
    (WebCore::ScriptDebugServer::setBreakpoint):
    * bindings/js/SerializedScriptValue.cpp:
    (WebCore::CloneSerializer::startObjectInternal):
    (WebCore::CloneSerializer::write):
    * bindings/v8/NPV8Object.cpp:
    (WebCore::npCreateV8ScriptObject):
    * bridge/IdentifierRep.cpp:
    (WebCore::IdentifierRep::get):
    * bridge/NP_jsobject.cpp:
    (ObjectMap::add):
    * css/CSSComputedStyleDeclaration.cpp:
    (WebCore::logUnimplementedPropertyID):
    * css/CSSFontFaceSource.cpp:
    (WebCore::CSSFontFaceSource::getFontData):
    * css/CSSFontSelector.cpp:
    (WebCore::CSSFontSelector::addFontFaceRule):
    (WebCore::CSSFontSelector::getFontData):
    * css/CSSSegmentedFontFace.cpp:
    (WebCore::CSSSegmentedFontFace::getFontData):
    * css/CSSStyleApplyProperty.cpp:
    (WebCore::ApplyPropertyCounter::applyInheritValue):
    (WebCore::ApplyPropertyCounter::applyValue):
    * css/CSSStyleSelector.cpp:
    (WebCore::CSSStyleSelector::appendAuthorStylesheets):
    (WebCore::CSSStyleSelector::collectMatchingRulesForList):
    * css/CSSValuePool.cpp:
    (WebCore::CSSValuePool::createIdentifierValue):
    (WebCore::CSSValuePool::createColorValue):
    (WebCore::CSSValuePool::createValue):
    (WebCore::CSSValuePool::createFontFamilyValue):
    (WebCore::CSSValuePool::createFontFaceValue):
    * dom/CheckedRadioButtons.cpp:
    (WebCore::RadioButtonGroup::add):
    (WebCore::CheckedRadioButtons::addButton):
    * dom/ChildListMutationScope.cpp:
    (WebCore::ChildListMutationScope::MutationAccumulationRouter::incrementScopingLevel):
    * dom/Document.cpp:
    (WebCore::Document::windowNamedItems):
    (WebCore::Document::documentNamedItems):
    (WebCore::Document::getCSSCanvasElement):
    (WebCore::Document::getItems):
    * dom/DocumentEventQueue.cpp:
    (WebCore::DocumentEventQueue::enqueueEvent):
    (WebCore::DocumentEventQueue::enqueueOrDispatchScrollEvent):
    (WebCore::DocumentEventQueue::pendingEventTimerFired):
    * dom/DocumentOrderedMap.cpp:
    (WebCore::DocumentOrderedMap::add):
    * dom/EventListenerMap.cpp:
    (WebCore::EventListenerMap::add):
    * dom/Node.cpp:
    (WebCore::Node::dumpStatistics):
    (WebCore::Node::getElementsByTagName):
    (WebCore::Node::getElementsByTagNameNS):
    (WebCore::Node::getElementsByName):
    (WebCore::Node::getElementsByClassName):
    (WebCore::Node::collectMatchingObserversForMutation):
    * dom/QualifiedName.cpp:
    (WebCore::QualifiedName::init):
    * dom/SpaceSplitString.cpp:
    (WebCore::SpaceSplitStringData::create):
    * dom/StyledElement.cpp:
    (WebCore::StyledElement::updateAttributeStyle):
    * html/HTMLCollection.cpp:
    (WebCore::HTMLCollection::append):
    * inspector/DOMPatchSupport.cpp:
    (WebCore::DOMPatchSupport::diff):
    * inspector/InspectorCSSAgent.cpp:
    (WebCore::SelectorProfile::commitSelector):
    * inspector/InspectorDOMAgent.cpp:
    (WebCore::InspectorDOMAgent::performSearch):
    * inspector/InspectorDebuggerAgent.cpp:
    (WebCore::InspectorDebuggerAgent::resolveBreakpoint):
    * inspector/InspectorValues.h:
    (WebCore::InspectorObject::setValue):
    (WebCore::InspectorObject::setObject):
    (WebCore::InspectorObject::setArray):
    * loader/appcache/ApplicationCacheGroup.cpp:
    (WebCore::ApplicationCacheGroup::addEntry):
    * loader/appcache/ApplicationCacheStorage.cpp:
    (WebCore::ApplicationCacheStorage::findOrCreateCacheGroup):
    * page/EventHandler.cpp:
    (WebCore::EventHandler::handleTouchEvent):
    * page/PageGroup.cpp:
    (WebCore::PageGroup::pageGroup):
    (WebCore::PageGroup::addVisitedLink):
    (WebCore::PageGroup::addUserScriptToWorld):
    (WebCore::PageGroup::addUserStyleSheetToWorld):
    * page/SecurityPolicy.cpp:
    (WebCore::SecurityPolicy::addOriginAccessWhitelistEntry):
    * page/TouchAdjustment.cpp:
    (WebCore::TouchAdjustment::compileSubtargetList):
    * platform/cf/BinaryPropertyList.cpp:
    (WebCore::BinaryPropertyListPlan::writeInteger):
    (WebCore::BinaryPropertyListPlan::writeString):
    (WebCore::BinaryPropertyListPlan::writeIntegerArray):
    * platform/graphics/blackberry/LayerTiler.cpp:
    (WebCore::LayerTiler::addTileJob):
    * platform/graphics/ca/GraphicsLayerCA.cpp:
    (WebCore::GraphicsLayerCA::findOrMakeClone):
    * platform/graphics/ca/mac/TileCache.mm:
    (WebCore::TileCache::revalidateTiles):
    * platform/graphics/ca/win/LayerChangesFlusher.cpp:
    (WebCore::LayerChangesFlusher::flushPendingLayerChangesSoon):
    * platform/graphics/chromium/FontUtilsChromiumWin.cpp:
    (WebCore::getDerivedFontData):
    * platform/graphics/chromium/cc/CCLayerAnimationController.cpp:
    (WebCore::CCLayerAnimationController::startAnimationsWaitingForTargetAvailability):
    * platform/graphics/mac/ComplexTextControllerATSUI.cpp:
    (WebCore::initializeATSUStyle):
    * platform/graphics/mac/SimpleFontDataCoreText.cpp:
    (WebCore::SimpleFontData::getCFStringAttributes):
    * platform/graphics/mac/SimpleFontDataMac.mm:
    (WebCore::SimpleFontData::canRenderCombiningCharacterSequence):
    * platform/graphics/wince/FontPlatformData.cpp:
    (WebCore::FixedSizeFontData::create):
    * platform/gtk/RenderThemeGtk3.cpp:
    (WebCore::getStyleContext):
    * platform/mac/ThreadCheck.mm:
    (WebCoreReportThreadViolation):
    * platform/network/HTTPHeaderMap.cpp:
    (WebCore::HTTPHeaderMap::add):
    * platform/network/HTTPHeaderMap.h:
    (HTTPHeaderMap):
    * platform/network/ResourceRequestBase.cpp:
    (WebCore::ResourceRequestBase::addHTTPHeaderField):
    * plugins/PluginDatabase.cpp:
    (WebCore::PluginDatabase::add):
    (WebCore::PluginDatabase::loadPersistentMetadataCache):
    * plugins/win/PluginDatabaseWin.cpp:
    (WebCore::PluginDatabase::getPluginPathsInDirectories):
    * rendering/RenderBlock.cpp:
    (WebCore::RenderBlock::addPercentHeightDescendant):
    * rendering/RenderBlockLineLayout.cpp:
    (WebCore::setLogicalWidthForTextRun):
    * rendering/RenderNamedFlowThread.cpp:
    (WebCore::RenderNamedFlowThread::addDependencyOnFlowThread):
    * rendering/RenderRegion.cpp:
    (WebCore::RenderRegion::setRenderBoxRegionInfo):
    * rendering/svg/RenderSVGResourceGradient.cpp:
    (WebCore::RenderSVGResourceGradient::applyResource):
    * rendering/svg/RenderSVGResourcePattern.cpp:
    (WebCore::RenderSVGResourcePattern::applyResource):
    * storage/StorageMap.cpp:
    (WebCore::StorageMap::setItem):
    (WebCore::StorageMap::importItem):
    * svg/SVGDocumentExtensions.cpp:
    (WebCore::SVGDocumentExtensions::addPendingResource):
    * xml/XMLHttpRequest.cpp:
    (WebCore::XMLHttpRequest::setRequestHeaderInternal):
    * xml/XPathFunctions.cpp:
    (WebCore::XPath::FunId::evaluate):
    * xml/XPathPath.cpp:
    (WebCore::XPath::LocationPath::evaluate):
    * xml/XPathPredicate.cpp:
    (WebCore::XPath::Union::evaluate):
    
    Source/WebKit/chromium:
    
    Update code to use AddResult instead of a pair.
    
    * src/WebHTTPLoadInfo.cpp:
    (WebKit::addHeader):
    * src/WebURLResponse.cpp:
    (WebKit::WebURLResponse::addHTTPHeaderField):
    
    Source/WebKit/mac:
    
    Update code to use AddResult instead of a pair.
    
    * Plugins/Hosted/NetscapePluginHostManager.mm:
    (WebKit::NetscapePluginHostManager::hostForPlugin):
    * Plugins/Hosted/ProxyInstance.mm:
    (WebKit::ProxyInstance::methodsNamed):
    (WebKit::ProxyInstance::fieldNamed):
    * WebCoreSupport/WebNotificationClient.mm:
    (WebNotificationClient::show):
    
    Source/WebKit/win:
    
    Update code to use AddResult instead of a pair.
    
    * WebKitCOMAPI.cpp:
    (classFactory):
    
    Source/WebKit2:
    
    Update code to use AddResult instead of a pair.
    
    * Platform/CoreIPC/ArgumentCoders.h:
    * Platform/CoreIPC/Connection.cpp:
    (CoreIPC::Connection::SyncMessageState::getOrCreate):
    * Shared/MutableDictionary.cpp:
    (WebKit::MutableDictionary::add):
    (WebKit::MutableDictionary::set):
    * Shared/UserMessageCoders.h:
    (WebKit::UserMessageDecoder::baseDecode):
    * Shared/mac/CommandLineMac.cpp:
    (WebKit::CommandLine::parse):
    * UIProcess/API/mac/WKPrintingView.mm:
    (pageDidDrawToPDF):
    * UIProcess/API/mac/WKView.mm:
    (-[WKView validateUserInterfaceItem:]):
    * UIProcess/WebProcessProxy.cpp:
    (WebKit::WebProcessProxy::addBackForwardItem):
    * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
    (WebKit::InjectedBundleNodeHandle::getOrCreate):
    * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
    (WebKit::InjectedBundleRangeHandle::getOrCreate):
    * WebProcess/Notifications/WebNotificationManager.cpp:
    (WebKit::WebNotificationManager::show):
    * WebProcess/WebProcess.cpp:
    (WebKit::WebProcess::createWebPage):
    (WebKit::WebProcess::webPageGroup):
    
    Source/WTF:
    
    Make HashTable<>::add() and derivate functions return an AddResult struct instead
    of a pair. This struct contains contains 'iterator' and 'isNewEntry' members, that are
    more readable at callsites than previous 'first' and 'second'.
    
    * wtf/HashCountedSet.h:
    (HashCountedSet):
    (WTF::::add):
    * wtf/HashMap.h:
    (HashMap):
    (WTF):
    (WTF::::set):
    * wtf/HashSet.h:
    (HashSet):
    (WTF::::add):
    (WTF):
    * wtf/HashTable.h:
    (WTF::HashTableAddResult::HashTableAddResult):
    (HashTableAddResult):
    (WTF):
    (HashTable):
    (WTF::HashTable::add):
    (WTF::::add):
    (WTF::::addPassingHashCode):
    * wtf/ListHashSet.h:
    (ListHashSet):
    (WTF::::add):
    (WTF::::insertBefore):
    * wtf/RefPtrHashMap.h:
    (WTF):
    (WTF::::set):
    * wtf/Spectrum.h:
    (WTF::Spectrum::add):
    * wtf/WTFThreadData.cpp:
    (JSC::IdentifierTable::add):
    * wtf/WTFThreadData.h:
    (IdentifierTable):
    * wtf/text/AtomicString.cpp:
    (WTF::addToStringTable):
    (WTF::AtomicString::addSlowCase):
    
    Tools:
    
    Update code to use AddResult instead of a pair.
    
    * DumpRenderTree/mac/LayoutTestControllerMac.mm:
    (LayoutTestController::evaluateScriptInIsolatedWorld):
    * DumpRenderTree/win/LayoutTestControllerWin.cpp:
    (LayoutTestController::evaluateScriptInIsolatedWorld):
    * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
    (WTR::LayoutTestController::evaluateScriptInIsolatedWorld):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@112555 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    4c11ee05
JSArray.cpp 73 KB