Web Inspector: purge PassRefPtr from Inspector code and use Ref for typed and untyped...
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Jan 2015 23:29:03 +0000 (23:29 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Jan 2015 23:29:03 +0000 (23:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=140053

Patch by Brian J. Burg <burg@cs.washington.edu> on 2015-01-07
Reviewed by Andreas Kling.

Source/JavaScriptCore:

This patch replaces uses of PassRefPtr with uses of RefPtr&& and WTF::move() in code
related to Web Inspector. It also converts many uses of RefPtr to Ref where
references are always non-null. These two refactorings have been combined since
they tend to require similar changes to the code.

Creation methods for subclasses of InspectorValue now return a Ref, and callsites
have been updated to take a Ref instead of RefPtr.

Builders for typed protocol objects now return a Ref. Since there is no implicit
call to operator&, callsites now must explicitly call .release() to convert a
builder object into the corresponding protocol object once required fields are set.
Update callsites and use auto to eliminate repetition of longwinded protocol types.

Tests for inspector protocol and replay inputs have been rebaselined.

* bindings/ScriptValue.cpp:
(Deprecated::jsToInspectorValue):
(Deprecated::ScriptValue::toInspectorValue):
* bindings/ScriptValue.h:
* inspector/ConsoleMessage.cpp:
(Inspector::ConsoleMessage::addToFrontend):
* inspector/ContentSearchUtilities.cpp:
(Inspector::ContentSearchUtilities::buildObjectForSearchMatch):
(Inspector::ContentSearchUtilities::searchInTextByLines):
* inspector/ContentSearchUtilities.h:
* inspector/InjectedScript.cpp:
(Inspector::InjectedScript::getFunctionDetails):
(Inspector::InjectedScript::getProperties):
(Inspector::InjectedScript::getInternalProperties):
(Inspector::InjectedScript::wrapCallFrames):
(Inspector::InjectedScript::wrapObject):
(Inspector::InjectedScript::wrapTable):
* inspector/InjectedScript.h:
* inspector/InjectedScriptBase.cpp:
(Inspector::InjectedScriptBase::makeEvalCall): Split the early exits.
* inspector/InspectorBackendDispatcher.cpp:
(Inspector::InspectorBackendDispatcher::CallbackBase::CallbackBase):
(Inspector::InspectorBackendDispatcher::CallbackBase::sendIfActive):
(Inspector::InspectorBackendDispatcher::create):
(Inspector::InspectorBackendDispatcher::dispatch):
(Inspector::InspectorBackendDispatcher::sendResponse):
(Inspector::InspectorBackendDispatcher::reportProtocolError):
(Inspector::getPropertyValue): Add a comment to clarify what this clever code does.
(Inspector::InspectorBackendDispatcher::getInteger):
(Inspector::InspectorBackendDispatcher::getDouble):
(Inspector::InspectorBackendDispatcher::getString):
(Inspector::InspectorBackendDispatcher::getBoolean):
(Inspector::InspectorBackendDispatcher::getObject):
(Inspector::InspectorBackendDispatcher::getArray):
(Inspector::InspectorBackendDispatcher::getValue):
* inspector/InspectorBackendDispatcher.h: Use a typed protocol object to collect
protocol error strings.
(Inspector::InspectorSupplementalBackendDispatcher::InspectorSupplementalBackendDispatcher):
Convert the supplemental dispatcher's reference to Ref since it is never null.
* inspector/InspectorEnvironment.h:
* inspector/InspectorProtocolTypes.h: Get rid of ArrayItemHelper and
StructItemTraits. Add more versions of addItem to handle pushing various types.
(Inspector::Protocol::Array::openAccessors):
(Inspector::Protocol::Array::addItem):
(Inspector::Protocol::Array::create):
(Inspector::Protocol::StructItemTraits::push):
(Inspector::Protocol::BindingTraits<Protocol::Array<T>>::runtimeCast): Assert argument.
(Inspector::Protocol::StructItemTraits::pushRefPtr): Deleted.
(Inspector::Protocol::ArrayItemHelper<String>::Traits::pushRaw): Deleted.
(Inspector::Protocol::ArrayItemHelper<int>::Traits::pushRaw): Deleted.
(Inspector::Protocol::ArrayItemHelper<double>::Traits::pushRaw): Deleted.
(Inspector::Protocol::ArrayItemHelper<bool>::Traits::pushRaw): Deleted.
(Inspector::Protocol::ArrayItemHelper<InspectorValue>::Traits::pushRefPtr): Deleted.
(Inspector::Protocol::ArrayItemHelper<InspectorObject>::Traits::pushRefPtr): Deleted.
(Inspector::Protocol::ArrayItemHelper<InspectorArray>::Traits::pushRefPtr): Deleted.
(Inspector::Protocol::ArrayItemHelper<Protocol::Array<T>>::Traits::pushRefPtr): Deleted.
* inspector/InspectorValues.cpp: Straighten out getArray and getObject to have
the same call signature as other getters. Use Ref where possible.
(Inspector::InspectorObjectBase::getBoolean):
(Inspector::InspectorObjectBase::getString):
(Inspector::InspectorObjectBase::getObject):
(Inspector::InspectorObjectBase::getArray):
(Inspector::InspectorObjectBase::getValue):
(Inspector::InspectorObjectBase::writeJSON):
(Inspector::InspectorArrayBase::get):
(Inspector::InspectorObject::create):
(Inspector::InspectorArray::create):
(Inspector::InspectorValue::null):
(Inspector::InspectorString::create):
(Inspector::InspectorBasicValue::create):
(Inspector::InspectorObjectBase::get): Deleted.
* inspector/InspectorValues.h:
(Inspector::InspectorObjectBase::setValue):
(Inspector::InspectorObjectBase::setObject):
(Inspector::InspectorObjectBase::setArray):
(Inspector::InspectorArrayBase::pushValue):
(Inspector::InspectorArrayBase::pushObject):
(Inspector::InspectorArrayBase::pushArray):
* inspector/JSGlobalObjectConsoleClient.cpp:
(Inspector::JSGlobalObjectConsoleClient::messageWithTypeAndLevel):
(Inspector::JSGlobalObjectConsoleClient::count):
(Inspector::JSGlobalObjectConsoleClient::timeEnd):
(Inspector::JSGlobalObjectConsoleClient::timeStamp):
* inspector/JSGlobalObjectConsoleClient.h:
* inspector/JSGlobalObjectInspectorController.cpp:
(Inspector::JSGlobalObjectInspectorController::executionStopwatch):
* inspector/JSGlobalObjectInspectorController.h:
* inspector/ScriptCallFrame.cpp:
(Inspector::ScriptCallFrame::buildInspectorObject):
* inspector/ScriptCallFrame.h:
* inspector/ScriptCallStack.cpp:
(Inspector::ScriptCallStack::create):
(Inspector::ScriptCallStack::buildInspectorArray):
* inspector/ScriptCallStack.h:
* inspector/agents/InspectorAgent.cpp:
(Inspector::InspectorAgent::enable):
(Inspector::InspectorAgent::inspect):
(Inspector::InspectorAgent::activateExtraDomain):
* inspector/agents/InspectorAgent.h:
* inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::InspectorDebuggerAgent::handleConsoleAssert):
(Inspector::buildObjectForBreakpointCookie):
(Inspector::InspectorDebuggerAgent::setBreakpointByUrl):
(Inspector::InspectorDebuggerAgent::setBreakpoint):
(Inspector::InspectorDebuggerAgent::continueToLocation):
(Inspector::InspectorDebuggerAgent::resolveBreakpoint):
(Inspector::InspectorDebuggerAgent::schedulePauseOnNextStatement):
(Inspector::InspectorDebuggerAgent::scriptExecutionBlockedByCSP):
(Inspector::InspectorDebuggerAgent::currentCallFrames):
(Inspector::InspectorDebuggerAgent::didParseSource):
(Inspector::InspectorDebuggerAgent::breakpointActionProbe):
(Inspector::InspectorDebuggerAgent::breakProgram):
* inspector/agents/InspectorDebuggerAgent.h:
* inspector/agents/InspectorRuntimeAgent.cpp:
(Inspector::buildErrorRangeObject):
(Inspector::InspectorRuntimeAgent::callFunctionOn):
(Inspector::InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets):
(Inspector::InspectorRuntimeAgent::getBasicBlocks):
* inspector/agents/InspectorRuntimeAgent.h:
* inspector/scripts/codegen/cpp_generator.py:
(CppGenerator.cpp_type_for_unchecked_formal_in_parameter):
(CppGenerator.cpp_type_for_type_with_name):
(CppGenerator.cpp_type_for_formal_async_parameter):
(CppGenerator.should_use_references_for_type):
(CppGenerator):
* inspector/scripts/codegen/cpp_generator_templates.py:
* inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py:
(CppBackendDispatcherHeaderGenerator.generate_output):
(CppBackendDispatcherHeaderGenerator._generate_async_handler_declaration_for_command):
* inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py:
(CppBackendDispatcherImplementationGenerator._generate_small_dispatcher_switch_implementation_for_domain):
(CppBackendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_command):
* inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py:
(CppFrontendDispatcherHeaderGenerator.generate_output):
* inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py:
(CppFrontendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_event):
* inspector/scripts/codegen/generate_cpp_protocol_types_header.py:
(CppProtocolTypesHeaderGenerator.generate_output):
(_generate_class_for_object_declaration):
(_generate_unchecked_setter_for_member):
(_generate_forward_declarations_for_binding_traits):
* inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py:
(ObjCConfigurationImplementationGenerator._generate_success_block_for_command):
* inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py:
(ObjCFrontendDispatcherImplementationGenerator._generate_event):
(ObjCFrontendDispatcherImplementationGenerator._generate_event_out_parameters):
* inspector/scripts/codegen/generate_objc_protocol_types_implementation.py:
(ObjCProtocolTypesImplementationGenerator.generate_output):
* inspector/scripts/tests/expected/commands-with-async-attribute.json-result:
* inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result:
* inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result:
* inspector/scripts/tests/expected/enum-values.json-result:
* inspector/scripts/tests/expected/events-with-optional-parameters.json-result:
* inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result:
* inspector/scripts/tests/expected/same-type-id-different-domain.json-result:
* inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result:
* inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result:
* inspector/scripts/tests/expected/type-declaration-array-type.json-result:
* inspector/scripts/tests/expected/type-declaration-enum-type.json-result:
* inspector/scripts/tests/expected/type-declaration-object-type.json-result:
* inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result:
* replay/EncodedValue.cpp:
(JSC::EncodedValue::asObject):
(JSC::EncodedValue::asArray):
(JSC::EncodedValue::put<EncodedValue>):
(JSC::EncodedValue::append<EncodedValue>):
(JSC::EncodedValue::get<EncodedValue>):
* replay/EncodedValue.h:
* replay/scripts/CodeGeneratorReplayInputs.py:
(Type.borrow_type):
(Type.argument_type):
(Generator.generate_member_move_expression):
* runtime/ConsoleClient.cpp:
(JSC::ConsoleClient::printConsoleMessageWithArguments):
(JSC::ConsoleClient::internalMessageWithTypeAndLevel):
(JSC::ConsoleClient::logWithLevel):
(JSC::ConsoleClient::clear):
(JSC::ConsoleClient::dir):
(JSC::ConsoleClient::dirXML):
(JSC::ConsoleClient::table):
(JSC::ConsoleClient::trace):
(JSC::ConsoleClient::assertCondition):
(JSC::ConsoleClient::group):
(JSC::ConsoleClient::groupCollapsed):
(JSC::ConsoleClient::groupEnd):
* runtime/ConsoleClient.h:
* runtime/TypeSet.cpp:
(JSC::TypeSet::allStructureRepresentations):
(JSC::TypeSet::inspectorTypeSet):
(JSC::StructureShape::inspectorRepresentation):
* runtime/TypeSet.h:

Source/WebCore:

This patch replaces uses of PassRefPtr with uses of RefPtr&& and WTF::move() in code
related to Web Inspector. It also converts many uses of RefPtr to Ref where
references are always non-null. These two refactorings have been combined since
they tend to require similar changes to the code.

No new tests, no behavior changed.

* Modules/webdatabase/DatabaseManager.cpp:
(WebCore::DatabaseManager::openDatabase):
* dom/Document.cpp:
(WebCore::Document::logExceptionToConsole):
(WebCore::Document::addMessage):
* dom/Document.h:
* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::reportException):
* dom/ScriptExecutionContext.h:
* html/parser/XSSAuditorDelegate.cpp:
(WebCore::XSSAuditorDelegate::generateViolationReport):
* inspector/CommandLineAPIHost.cpp:
(WebCore::CommandLineAPIHost::inspectImpl):
* inspector/CommandLineAPIHost.h:
* inspector/InspectorApplicationCacheAgent.cpp:
(WebCore::InspectorApplicationCacheAgent::getFramesWithManifests):
(WebCore::InspectorApplicationCacheAgent::buildObjectForApplicationCache):
(WebCore::InspectorApplicationCacheAgent::buildArrayForApplicationCacheResources):
(WebCore::InspectorApplicationCacheAgent::buildObjectForApplicationCacheResource):
* inspector/InspectorApplicationCacheAgent.h:
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::getMatchedStylesForNode):
(WebCore::InspectorCSSAgent::getComputedStyleForNode):
(WebCore::InspectorCSSAgent::setStyleText):
(WebCore::InspectorCSSAgent::setPropertyText):
(WebCore::InspectorCSSAgent::toggleProperty):
(WebCore::InspectorCSSAgent::setRuleSelector):
(WebCore::InspectorCSSAgent::getSupportedCSSProperties):
(WebCore::InspectorCSSAgent::forcePseudoState):
(WebCore::InspectorCSSAgent::getNamedFlowCollection):
(WebCore::InspectorCSSAgent::detectOrigin):
(WebCore::InspectorCSSAgent::buildObjectForRule):
(WebCore::InspectorCSSAgent::buildArrayForMatchedRuleList):
(WebCore::InspectorCSSAgent::buildObjectForAttributesStyle):
(WebCore::InspectorCSSAgent::buildArrayForRegions):
(WebCore::InspectorCSSAgent::buildObjectForNamedFlow):
* inspector/InspectorCSSAgent.h:
* inspector/InspectorConsoleInstrumentation.h:
(WebCore::InspectorInstrumentation::addMessageToConsole):
(WebCore::InspectorInstrumentation::consoleCount):
(WebCore::InspectorInstrumentation::stopConsoleTiming):
(WebCore::InspectorInstrumentation::consoleTimeStamp):
(WebCore::InspectorInstrumentation::stopProfiling):
* inspector/InspectorController.cpp:
(WebCore::InspectorController::buildObjectForHighlightedNode):
(WebCore::InspectorController::executionStopwatch):
* inspector/InspectorController.h:
* inspector/InspectorDOMAgent.cpp:
(WebCore::parseColor):
(WebCore::parseConfigColor):
(WebCore::InspectorDOMAgent::pushNodePathToFrontend):
(WebCore::InspectorDOMAgent::performSearch):
(WebCore::InspectorDOMAgent::setInspectModeEnabled):
(WebCore::InspectorDOMAgent::highlightRect):
(WebCore::InspectorDOMAgent::highlightQuad):
(WebCore::InspectorDOMAgent::innerHighlightQuad):
(WebCore::InspectorDOMAgent::highlightNode):
(WebCore::InspectorDOMAgent::highlightFrame):
(WebCore::InspectorDOMAgent::buildObjectForNode):
(WebCore::InspectorDOMAgent::buildArrayForElementAttributes):
(WebCore::InspectorDOMAgent::buildArrayForContainerChildren):
(WebCore::InspectorDOMAgent::buildObjectForEventListener):
(WebCore::InspectorDOMAgent::processAccessibilityChildren):
(WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
(WebCore::InspectorDOMAgent::didCommitLoad):
(WebCore::InspectorDOMAgent::didInsertDOMNode):
(WebCore::InspectorDOMAgent::styleAttributeInvalidated):
(WebCore::InspectorDOMAgent::resolveNode):
* inspector/InspectorDOMAgent.h:
* inspector/InspectorDOMDebuggerAgent.cpp:
(WebCore::InspectorDOMDebuggerAgent::didInvalidateStyleAttr):
(WebCore::InspectorDOMDebuggerAgent::willInsertDOMNode):
(WebCore::InspectorDOMDebuggerAgent::willRemoveDOMNode):
(WebCore::InspectorDOMDebuggerAgent::willModifyDOMAttr):
(WebCore::InspectorDOMDebuggerAgent::descriptionForDOMEvent):
(WebCore::InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded):
(WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest):
* inspector/InspectorDOMDebuggerAgent.h:
* inspector/InspectorDOMStorageAgent.cpp:
(WebCore::InspectorDOMStorageAgent::getDOMStorageItems):
(WebCore::InspectorDOMStorageAgent::setDOMStorageItem):
(WebCore::InspectorDOMStorageAgent::removeDOMStorageItem):
(WebCore::InspectorDOMStorageAgent::storageId):
(WebCore::InspectorDOMStorageAgent::findStorageArea):
* inspector/InspectorDOMStorageAgent.h:
* inspector/InspectorDatabaseAgent.cpp: Use Ref for all callbacks since they are
not nullable.
(WebCore::InspectorDatabaseAgent::executeSQL):
* inspector/InspectorDatabaseAgent.h:
* inspector/InspectorDatabaseInstrumentation.h:
(WebCore::InspectorInstrumentation::didOpenDatabase):
* inspector/InspectorDatabaseResource.cpp:
(WebCore::InspectorDatabaseResource::create):
(WebCore::InspectorDatabaseResource::InspectorDatabaseResource):
(WebCore::InspectorDatabaseResource::bind):
* inspector/InspectorDatabaseResource.h:
(WebCore::InspectorDatabaseResource::setDatabase):
* inspector/InspectorFrontendHost.h:
(WebCore::InspectorFrontendHost::create):
* inspector/InspectorIndexedDBAgent.cpp: Use Ref for all callbacks since they are
not nullable.
(WebCore::InspectorIndexedDBAgent::requestDatabaseNames):
(WebCore::InspectorIndexedDBAgent::requestDatabase):
(WebCore::InspectorIndexedDBAgent::requestData):
(WebCore::ClearObjectStoreListener::create):
(WebCore::ClearObjectStoreListener::ClearObjectStoreListener):
(WebCore::ClearObjectStore::create):
(WebCore::ClearObjectStore::ClearObjectStore):
(WebCore::InspectorIndexedDBAgent::clearObjectStore):
* inspector/InspectorIndexedDBAgent.h:
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::willLoadXHRImpl):
(WebCore::InspectorInstrumentation::addMessageToConsoleImpl):
(WebCore::InspectorInstrumentation::consoleCountImpl):
(WebCore::InspectorInstrumentation::stopConsoleTimingImpl):
(WebCore::InspectorInstrumentation::consoleTimeStampImpl):
(WebCore::InspectorInstrumentation::stopProfilingImpl):
(WebCore::InspectorInstrumentation::didOpenDatabaseImpl):
(WebCore::InspectorInstrumentation::sessionCreatedImpl):
(WebCore::InspectorInstrumentation::sessionLoadedImpl):
(WebCore::InspectorInstrumentation::sessionModifiedImpl):
(WebCore::InspectorInstrumentation::segmentCreatedImpl):
(WebCore::InspectorInstrumentation::segmentCompletedImpl):
(WebCore::InspectorInstrumentation::segmentLoadedImpl):
(WebCore::InspectorInstrumentation::willLoadXHRSynchronouslyImpl): Deleted.
(WebCore::InspectorInstrumentation::didLoadXHRSynchronouslyImpl): Deleted.
(WebCore::InspectorInstrumentation::startProfilingImpl): Deleted.
(WebCore::InspectorInstrumentation::didDispatchDOMStorageEventImpl): Deleted.
(WebCore::InspectorInstrumentation::willEvaluateWorkerScript): Deleted.
(WebCore::InspectorInstrumentation::captureStoppedImpl): Deleted.
(WebCore::InspectorInstrumentation::playbackStartedImpl): Deleted.
(WebCore::InspectorInstrumentation::playbackPausedImpl): Deleted.
(WebCore::InspectorInstrumentation::playbackHitPositionImpl): Deleted.
(WebCore::InspectorInstrumentation::playbackFinishedImpl): Deleted.
(WebCore::InspectorInstrumentation::networkStateChangedImpl): Deleted.
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::willLoadXHR):
(WebCore::InspectorInstrumentation::sessionCreated):
(WebCore::InspectorInstrumentation::sessionLoaded):
(WebCore::InspectorInstrumentation::sessionModified):
(WebCore::InspectorInstrumentation::segmentCreated):
(WebCore::InspectorInstrumentation::segmentCompleted):
(WebCore::InspectorInstrumentation::segmentLoaded):
(WebCore::InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient): Deleted.
(WebCore::InspectorInstrumentation::didSendWebSocketFrame): Deleted.
* inspector/InspectorLayerTreeAgent.cpp:
(WebCore::InspectorLayerTreeAgent::buildObjectForLayer):
(WebCore::InspectorLayerTreeAgent::buildObjectForIntRect):
(WebCore::InspectorLayerTreeAgent::reasonsForCompositingLayer):
* inspector/InspectorLayerTreeAgent.h:
* inspector/InspectorOverlay.cpp:
(WebCore::buildObjectForPoint):
(WebCore::buildObjectForRect):
(WebCore::buildArrayForQuad):
(WebCore::buildObjectForHighlight):
(WebCore::buildObjectForRegionHighlight):
(WebCore::buildObjectForCSSRegionsHighlight):
(WebCore::buildObjectForSize):
(WebCore::buildObjectForCSSRegionContentClip):
(WebCore::InspectorOverlay::drawPaintRects):
(WebCore::buildObjectForRendererFragments):
(WebCore::buildObjectForShapeOutside):
(WebCore::buildObjectForElementInfo):
(WebCore::InspectorOverlay::buildObjectForHighlightedNode):
(WebCore::InspectorOverlay::reset):
(WebCore::InspectorOverlay::evaluateInOverlay):
* inspector/InspectorOverlay.h:
* inspector/InspectorPageAgent.cpp:
(WebCore::createXHRTextDecoder):
(WebCore::buildObjectForCookie):
(WebCore::buildArrayForCookies):
(WebCore::buildObjectForSearchResult):
(WebCore::InspectorPageAgent::buildObjectForFrame):
(WebCore::InspectorPageAgent::buildObjectForFrameTree):
* inspector/InspectorPageAgent.h:
* inspector/InspectorReplayAgent.cpp:
(WebCore::buildInspectorObjectForPosition):
(WebCore::buildInspectorObjectForInput):
(WebCore::buildInspectorObjectForSession):
(WebCore::buildInspectorObjectForSegment):
(WebCore::InspectorReplayAgent::replayToPosition):
(WebCore::InspectorReplayAgent::getSessionData):
(WebCore::InspectorReplayAgent::getSegmentData):
* inspector/InspectorReplayAgent.h:
* inspector/InspectorResourceAgent.cpp:
(WebCore::buildObjectForHeaders):
(WebCore::buildObjectForTiming):
(WebCore::buildObjectForResourceRequest):
(WebCore::buildObjectForResourceResponse):
(WebCore::buildObjectForCachedResource):
(WebCore::InspectorResourceAgent::willLoadXHR):
(WebCore::InspectorResourceAgent::buildInitiatorObject):
(WebCore::InspectorResourceAgent::willSendWebSocketHandshakeRequest):
(WebCore::InspectorResourceAgent::didReceiveWebSocketHandshakeResponse):
(WebCore::InspectorResourceAgent::didReceiveWebSocketFrame):
(WebCore::InspectorResourceAgent::didSendWebSocketFrame):
(WebCore::InspectorResourceAgent::setExtraHTTPHeaders):
(WebCore::InspectorResourceAgent::loadResource):
(WebCore::InspectorResourceAgent::documentThreadableLoaderStartedLoadingForClient): Deleted.
(WebCore::InspectorResourceAgent::didScheduleStyleRecalculation): Deleted.
(WebCore::InspectorResourceAgent::disable): Deleted.
(WebCore::InspectorResourceAgent::setCacheDisabled): Deleted.
* inspector/InspectorResourceAgent.h:
* inspector/InspectorStyleSheet.cpp:
(ParsedStyleSheet::ruleSourceDataAt):
(WebCore::buildSourceRangeObject):
(WebCore::buildMediaObject):
(WebCore::asCSSRuleList):
(WebCore::fillMediaListChain):
(WebCore::InspectorStyle::create):
(WebCore::InspectorStyle::InspectorStyle):
(WebCore::InspectorStyle::buildObjectForStyle):
(WebCore::InspectorStyle::buildArrayForComputedStyle):
(WebCore::InspectorStyle::styleWithProperties):
(WebCore::InspectorStyle::extractSourceData):
(WebCore::InspectorStyleSheet::create):
(WebCore::InspectorStyleSheet::InspectorStyleSheet):
(WebCore::InspectorStyleSheet::buildObjectForStyleSheet):
(WebCore::InspectorStyleSheet::buildObjectForStyleSheetInfo):
(WebCore::buildObjectForSelectorHelper):
(WebCore::selectorsFromSource):
(WebCore::InspectorStyleSheet::buildObjectForSelector):
(WebCore::InspectorStyleSheet::buildObjectForSelectorList):
(WebCore::InspectorStyleSheet::buildObjectForRule):
(WebCore::InspectorStyleSheet::buildObjectForStyle):
(WebCore::InspectorStyleSheet::toggleProperty):
(WebCore::InspectorStyleSheet::inspectorStyleForId):
(WebCore::InspectorStyleSheet::rememberInspectorStyle):
(WebCore::InspectorStyleSheet::buildArrayForRuleList):
(WebCore::InspectorStyleSheet::collectFlatRules):
(WebCore::InspectorStyleSheetForInlineStyle::create):
(WebCore::InspectorStyleSheetForInlineStyle::InspectorStyleSheetForInlineStyle):
(WebCore::InspectorStyleSheetForInlineStyle::inspectorStyleForId):
* inspector/InspectorStyleSheet.h:
(WebCore::InspectorCSSId::InspectorCSSId):
(WebCore::InspectorCSSId::asProtocolValue):
* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::startFromConsole):
(WebCore::InspectorTimelineAgent::stopFromConsole):
(WebCore::InspectorTimelineAgent::addRecordToTimeline):
(WebCore::InspectorTimelineAgent::didCompleteRecordEntry):
(WebCore::InspectorTimelineAgent::appendRecord):
(WebCore::InspectorTimelineAgent::sendEvent):
(WebCore::InspectorTimelineAgent::createRecordEntry):
(WebCore::InspectorTimelineAgent::pushCurrentRecord):
* inspector/InspectorTimelineAgent.h:
* inspector/InspectorWorkerAgent.cpp:
(WebCore::InspectorWorkerAgent::sendMessageToWorker):
* inspector/InspectorWorkerAgent.h:
* inspector/NetworkResourcesData.cpp:
(WebCore::XHRReplayData::create):
(WebCore::XHRReplayData::XHRReplayData):
* inspector/NetworkResourcesData.h:
(WebCore::NetworkResourcesData::ResourceData::decoder):
(WebCore::NetworkResourcesData::ResourceData::setDecoder):
(WebCore::NetworkResourcesData::ResourceData::buffer):
(WebCore::NetworkResourcesData::ResourceData::setBuffer):
* inspector/TimelineRecordFactory.cpp:
(WebCore::TimelineRecordFactory::createGenericRecord):
(WebCore::TimelineRecordFactory::createBackgroundRecord):
(WebCore::TimelineRecordFactory::createGCEventData):
(WebCore::TimelineRecordFactory::createFunctionCallData):
(WebCore::TimelineRecordFactory::createConsoleProfileData):
(WebCore::TimelineRecordFactory::createProbeSampleData):
(WebCore::TimelineRecordFactory::createEventDispatchData):
(WebCore::TimelineRecordFactory::createGenericTimerData):
(WebCore::TimelineRecordFactory::createTimerInstallData):
(WebCore::TimelineRecordFactory::createXHRReadyStateChangeData):
(WebCore::TimelineRecordFactory::createXHRLoadData):
(WebCore::TimelineRecordFactory::createEvaluateScriptData):
(WebCore::TimelineRecordFactory::createTimeStampData):
(WebCore::TimelineRecordFactory::createScheduleResourceRequestData):
(WebCore::TimelineRecordFactory::createResourceSendRequestData):
(WebCore::TimelineRecordFactory::createResourceReceiveResponseData):
(WebCore::TimelineRecordFactory::createResourceFinishData):
(WebCore::TimelineRecordFactory::createReceiveResourceData):
(WebCore::TimelineRecordFactory::createLayoutData):
(WebCore::TimelineRecordFactory::createDecodeImageData):
(WebCore::TimelineRecordFactory::createResizeImageData):
(WebCore::TimelineRecordFactory::createMarkData):
(WebCore::TimelineRecordFactory::createParseHTMLData):
(WebCore::TimelineRecordFactory::createAnimationFrameData):
(WebCore::createQuad):
(WebCore::TimelineRecordFactory::createPaintData):
(WebCore::buildInspectorObject):
(WebCore::buildProfileInspectorObject):
(WebCore::TimelineRecordFactory::appendProfile):
* inspector/TimelineRecordFactory.h:
(WebCore::TimelineRecordFactory::createWebSocketCreateData):
(WebCore::TimelineRecordFactory::createGenericWebSocketData):
* inspector/WorkerInspectorController.cpp:
(WebCore::WorkerInspectorController::executionStopwatch):
* inspector/WorkerInspectorController.h:
* page/PageConsoleClient.cpp:
(WebCore::PageConsoleClient::addMessage):
(WebCore::PageConsoleClient::messageWithTypeAndLevel):
(WebCore::PageConsoleClient::count):
(WebCore::PageConsoleClient::profileEnd):
(WebCore::PageConsoleClient::timeEnd):
(WebCore::PageConsoleClient::timeStamp):
* page/PageConsoleClient.h:
* replay/ReplayController.cpp:
(WebCore::ReplayController::switchSession):
(WebCore::ReplayController::createSegment):
(WebCore::ReplayController::completeSegment):
(WebCore::ReplayController::loadSegmentAtIndex):
* replay/ReplayInputCreationMethods.cpp:
(WebCore::InitialNavigation::createFromPage):
* workers/SharedWorkerGlobalScope.cpp:
(WebCore::SharedWorkerGlobalScope::logExceptionToConsole):
* workers/SharedWorkerGlobalScope.h:
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::logExceptionToConsole):
(WebCore::WorkerGlobalScope::addMessage):
(WebCore::WorkerGlobalScope::addMessageToWorkerConsole):
* workers/WorkerGlobalScope.h:

Source/WebKit:

* WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in: update symbol.

Source/WTF:

* wtf/Stopwatch.h:
(WTF::Stopwatch::create): Return a Ref.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@178060 268f45cc-cd09-0410-ab3c-d52691b4dbfc

127 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bindings/ScriptValue.cpp
Source/JavaScriptCore/bindings/ScriptValue.h
Source/JavaScriptCore/inspector/ConsoleMessage.cpp
Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp
Source/JavaScriptCore/inspector/ContentSearchUtilities.h
Source/JavaScriptCore/inspector/InjectedScript.cpp
Source/JavaScriptCore/inspector/InjectedScript.h
Source/JavaScriptCore/inspector/InjectedScriptBase.cpp
Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp
Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h
Source/JavaScriptCore/inspector/InspectorEnvironment.h
Source/JavaScriptCore/inspector/InspectorProtocolTypes.h
Source/JavaScriptCore/inspector/InspectorValues.cpp
Source/JavaScriptCore/inspector/InspectorValues.h
Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp
Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.h
Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp
Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.h
Source/JavaScriptCore/inspector/ScriptCallFrame.cpp
Source/JavaScriptCore/inspector/ScriptCallFrame.h
Source/JavaScriptCore/inspector/ScriptCallStack.cpp
Source/JavaScriptCore/inspector/ScriptCallStack.h
Source/JavaScriptCore/inspector/agents/InspectorAgent.cpp
Source/JavaScriptCore/inspector/agents/InspectorAgent.h
Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp
Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h
Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp
Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h
Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator.py
Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator_templates.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_types_implementation.py
Source/JavaScriptCore/inspector/scripts/codegen/objc_generator_templates.py [changed mode: 0644->0755]
Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-async-attribute.json-result
Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result
Source/JavaScriptCore/inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result
Source/JavaScriptCore/inspector/scripts/tests/expected/enum-values.json-result
Source/JavaScriptCore/inspector/scripts/tests/expected/events-with-optional-parameters.json-result
Source/JavaScriptCore/inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result
Source/JavaScriptCore/inspector/scripts/tests/expected/same-type-id-different-domain.json-result
Source/JavaScriptCore/inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result
Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result
Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-array-type.json-result
Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-enum-type.json-result
Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-object-type.json-result
Source/JavaScriptCore/inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result
Source/JavaScriptCore/replay/EncodedValue.cpp
Source/JavaScriptCore/replay/EncodedValue.h
Source/JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py
Source/JavaScriptCore/runtime/ConsoleClient.cpp
Source/JavaScriptCore/runtime/ConsoleClient.h
Source/JavaScriptCore/runtime/TypeSet.cpp
Source/JavaScriptCore/runtime/TypeSet.h
Source/WTF/ChangeLog
Source/WTF/wtf/Stopwatch.h
Source/WebCore/ChangeLog
Source/WebCore/Modules/webdatabase/DatabaseManager.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/ScriptExecutionContext.cpp
Source/WebCore/dom/ScriptExecutionContext.h
Source/WebCore/html/parser/XSSAuditorDelegate.cpp
Source/WebCore/inspector/CommandLineAPIHost.cpp
Source/WebCore/inspector/CommandLineAPIHost.h
Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp
Source/WebCore/inspector/InspectorApplicationCacheAgent.h
Source/WebCore/inspector/InspectorCSSAgent.cpp
Source/WebCore/inspector/InspectorCSSAgent.h
Source/WebCore/inspector/InspectorConsoleInstrumentation.h
Source/WebCore/inspector/InspectorController.cpp
Source/WebCore/inspector/InspectorController.h
Source/WebCore/inspector/InspectorDOMAgent.cpp
Source/WebCore/inspector/InspectorDOMAgent.h
Source/WebCore/inspector/InspectorDOMDebuggerAgent.cpp
Source/WebCore/inspector/InspectorDOMDebuggerAgent.h
Source/WebCore/inspector/InspectorDOMStorageAgent.cpp
Source/WebCore/inspector/InspectorDOMStorageAgent.h
Source/WebCore/inspector/InspectorDatabaseAgent.cpp
Source/WebCore/inspector/InspectorDatabaseAgent.h
Source/WebCore/inspector/InspectorDatabaseInstrumentation.h
Source/WebCore/inspector/InspectorDatabaseResource.cpp
Source/WebCore/inspector/InspectorDatabaseResource.h
Source/WebCore/inspector/InspectorFrontendHost.h
Source/WebCore/inspector/InspectorIndexedDBAgent.cpp
Source/WebCore/inspector/InspectorIndexedDBAgent.h
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/inspector/InspectorLayerTreeAgent.cpp
Source/WebCore/inspector/InspectorLayerTreeAgent.h
Source/WebCore/inspector/InspectorOverlay.cpp
Source/WebCore/inspector/InspectorOverlay.h
Source/WebCore/inspector/InspectorPageAgent.cpp
Source/WebCore/inspector/InspectorPageAgent.h
Source/WebCore/inspector/InspectorReplayAgent.cpp
Source/WebCore/inspector/InspectorReplayAgent.h
Source/WebCore/inspector/InspectorResourceAgent.cpp
Source/WebCore/inspector/InspectorResourceAgent.h
Source/WebCore/inspector/InspectorStyleSheet.cpp
Source/WebCore/inspector/InspectorStyleSheet.h
Source/WebCore/inspector/InspectorTimelineAgent.cpp
Source/WebCore/inspector/InspectorTimelineAgent.h
Source/WebCore/inspector/InspectorWorkerAgent.cpp
Source/WebCore/inspector/InspectorWorkerAgent.h
Source/WebCore/inspector/NetworkResourcesData.cpp
Source/WebCore/inspector/NetworkResourcesData.h
Source/WebCore/inspector/TimelineRecordFactory.cpp
Source/WebCore/inspector/TimelineRecordFactory.h
Source/WebCore/inspector/WorkerInspectorController.cpp
Source/WebCore/inspector/WorkerInspectorController.h
Source/WebCore/page/PageConsoleClient.cpp
Source/WebCore/page/PageConsoleClient.h
Source/WebCore/replay/ReplayController.cpp
Source/WebCore/replay/ReplayInputCreationMethods.cpp
Source/WebCore/workers/SharedWorkerGlobalScope.cpp
Source/WebCore/workers/SharedWorkerGlobalScope.h
Source/WebCore/workers/WorkerGlobalScope.cpp
Source/WebCore/workers/WorkerGlobalScope.h
Source/WebKit/ChangeLog
Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in

index e85de2d..562b757 100644 (file)
@@ -1,3 +1,217 @@
+2015-01-07  Brian J. Burg  <burg@cs.washington.edu>
+
+        Web Inspector: purge PassRefPtr from Inspector code and use Ref for typed and untyped protocol objects
+        https://bugs.webkit.org/show_bug.cgi?id=140053
+
+        Reviewed by Andreas Kling.
+
+        This patch replaces uses of PassRefPtr with uses of RefPtr&& and WTF::move() in code
+        related to Web Inspector. It also converts many uses of RefPtr to Ref where
+        references are always non-null. These two refactorings have been combined since
+        they tend to require similar changes to the code.
+
+        Creation methods for subclasses of InspectorValue now return a Ref, and callsites
+        have been updated to take a Ref instead of RefPtr.
+
+        Builders for typed protocol objects now return a Ref. Since there is no implicit
+        call to operator&, callsites now must explicitly call .release() to convert a
+        builder object into the corresponding protocol object once required fields are set.
+        Update callsites and use auto to eliminate repetition of longwinded protocol types.
+
+        Tests for inspector protocol and replay inputs have been rebaselined.
+
+        * bindings/ScriptValue.cpp:
+        (Deprecated::jsToInspectorValue):
+        (Deprecated::ScriptValue::toInspectorValue):
+        * bindings/ScriptValue.h:
+        * inspector/ConsoleMessage.cpp:
+        (Inspector::ConsoleMessage::addToFrontend):
+        * inspector/ContentSearchUtilities.cpp:
+        (Inspector::ContentSearchUtilities::buildObjectForSearchMatch):
+        (Inspector::ContentSearchUtilities::searchInTextByLines):
+        * inspector/ContentSearchUtilities.h:
+        * inspector/InjectedScript.cpp:
+        (Inspector::InjectedScript::getFunctionDetails):
+        (Inspector::InjectedScript::getProperties):
+        (Inspector::InjectedScript::getInternalProperties):
+        (Inspector::InjectedScript::wrapCallFrames):
+        (Inspector::InjectedScript::wrapObject):
+        (Inspector::InjectedScript::wrapTable):
+        * inspector/InjectedScript.h:
+        * inspector/InjectedScriptBase.cpp:
+        (Inspector::InjectedScriptBase::makeEvalCall): Split the early exits.
+        * inspector/InspectorBackendDispatcher.cpp:
+        (Inspector::InspectorBackendDispatcher::CallbackBase::CallbackBase):
+        (Inspector::InspectorBackendDispatcher::CallbackBase::sendIfActive):
+        (Inspector::InspectorBackendDispatcher::create):
+        (Inspector::InspectorBackendDispatcher::dispatch):
+        (Inspector::InspectorBackendDispatcher::sendResponse):
+        (Inspector::InspectorBackendDispatcher::reportProtocolError):
+        (Inspector::getPropertyValue): Add a comment to clarify what this clever code does.
+        (Inspector::InspectorBackendDispatcher::getInteger):
+        (Inspector::InspectorBackendDispatcher::getDouble):
+        (Inspector::InspectorBackendDispatcher::getString):
+        (Inspector::InspectorBackendDispatcher::getBoolean):
+        (Inspector::InspectorBackendDispatcher::getObject):
+        (Inspector::InspectorBackendDispatcher::getArray):
+        (Inspector::InspectorBackendDispatcher::getValue):
+        * inspector/InspectorBackendDispatcher.h: Use a typed protocol object to collect
+        protocol error strings.
+        (Inspector::InspectorSupplementalBackendDispatcher::InspectorSupplementalBackendDispatcher):
+        Convert the supplemental dispatcher's reference to Ref since it is never null.
+        * inspector/InspectorEnvironment.h:
+        * inspector/InspectorProtocolTypes.h: Get rid of ArrayItemHelper and
+        StructItemTraits. Add more versions of addItem to handle pushing various types.
+        (Inspector::Protocol::Array::openAccessors):
+        (Inspector::Protocol::Array::addItem):
+        (Inspector::Protocol::Array::create):
+        (Inspector::Protocol::StructItemTraits::push):
+        (Inspector::Protocol::BindingTraits<Protocol::Array<T>>::runtimeCast): Assert argument.
+        (Inspector::Protocol::StructItemTraits::pushRefPtr): Deleted.
+        (Inspector::Protocol::ArrayItemHelper<String>::Traits::pushRaw): Deleted.
+        (Inspector::Protocol::ArrayItemHelper<int>::Traits::pushRaw): Deleted.
+        (Inspector::Protocol::ArrayItemHelper<double>::Traits::pushRaw): Deleted.
+        (Inspector::Protocol::ArrayItemHelper<bool>::Traits::pushRaw): Deleted.
+        (Inspector::Protocol::ArrayItemHelper<InspectorValue>::Traits::pushRefPtr): Deleted.
+        (Inspector::Protocol::ArrayItemHelper<InspectorObject>::Traits::pushRefPtr): Deleted.
+        (Inspector::Protocol::ArrayItemHelper<InspectorArray>::Traits::pushRefPtr): Deleted.
+        (Inspector::Protocol::ArrayItemHelper<Protocol::Array<T>>::Traits::pushRefPtr): Deleted.
+        * inspector/InspectorValues.cpp: Straighten out getArray and getObject to have
+        the same call signature as other getters. Use Ref where possible.
+        (Inspector::InspectorObjectBase::getBoolean):
+        (Inspector::InspectorObjectBase::getString):
+        (Inspector::InspectorObjectBase::getObject):
+        (Inspector::InspectorObjectBase::getArray):
+        (Inspector::InspectorObjectBase::getValue):
+        (Inspector::InspectorObjectBase::writeJSON):
+        (Inspector::InspectorArrayBase::get):
+        (Inspector::InspectorObject::create):
+        (Inspector::InspectorArray::create):
+        (Inspector::InspectorValue::null):
+        (Inspector::InspectorString::create):
+        (Inspector::InspectorBasicValue::create):
+        (Inspector::InspectorObjectBase::get): Deleted.
+        * inspector/InspectorValues.h:
+        (Inspector::InspectorObjectBase::setValue):
+        (Inspector::InspectorObjectBase::setObject):
+        (Inspector::InspectorObjectBase::setArray):
+        (Inspector::InspectorArrayBase::pushValue):
+        (Inspector::InspectorArrayBase::pushObject):
+        (Inspector::InspectorArrayBase::pushArray):
+        * inspector/JSGlobalObjectConsoleClient.cpp:
+        (Inspector::JSGlobalObjectConsoleClient::messageWithTypeAndLevel):
+        (Inspector::JSGlobalObjectConsoleClient::count):
+        (Inspector::JSGlobalObjectConsoleClient::timeEnd):
+        (Inspector::JSGlobalObjectConsoleClient::timeStamp):
+        * inspector/JSGlobalObjectConsoleClient.h:
+        * inspector/JSGlobalObjectInspectorController.cpp:
+        (Inspector::JSGlobalObjectInspectorController::executionStopwatch):
+        * inspector/JSGlobalObjectInspectorController.h:
+        * inspector/ScriptCallFrame.cpp:
+        (Inspector::ScriptCallFrame::buildInspectorObject):
+        * inspector/ScriptCallFrame.h:
+        * inspector/ScriptCallStack.cpp:
+        (Inspector::ScriptCallStack::create):
+        (Inspector::ScriptCallStack::buildInspectorArray):
+        * inspector/ScriptCallStack.h:
+        * inspector/agents/InspectorAgent.cpp:
+        (Inspector::InspectorAgent::enable):
+        (Inspector::InspectorAgent::inspect):
+        (Inspector::InspectorAgent::activateExtraDomain):
+        * inspector/agents/InspectorAgent.h:
+        * inspector/agents/InspectorDebuggerAgent.cpp:
+        (Inspector::InspectorDebuggerAgent::handleConsoleAssert):
+        (Inspector::buildObjectForBreakpointCookie):
+        (Inspector::InspectorDebuggerAgent::setBreakpointByUrl):
+        (Inspector::InspectorDebuggerAgent::setBreakpoint):
+        (Inspector::InspectorDebuggerAgent::continueToLocation):
+        (Inspector::InspectorDebuggerAgent::resolveBreakpoint):
+        (Inspector::InspectorDebuggerAgent::schedulePauseOnNextStatement):
+        (Inspector::InspectorDebuggerAgent::scriptExecutionBlockedByCSP):
+        (Inspector::InspectorDebuggerAgent::currentCallFrames):
+        (Inspector::InspectorDebuggerAgent::didParseSource):
+        (Inspector::InspectorDebuggerAgent::breakpointActionProbe):
+        (Inspector::InspectorDebuggerAgent::breakProgram):
+        * inspector/agents/InspectorDebuggerAgent.h:
+        * inspector/agents/InspectorRuntimeAgent.cpp:
+        (Inspector::buildErrorRangeObject):
+        (Inspector::InspectorRuntimeAgent::callFunctionOn):
+        (Inspector::InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets):
+        (Inspector::InspectorRuntimeAgent::getBasicBlocks):
+        * inspector/agents/InspectorRuntimeAgent.h:
+        * inspector/scripts/codegen/cpp_generator.py:
+        (CppGenerator.cpp_type_for_unchecked_formal_in_parameter):
+        (CppGenerator.cpp_type_for_type_with_name):
+        (CppGenerator.cpp_type_for_formal_async_parameter):
+        (CppGenerator.should_use_references_for_type):
+        (CppGenerator):
+        * inspector/scripts/codegen/cpp_generator_templates.py:
+        * inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py:
+        (CppBackendDispatcherHeaderGenerator.generate_output):
+        (CppBackendDispatcherHeaderGenerator._generate_async_handler_declaration_for_command):
+        * inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py:
+        (CppBackendDispatcherImplementationGenerator._generate_small_dispatcher_switch_implementation_for_domain):
+        (CppBackendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_command):
+        * inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py:
+        (CppFrontendDispatcherHeaderGenerator.generate_output):
+        * inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py:
+        (CppFrontendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_event):
+        * inspector/scripts/codegen/generate_cpp_protocol_types_header.py:
+        (CppProtocolTypesHeaderGenerator.generate_output):
+        (_generate_class_for_object_declaration):
+        (_generate_unchecked_setter_for_member):
+        (_generate_forward_declarations_for_binding_traits):
+        * inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py:
+        (ObjCConfigurationImplementationGenerator._generate_success_block_for_command):
+        * inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py:
+        (ObjCFrontendDispatcherImplementationGenerator._generate_event):
+        (ObjCFrontendDispatcherImplementationGenerator._generate_event_out_parameters):
+        * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py:
+        (ObjCProtocolTypesImplementationGenerator.generate_output):
+        * inspector/scripts/tests/expected/commands-with-async-attribute.json-result:
+        * inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result:
+        * inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result:
+        * inspector/scripts/tests/expected/enum-values.json-result:
+        * inspector/scripts/tests/expected/events-with-optional-parameters.json-result:
+        * inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result:
+        * inspector/scripts/tests/expected/same-type-id-different-domain.json-result:
+        * inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result:
+        * inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result:
+        * inspector/scripts/tests/expected/type-declaration-array-type.json-result:
+        * inspector/scripts/tests/expected/type-declaration-enum-type.json-result:
+        * inspector/scripts/tests/expected/type-declaration-object-type.json-result:
+        * inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result:
+        * replay/EncodedValue.cpp:
+        (JSC::EncodedValue::asObject):
+        (JSC::EncodedValue::asArray):
+        (JSC::EncodedValue::put<EncodedValue>):
+        (JSC::EncodedValue::append<EncodedValue>):
+        (JSC::EncodedValue::get<EncodedValue>):
+        * replay/EncodedValue.h:
+        * replay/scripts/CodeGeneratorReplayInputs.py:
+        (Type.borrow_type):
+        (Type.argument_type):
+        (Generator.generate_member_move_expression):
+        * runtime/ConsoleClient.cpp:
+        (JSC::ConsoleClient::printConsoleMessageWithArguments):
+        (JSC::ConsoleClient::internalMessageWithTypeAndLevel):
+        (JSC::ConsoleClient::logWithLevel):
+        (JSC::ConsoleClient::clear):
+        (JSC::ConsoleClient::dir):
+        (JSC::ConsoleClient::dirXML):
+        (JSC::ConsoleClient::table):
+        (JSC::ConsoleClient::trace):
+        (JSC::ConsoleClient::assertCondition):
+        (JSC::ConsoleClient::group):
+        (JSC::ConsoleClient::groupCollapsed):
+        (JSC::ConsoleClient::groupEnd):
+        * runtime/ConsoleClient.h:
+        * runtime/TypeSet.cpp:
+        (JSC::TypeSet::allStructureRepresentations):
+        (JSC::TypeSet::inspectorTypeSet):
+        (JSC::StructureShape::inspectorRepresentation):
+        * runtime/TypeSet.h:
+
 2015-01-07  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r178039.
index d046ab2..9e2251d 100644 (file)
@@ -98,7 +98,7 @@ bool ScriptValue::isFunction() const
 }
 
 #if ENABLE(INSPECTOR)
-static PassRefPtr<InspectorValue> jsToInspectorValue(ExecState* scriptState, JSValue value, int maxDepth)
+static RefPtr<InspectorValue> jsToInspectorValue(ExecState* scriptState, JSValue value, int maxDepth)
 {
     if (!value) {
         ASSERT_NOT_REACHED();
@@ -123,7 +123,7 @@ static PassRefPtr<InspectorValue> jsToInspectorValue(ExecState* scriptState, JSV
 
     if (value.isObject()) {
         if (isJSArray(value)) {
-            RefPtr<InspectorArray> inspectorArray = InspectorArray::create();
+            Ref<InspectorArray> inspectorArray = InspectorArray::create();
             JSArray* array = asArray(value);
             unsigned length = array->length();
             for (unsigned i = 0; i < length; i++) {
@@ -131,11 +131,11 @@ static PassRefPtr<InspectorValue> jsToInspectorValue(ExecState* scriptState, JSV
                 RefPtr<InspectorValue> elementValue = jsToInspectorValue(scriptState, element, maxDepth);
                 if (!elementValue)
                     return nullptr;
-                inspectorArray->pushValue(elementValue);
+                inspectorArray->pushValue(WTF::move(elementValue));
             }
-            return inspectorArray;
+            return WTF::move(inspectorArray);
         }
-        RefPtr<InspectorObject> inspectorObject = InspectorObject::create();
+        Ref<InspectorObject> inspectorObject = InspectorObject::create();
         JSObject* object = value.getObject();
         PropertyNameArray propertyNames(scriptState);
         object->methodTable()->getOwnPropertyNames(object, scriptState, propertyNames, ExcludeDontEnumProperties);
@@ -145,16 +145,16 @@ static PassRefPtr<InspectorValue> jsToInspectorValue(ExecState* scriptState, JSV
             RefPtr<InspectorValue> inspectorValue = jsToInspectorValue(scriptState, propertyValue, maxDepth);
             if (!inspectorValue)
                 return nullptr;
-            inspectorObject->setValue(name.string(), inspectorValue);
+            inspectorObject->setValue(name.string(), WTF::move(inspectorValue));
         }
-        return inspectorObject;
+        return WTF::move(inspectorObject);
     }
 
     ASSERT_NOT_REACHED();
     return nullptr;
 }
 
-PassRefPtr<InspectorValue> ScriptValue::toInspectorValue(ExecState* scriptState) const
+RefPtr<InspectorValue> ScriptValue::toInspectorValue(ExecState* scriptState) const
 {
     JSLockHolder holder(scriptState);
     return jsToInspectorValue(scriptState, m_value.get(), InspectorValue::maxDepth);
index d5fade9..fef7702 100644 (file)
@@ -66,7 +66,7 @@ public:
     bool operator==(const ScriptValue& other) const { return m_value == other.m_value; }
 
 #if ENABLE(INSPECTOR)
-    PassRefPtr<Inspector::InspectorValue> toInspectorValue(JSC::ExecState*) const;
+    RefPtr<Inspector::InspectorValue> toInspectorValue(JSC::ExecState*) const;
 #endif
 
 private:
index f7d1e55..202e164 100644 (file)
@@ -181,10 +181,11 @@ static Inspector::Protocol::Console::ConsoleMessage::Level messageLevelValue(Mes
 
 void ConsoleMessage::addToFrontend(InspectorConsoleFrontendDispatcher* consoleFrontendDispatcher, Inspector::InjectedScriptManager* injectedScriptManager, bool generatePreview)
 {
-    RefPtr<Inspector::Protocol::Console::ConsoleMessage> jsonObj = Inspector::Protocol::Console::ConsoleMessage::create()
+    Ref<Inspector::Protocol::Console::ConsoleMessage> jsonObj = Inspector::Protocol::Console::ConsoleMessage::create()
         .setSource(messageSourceValue(m_source))
         .setLevel(messageLevelValue(m_level))
-        .setText(m_message);
+        .setText(m_message)
+        .release();
 
     // FIXME: only send out type for ConsoleAPI source messages.
     jsonObj->setType(messageTypeValue(m_type));
@@ -199,7 +200,7 @@ void ConsoleMessage::addToFrontend(InspectorConsoleFrontendDispatcher* consoleFr
     if (m_arguments && m_arguments->argumentCount()) {
         InjectedScript injectedScript = injectedScriptManager->injectedScriptFor(m_arguments->globalState());
         if (!injectedScript.hasNoValue()) {
-            RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::RemoteObject>> jsonArgs = Inspector::Protocol::Array<Inspector::Protocol::Runtime::RemoteObject>::create();
+            Ref<Inspector::Protocol::Array<Inspector::Protocol::Runtime::RemoteObject>> jsonArgs = Inspector::Protocol::Array<Inspector::Protocol::Runtime::RemoteObject>::create();
             if (m_type == MessageType::Table && generatePreview && m_arguments->argumentCount()) {
                 Deprecated::ScriptValue table = m_arguments->argumentAt(0);
                 Deprecated::ScriptValue columns = m_arguments->argumentCount() > 1 ? m_arguments->argumentAt(1) : Deprecated::ScriptValue();
@@ -208,7 +209,7 @@ void ConsoleMessage::addToFrontend(InspectorConsoleFrontendDispatcher* consoleFr
                     ASSERT_NOT_REACHED();
                     return;
                 }
-                jsonArgs->addItem(inspectorValue);
+                jsonArgs->addItem(inspectorValue.copyRef());
             } else {
                 for (unsigned i = 0; i < m_arguments->argumentCount(); ++i) {
                     RefPtr<Inspector::Protocol::Runtime::RemoteObject> inspectorValue = injectedScript.wrapObject(m_arguments->argumentAt(i), ASCIILiteral("console"), generatePreview);
@@ -216,17 +217,17 @@ void ConsoleMessage::addToFrontend(InspectorConsoleFrontendDispatcher* consoleFr
                         ASSERT_NOT_REACHED();
                         return;
                     }
-                    jsonArgs->addItem(inspectorValue);
+                    jsonArgs->addItem(inspectorValue.copyRef());
                 }
             }
-            jsonObj->setParameters(jsonArgs);
+            jsonObj->setParameters(WTF::move(jsonArgs));
         }
     }
 
     if (m_callStack)
         jsonObj->setStackTrace(m_callStack->buildInspectorArray());
 
-    consoleFrontendDispatcher->messageAdded(jsonObj);
+    consoleFrontendDispatcher->messageAdded(WTF::move(jsonObj));
 }
 
 void ConsoleMessage::updateRepeatCountInConsole(InspectorConsoleFrontendDispatcher* consoleFrontendDispatcher)
index 8e57637..f5df0bf 100644 (file)
@@ -120,7 +120,7 @@ std::unique_ptr<Vector<size_t>> lineEndings(const String& text)
     return result;
 }
 
-static PassRefPtr<Inspector::Protocol::GenericTypes::SearchMatch> buildObjectForSearchMatch(size_t lineNumber, const String& lineContent)
+static Ref<Inspector::Protocol::GenericTypes::SearchMatch> buildObjectForSearchMatch(size_t lineNumber, const String& lineContent)
 {
     return Inspector::Protocol::GenericTypes::SearchMatch::create()
         .setLineNumber(lineNumber)
@@ -153,15 +153,17 @@ int countRegularExpressionMatches(const JSC::Yarr::RegularExpression& regex, con
     return result;
 }
 
-PassRefPtr<Inspector::Protocol::Array<Inspector::Protocol::GenericTypes::SearchMatch>> searchInTextByLines(const String& text, const String& query, const bool caseSensitive, const bool isRegex)
+Ref<Inspector::Protocol::Array<Inspector::Protocol::GenericTypes::SearchMatch>> searchInTextByLines(const String& text, const String& query, const bool caseSensitive, const bool isRegex)
 {
-    RefPtr<Inspector::Protocol::Array<Inspector::Protocol::GenericTypes::SearchMatch>> result = Inspector::Protocol::Array<Inspector::Protocol::GenericTypes::SearchMatch>::create();
+    Ref<Inspector::Protocol::Array<Inspector::Protocol::GenericTypes::SearchMatch>> result = Inspector::Protocol::Array<Inspector::Protocol::GenericTypes::SearchMatch>::create();
 
     JSC::Yarr::RegularExpression regex = ContentSearchUtilities::createSearchRegex(query, caseSensitive, isRegex);
     Vector<std::pair<size_t, String>> matches = getRegularExpressionMatchesByLines(regex, text);
 
-    for (const auto& match : matches)
-        result->addItem(buildObjectForSearchMatch(match.first, match.second));
+    for (const auto& match : matches) {
+        Ref<Inspector::Protocol::GenericTypes::SearchMatch> matchObject = buildObjectForSearchMatch(match.first, match.second);
+        result->addItem(WTF::move(matchObject));
+    }
 
     return result;
 }
index 988a0f2..b3b6161 100644 (file)
@@ -46,7 +46,7 @@ namespace ContentSearchUtilities {
 
 JS_EXPORT_PRIVATE JSC::Yarr::RegularExpression createSearchRegex(const String& query, bool caseSensitive, bool isRegex);
 JS_EXPORT_PRIVATE int countRegularExpressionMatches(const JSC::Yarr::RegularExpression&, const String&);
-JS_EXPORT_PRIVATE PassRefPtr<Inspector::Protocol::Array<Inspector::Protocol::GenericTypes::SearchMatch>> searchInTextByLines(const String& text, const String& query, const bool caseSensitive, const bool isRegex);
+JS_EXPORT_PRIVATE Ref<Inspector::Protocol::Array<Inspector::Protocol::GenericTypes::SearchMatch>> searchInTextByLines(const String& text, const String& query, const bool caseSensitive, const bool isRegex);
 JS_EXPORT_PRIVATE TextPosition textPositionFromOffset(size_t offset, const Vector<size_t>& lineEndings);
 JS_EXPORT_PRIVATE std::unique_ptr<Vector<size_t>> lineEndings(const String&);
 
index 95fa75d..3b83d08 100644 (file)
@@ -106,7 +106,7 @@ void InjectedScript::getFunctionDetails(ErrorString& errorString, const String&
         return;
     }
 
-    *result = BindingTraits<Inspector::Protocol::Debugger::FunctionDetails>::runtimeCast(resultValue);
+    *result = BindingTraits<Inspector::Protocol::Debugger::FunctionDetails>::runtimeCast(WTF::move(resultValue));
 }
 
 void InjectedScript::getProperties(ErrorString& errorString, const String& objectId, bool ownProperties, RefPtr<Array<Inspector::Protocol::Runtime::PropertyDescriptor>>* properties)
@@ -122,7 +122,7 @@ void InjectedScript::getProperties(ErrorString& errorString, const String& objec
         return;
     }
 
-    *properties = BindingTraits<Array<Inspector::Protocol::Runtime::PropertyDescriptor>>::runtimeCast(result);
+    *properties = BindingTraits<Array<Inspector::Protocol::Runtime::PropertyDescriptor>>::runtimeCast(WTF::move(result));
 }
 
 void InjectedScript::getInternalProperties(ErrorString& errorString, const String& objectId, RefPtr<Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>* properties)
@@ -137,12 +137,12 @@ void InjectedScript::getInternalProperties(ErrorString& errorString, const Strin
         return;
     }
 
-    auto array = BindingTraits<Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>::runtimeCast(result);
+    auto array = BindingTraits<Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>::runtimeCast(WTF::move(result));
     if (array->length() > 0)
         *properties = array;
 }
 
-PassRefPtr<Array<Inspector::Protocol::Debugger::CallFrame>> InjectedScript::wrapCallFrames(const Deprecated::ScriptValue& callFrames)
+Ref<Array<Inspector::Protocol::Debugger::CallFrame>> InjectedScript::wrapCallFrames(const Deprecated::ScriptValue& callFrames)
 {
     ASSERT(!hasNoValue());
     Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("wrapCallFrames"), inspectorEnvironment()->functionCallHandler());
@@ -153,12 +153,12 @@ PassRefPtr<Array<Inspector::Protocol::Debugger::CallFrame>> InjectedScript::wrap
     ASSERT(!hadException);
     RefPtr<InspectorValue> result = callFramesValue.toInspectorValue(scriptState());
     if (result->type() == InspectorValue::Type::Array)
-        return BindingTraits<Array<Inspector::Protocol::Debugger::CallFrame>>::runtimeCast(result);
+        return BindingTraits<Array<Inspector::Protocol::Debugger::CallFrame>>::runtimeCast(WTF::move(result)).releaseNonNull();
 
     return Array<Inspector::Protocol::Debugger::CallFrame>::create();
 }
 
-PassRefPtr<Inspector::Protocol::Runtime::RemoteObject> InjectedScript::wrapObject(const Deprecated::ScriptValue& value, const String& groupName, bool generatePreview) const
+RefPtr<Inspector::Protocol::Runtime::RemoteObject> InjectedScript::wrapObject(const Deprecated::ScriptValue& value, const String& groupName, bool generatePreview) const
 {
     ASSERT(!hasNoValue());
     Deprecated::ScriptFunctionCall wrapFunction(injectedScriptObject(), ASCIILiteral("wrapObject"), inspectorEnvironment()->functionCallHandler());
@@ -179,7 +179,7 @@ PassRefPtr<Inspector::Protocol::Runtime::RemoteObject> InjectedScript::wrapObjec
     return BindingTraits<Inspector::Protocol::Runtime::RemoteObject>::runtimeCast(resultObject);
 }
 
-PassRefPtr<Inspector::Protocol::Runtime::RemoteObject> InjectedScript::wrapTable(const Deprecated::ScriptValue& table, const Deprecated::ScriptValue& columns) const
+RefPtr<Inspector::Protocol::Runtime::RemoteObject> InjectedScript::wrapTable(const Deprecated::ScriptValue& table, const Deprecated::ScriptValue& columns) const
 {
     ASSERT(!hasNoValue());
     Deprecated::ScriptFunctionCall wrapFunction(injectedScriptObject(), ASCIILiteral("wrapTable"), inspectorEnvironment()->functionCallHandler());
index 42c790d..29092b0 100644 (file)
@@ -62,9 +62,9 @@ public:
     void getProperties(ErrorString&, const String& objectId, bool ownProperties, RefPtr<Protocol::Array<Protocol::Runtime::PropertyDescriptor>>* result);
     void getInternalProperties(ErrorString&, const String& objectId, RefPtr<Protocol::Array<Protocol::Runtime::InternalPropertyDescriptor>>* result);
 
-    PassRefPtr<Protocol::Array<Protocol::Debugger::CallFrame>> wrapCallFrames(const Deprecated::ScriptValue&);
-    PassRefPtr<Protocol::Runtime::RemoteObject> wrapObject(const Deprecated::ScriptValue&, const String& groupName, bool generatePreview = false) const;
-    PassRefPtr<Protocol::Runtime::RemoteObject> wrapTable(const Deprecated::ScriptValue& table, const Deprecated::ScriptValue& columns) const;
+    Ref<Protocol::Array<Protocol::Debugger::CallFrame>> wrapCallFrames(const Deprecated::ScriptValue&);
+    RefPtr<Protocol::Runtime::RemoteObject> wrapObject(const Deprecated::ScriptValue&, const String& groupName, bool generatePreview = false) const;
+    RefPtr<Protocol::Runtime::RemoteObject> wrapTable(const Deprecated::ScriptValue& table, const Deprecated::ScriptValue& columns) const;
 
     void setExceptionValue(const Deprecated::ScriptValue&);
     void clearExceptionValue();
index dd1298c..7de0519 100644 (file)
@@ -135,15 +135,20 @@ void InjectedScriptBase::makeEvalCall(ErrorString& errorString, Deprecated::Scri
         return;
     }
 
-    RefPtr<InspectorObject> resultObject = resultPair->getObject(ASCIILiteral("result"));
-    bool wasThrownVal = false;
-    if (!resultObject || !resultPair->getBoolean(ASCIILiteral("wasThrown"), wasThrownVal)) {
+    RefPtr<InspectorObject> resultObject;
+    if (!resultPair->getObject(ASCIILiteral("result"), resultObject)) {
+        errorString = ASCIILiteral("Internal error: result is not a pair of value and wasThrown flag");
+        return;
+    }
+
+    bool wasThrownValue = false;
+    if (!resultPair->getBoolean(ASCIILiteral("wasThrown"), wasThrownValue)) {
         errorString = ASCIILiteral("Internal error: result is not a pair of value and wasThrown flag");
         return;
     }
 
     *objectResult = BindingTraits<Protocol::Runtime::RemoteObject>::runtimeCast(resultObject);
-    *wasThrown = wasThrownVal;
+    *wasThrown = wasThrownValue;
 }
 
 } // namespace Inspector
index dbe793e..895a096 100644 (file)
@@ -36,8 +36,8 @@
 
 namespace Inspector {
 
-InspectorBackendDispatcher::CallbackBase::CallbackBase(PassRefPtr<InspectorBackendDispatcher> backendDispatcher, int id)
-    : m_backendDispatcher(backendDispatcher)
+InspectorBackendDispatcher::CallbackBase::CallbackBase(Ref<InspectorBackendDispatcher>&& backendDispatcher, int id)
+    : m_backendDispatcher(WTF::move(backendDispatcher))
     , m_id(id)
     , m_alreadySent(false)
 {
@@ -54,18 +54,18 @@ void InspectorBackendDispatcher::CallbackBase::sendFailure(const ErrorString& er
     sendIfActive(nullptr, error);
 }
 
-void InspectorBackendDispatcher::CallbackBase::sendIfActive(PassRefPtr<InspectorObject> partialMessage, const ErrorString& invocationError)
+void InspectorBackendDispatcher::CallbackBase::sendIfActive(RefPtr<InspectorObject>&& partialMessage, const ErrorString& invocationError)
 {
     if (m_alreadySent)
         return;
 
-    m_backendDispatcher->sendResponse(m_id, partialMessage, invocationError);
+    m_backendDispatcher->sendResponse(m_id, WTF::move(partialMessage), invocationError);
     m_alreadySent = true;
 }
 
-PassRefPtr<InspectorBackendDispatcher> InspectorBackendDispatcher::create(InspectorFrontendChannel* inspectorFrontendChannel)
+Ref<InspectorBackendDispatcher> InspectorBackendDispatcher::create(InspectorFrontendChannel* inspectorFrontendChannel)
 {
-    return adoptRef(new InspectorBackendDispatcher(inspectorFrontendChannel));
+    return adoptRef(*new InspectorBackendDispatcher(inspectorFrontendChannel));
 }
 
 void InspectorBackendDispatcher::registerDispatcherForDomain(const String& domain, InspectorSupplementalBackendDispatcher* dispatcher)
@@ -90,8 +90,8 @@ void InspectorBackendDispatcher::dispatch(const String& message)
         return;
     }
 
-    RefPtr<InspectorValue> callIdValue = messageObject->get(ASCIILiteral("id"));
-    if (!callIdValue) {
+    RefPtr<InspectorValue> callIdValue;
+    if (!messageObject->getValue(ASCIILiteral("id"), callIdValue)) {
         reportProtocolError(nullptr, InvalidRequest, ASCIILiteral("'id' property was not found"));
         return;
     }
@@ -102,8 +102,8 @@ void InspectorBackendDispatcher::dispatch(const String& message)
         return;
     }
 
-    RefPtr<InspectorValue> methodValue = messageObject->get(ASCIILiteral("method"));
-    if (!methodValue) {
+    RefPtr<InspectorValue> methodValue;
+    if (!messageObject->getValue(ASCIILiteral("method"), methodValue)) {
         reportProtocolError(&callId, InvalidRequest, ASCIILiteral("'method' property wasn't found"));
         return;
     }
@@ -128,10 +128,10 @@ void InspectorBackendDispatcher::dispatch(const String& message)
     }
 
     String domainMethod = method.substring(position + 1);
-    domainDispatcher->dispatch(callId, domainMethod, messageObject.release());
+    domainDispatcher->dispatch(callId, domainMethod, messageObject.releaseNonNull());
 }
 
-void InspectorBackendDispatcher::sendResponse(long callId, PassRefPtr<InspectorObject> result, const ErrorString& invocationError)
+void InspectorBackendDispatcher::sendResponse(long callId, RefPtr<InspectorObject>&& result, const ErrorString& invocationError)
 {
     if (!m_inspectorFrontendChannel)
         return;
@@ -141,7 +141,7 @@ void InspectorBackendDispatcher::sendResponse(long callId, PassRefPtr<InspectorO
         return;
     }
 
-    RefPtr<InspectorObject> responseMessage = InspectorObject::create();
+    Ref<InspectorObject> responseMessage = InspectorObject::create();
     responseMessage->setObject(ASCIILiteral("result"), result);
     responseMessage->setInteger(ASCIILiteral("id"), callId);
     m_inspectorFrontendChannel->sendMessageToFrontend(responseMessage->toJSONString());
@@ -152,7 +152,7 @@ void InspectorBackendDispatcher::reportProtocolError(const long* const callId, C
     reportProtocolError(callId, errorCode, errorMessage, nullptr);
 }
 
-void InspectorBackendDispatcher::reportProtocolError(const long* const callId, CommonErrorCode errorCode, const String& errorMessage, PassRefPtr<InspectorArray> data) const
+void InspectorBackendDispatcher::reportProtocolError(const long* const callId, CommonErrorCode errorCode, const String& errorMessage, RefPtr<Inspector::Protocol::Array<String>>&& data) const
 {
     static const int errorCodes[] = {
         -32700, // ParseError
@@ -163,21 +163,21 @@ void InspectorBackendDispatcher::reportProtocolError(const long* const callId, C
         -32000, // ServerError
     };
 
-    ASSERT(errorCode >= 0);
-    ASSERT((unsigned)errorCode < WTF_ARRAY_LENGTH(errorCodes));
-    ASSERT(errorCodes[errorCode]);
+    ASSERT_ARG(errorCode, errorCode >= 0);
+    ASSERT_ARG(errorCode, (unsigned)errorCode < WTF_ARRAY_LENGTH(errorCodes));
+    ASSERT_ARG(errorCode, errorCodes[errorCode]);
 
     if (!m_inspectorFrontendChannel)
         return;
 
-    RefPtr<InspectorObject> error = InspectorObject::create();
+    Ref<InspectorObject> error = InspectorObject::create();
     error->setInteger(ASCIILiteral("code"), errorCodes[errorCode]);
     error->setString(ASCIILiteral("message"), errorMessage);
     if (data)
-        error->setArray(ASCIILiteral("data"), data);
+        error->setArray(ASCIILiteral("data"), WTF::move(data));
 
-    RefPtr<InspectorObject> message = InspectorObject::create();
-    message->setObject(ASCIILiteral("error"), error.release());
+    Ref<InspectorObject> message = InspectorObject::create();
+    message->setObject(ASCIILiteral("error"), WTF::move(error));
     if (callId)
         message->setInteger(ASCIILiteral("id"), *callId);
     else
@@ -187,37 +187,36 @@ void InspectorBackendDispatcher::reportProtocolError(const long* const callId, C
 }
 
 template<typename ReturnValueType, typename ValueType, typename DefaultValueType>
-static ReturnValueType getPropertyValue(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors, DefaultValueType defaultValue, bool (*asMethod)(InspectorValue&, ValueType&), const char* typeName)
+static ReturnValueType getPropertyValue(InspectorObject* object, const String& name, bool* out_optionalValueFound, Inspector::Protocol::Array<String>& protocolErrors, DefaultValueType defaultValue, bool (*asMethod)(InspectorValue&, ValueType&), const char* typeName)
 {
-    ASSERT(protocolErrors);
-
-    ValueType value = defaultValue;
-    if (valueFound)
-        *valueFound = false;
+    ValueType result = defaultValue;
+    // out_optionalValueFound signals to the caller whether an optional property was found.
+    // if out_optionalValueFound == nullptr, then this is a required property.
+    if (out_optionalValueFound)
+        *out_optionalValueFound = false;
 
     if (!object) {
-        if (!valueFound)
-            protocolErrors->pushString(String::format("'params' object must contain required parameter '%s' with type '%s'.", name.utf8().data(), typeName));
-        return value;
+        if (!out_optionalValueFound)
+            protocolErrors.addItem(String::format("'params' object must contain required parameter '%s' with type '%s'.", name.utf8().data(), typeName));
+        return result;
     }
 
-    InspectorObject::const_iterator end = object->end();
-    InspectorObject::const_iterator valueIterator = object->find(name);
-    if (valueIterator == end) {
-        if (!valueFound)
-            protocolErrors->pushString(String::format("Parameter '%s' with type '%s' was not found.", name.utf8().data(), typeName));
-        return value;
+    auto findResult = object->find(name);
+    if (findResult == object->end()) {
+        if (!out_optionalValueFound)
+            protocolErrors.addItem(String::format("Parameter '%s' with type '%s' was not found.", name.utf8().data(), typeName));
+        return result;
     }
 
-    if (!asMethod(*valueIterator->value, value)) {
-        protocolErrors->pushString(String::format("Parameter '%s' has wrong type. It must be '%s'.", name.utf8().data(), typeName));
-        return value;
+    if (!asMethod(*findResult->value, result)) {
+        protocolErrors.addItem(String::format("Parameter '%s' has wrong type. It must be '%s'.", name.utf8().data(), typeName));
+        return result;
     }
 
-    if (valueFound)
-        *valueFound = true;
+    if (out_optionalValueFound)
+        *out_optionalValueFound = true;
 
-    return value;
+    return result;
 }
 
 struct AsMethodBridges {
@@ -230,39 +229,39 @@ struct AsMethodBridges {
     static bool asValue(InspectorValue& value, RefPtr<InspectorValue>& output) { return value.asValue(output); }
 };
 
-int InspectorBackendDispatcher::getInteger(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors)
+int InspectorBackendDispatcher::getInteger(InspectorObject* object, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors)
 {
     return getPropertyValue<int, int, int>(object, name, valueFound, protocolErrors, 0, AsMethodBridges::asInteger, "Integer");
 }
 
-double InspectorBackendDispatcher::getDouble(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors)
+double InspectorBackendDispatcher::getDouble(InspectorObject* object, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors)
 {
     return getPropertyValue<double, double, double>(object, name, valueFound, protocolErrors, 0, AsMethodBridges::asDouble, "Number");
 }
 
-String InspectorBackendDispatcher::getString(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors)
+String InspectorBackendDispatcher::getString(InspectorObject* object, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors)
 {
     return getPropertyValue<String, String, String>(object, name, valueFound, protocolErrors, "", AsMethodBridges::asString, "String");
 }
 
-bool InspectorBackendDispatcher::getBoolean(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors)
+bool InspectorBackendDispatcher::getBoolean(InspectorObject* object, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors)
 {
     return getPropertyValue<bool, bool, bool>(object, name, valueFound, protocolErrors, false, AsMethodBridges::asBoolean, "Boolean");
 }
 
-PassRefPtr<InspectorObject> InspectorBackendDispatcher::getObject(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors)
+RefPtr<InspectorObject> InspectorBackendDispatcher::getObject(InspectorObject* object, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors)
 {
-    return getPropertyValue<PassRefPtr<InspectorObject>, RefPtr<InspectorObject>, InspectorObject*>(object, name, valueFound, protocolErrors, nullptr, AsMethodBridges::asObject, "Object");
+    return getPropertyValue<RefPtr<InspectorObject>, RefPtr<InspectorObject>, InspectorObject*>(object, name, valueFound, protocolErrors, nullptr, AsMethodBridges::asObject, "Object");
 }
 
-PassRefPtr<InspectorArray> InspectorBackendDispatcher::getArray(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors)
+RefPtr<InspectorArray> InspectorBackendDispatcher::getArray(InspectorObject* object, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors)
 {
-    return getPropertyValue<PassRefPtr<InspectorArray>, RefPtr<InspectorArray>, InspectorArray*>(object, name, valueFound, protocolErrors, nullptr, AsMethodBridges::asArray, "Array");
+    return getPropertyValue<RefPtr<InspectorArray>, RefPtr<InspectorArray>, InspectorArray*>(object, name, valueFound, protocolErrors, nullptr, AsMethodBridges::asArray, "Array");
 }
 
-PassRefPtr<InspectorValue> InspectorBackendDispatcher::getValue(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors)
+RefPtr<InspectorValue> InspectorBackendDispatcher::getValue(InspectorObject* object, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors)
 {
-    return getPropertyValue<PassRefPtr<InspectorValue>, RefPtr<InspectorValue>, InspectorValue*>(object, name, valueFound, protocolErrors, nullptr, AsMethodBridges::asValue, "Value");
+    return getPropertyValue<RefPtr<InspectorValue>, RefPtr<InspectorValue>, InspectorValue*>(object, name, valueFound, protocolErrors, nullptr, AsMethodBridges::asValue, "Value");
 }
 
 } // namespace Inspector
index a99e6ea..86cbd9e 100644 (file)
@@ -27,7 +27,7 @@
 #ifndef InspectorBackendDispatcher_h
 #define InspectorBackendDispatcher_h
 
-#include "InspectorValues.h"
+#include "InspectorProtocolTypes.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
@@ -40,30 +40,31 @@ typedef String ErrorString;
 
 class InspectorSupplementalBackendDispatcher : public RefCounted<InspectorSupplementalBackendDispatcher> {
 public:
-    InspectorSupplementalBackendDispatcher(InspectorBackendDispatcher* backendDispatcher) : m_backendDispatcher(backendDispatcher) { }
+    InspectorSupplementalBackendDispatcher(InspectorBackendDispatcher& backendDispatcher)
+        : m_backendDispatcher(backendDispatcher) { }
     virtual ~InspectorSupplementalBackendDispatcher() { }
-    virtual void dispatch(long callId, const String& method, PassRefPtr<InspectorObject> message) = 0;
+    virtual void dispatch(long callId, const String& method, Ref<InspectorObject>&& message) = 0;
 protected:
-    RefPtr<InspectorBackendDispatcher> m_backendDispatcher;
+    Ref<InspectorBackendDispatcher> m_backendDispatcher;
 };
 
 class JS_EXPORT_PRIVATE InspectorBackendDispatcher : public RefCounted<InspectorBackendDispatcher> {
 public:
-    static PassRefPtr<InspectorBackendDispatcher> create(InspectorFrontendChannel*);
+    static Ref<InspectorBackendDispatcher> create(InspectorFrontendChannel*);
 
     class JS_EXPORT_PRIVATE CallbackBase : public RefCounted<CallbackBase> {
     public:
-        CallbackBase(PassRefPtr<InspectorBackendDispatcher>, int id);
+        CallbackBase(Ref<InspectorBackendDispatcher>&&, int id);
 
         bool isActive() const;
         void sendFailure(const ErrorString&);
         void disable() { m_alreadySent = true; }
 
     protected:
-        void sendIfActive(PassRefPtr<InspectorObject> partialMessage, const ErrorString& invocationError);
+        void sendIfActive(RefPtr<InspectorObject>&& partialMessage, const ErrorString& invocationError);
 
     private:
-        RefPtr<InspectorBackendDispatcher> m_backendDispatcher;
+        Ref<InspectorBackendDispatcher> m_backendDispatcher;
         int m_id;
         bool m_alreadySent;
     };
@@ -82,17 +83,17 @@ public:
 
     void registerDispatcherForDomain(const String& domain, InspectorSupplementalBackendDispatcher*);
     void dispatch(const String& message);
-    void sendResponse(long callId, PassRefPtr<InspectorObject> result, const ErrorString& invocationError);
+    void sendResponse(long callId, RefPtr<InspectorObject>&& result, const ErrorString& invocationError);
     void reportProtocolError(const long* const callId, CommonErrorCode, const String& errorMessage) const;
-    void reportProtocolError(const long* const callId, CommonErrorCode, const String& errorMessage, PassRefPtr<InspectorArray> data) const;
-
-    static int getInteger(InspectorObject*, const String& name, bool* valueFound, InspectorArray* protocolErrors);
-    static double getDouble(InspectorObject*, const String& name, bool* valueFound, InspectorArray* protocolErrors);
-    static String getString(InspectorObject*, const String& name, bool* valueFound, InspectorArray* protocolErrors);
-    static bool getBoolean(InspectorObject*, const String& name, bool* valueFound, InspectorArray* protocolErrors);
-    static PassRefPtr<InspectorValue> getValue(InspectorObject*, const String& name, bool* valueFound, InspectorArray* protocolErrors);
-    static PassRefPtr<InspectorObject> getObject(InspectorObject*, const String& name, bool* valueFound, InspectorArray* protocolErrors);
-    static PassRefPtr<InspectorArray> getArray(InspectorObject*, const String& name, bool* valueFound, InspectorArray* protocolErrors);
+    void reportProtocolError(const long* const callId, CommonErrorCode, const String& errorMessage, RefPtr<Inspector::Protocol::Array<String>>&& data) const;
+
+    static int getInteger(InspectorObject*, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors);
+    static double getDouble(InspectorObject*, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors);
+    static String getString(InspectorObject*, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors);
+    static bool getBoolean(InspectorObject*, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors);
+    static RefPtr<InspectorValue> getValue(InspectorObject*, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors);
+    static RefPtr<InspectorObject> getObject(InspectorObject*, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors);
+    static RefPtr<InspectorArray> getArray(InspectorObject*, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors);
 
 private:
     InspectorBackendDispatcher(InspectorFrontendChannel* inspectorFrontendChannel) : m_inspectorFrontendChannel(inspectorFrontendChannel) { }
index ae2a7cd..18df142 100644 (file)
@@ -51,7 +51,7 @@ public:
     virtual void willCallInjectedScriptFunction(JSC::ExecState*, const String& scriptName, int scriptLine) = 0;
     virtual void didCallInjectedScriptFunction(JSC::ExecState*) = 0;
     virtual void frontendInitialized() = 0;
-    virtual PassRefPtr<WTF::Stopwatch> executionStopwatch() = 0;
+    virtual Ref<WTF::Stopwatch> executionStopwatch() = 0;
 };
 
 } // namespace Inspector
index 143def8..296f3a8 100644 (file)
 
 #include "InspectorValues.h"
 #include <wtf/Assertions.h>
-#include <wtf/PassRefPtr.h>
 
 namespace Inspector {
 
 namespace Protocol {
 
+template<typename T> struct BindingTraits;
+
 template<typename T>
 class OptOutput {
 public:
@@ -63,126 +64,42 @@ private:
     WTF_MAKE_NONCOPYABLE(OptOutput);
 };
 
-// This class provides "Traits" type for the input type T. It is programmed using C++ template specialization
-// technique. By default it simply takes "ItemTraits" type from T, but it doesn't work with the base types.
-template<typename T>
-struct ArrayItemHelper {
-    typedef typename T::ItemTraits Traits;
-};
-
 template<typename T>
 class Array : public InspectorArrayBase {
 private:
     Array() { }
 
-    InspectorArray* openAccessors()
+    InspectorArray& openAccessors()
     {
         COMPILE_ASSERT(sizeof(InspectorArray) == sizeof(Array<T>), cannot_cast);
-        return static_cast<InspectorArray*>(static_cast<InspectorArrayBase*>(this));
+        return *static_cast<InspectorArray*>(static_cast<InspectorArrayBase*>(this));
     }
 
 public:
-    void addItem(PassRefPtr<T> value)
+    void addItem(Ref<T>&& value)
     {
-        ArrayItemHelper<T>::Traits::pushRefPtr(this->openAccessors(), value);
+        openAccessors().pushValue(&value.get());
     }
 
-    void addItem(T value)
+    void addItem(RefPtr<T>&& value)
     {
-        ArrayItemHelper<T>::Traits::pushRaw(this->openAccessors(), value);
+        openAccessors().pushValue(WTF::move(value));
     }
-
-    static PassRefPtr<Array<T>> create()
+    
+    void addItem(const String& value)
     {
-        return adoptRef(new Array<T>());
+        openAccessors().pushString(value);
     }
-};
 
-struct StructItemTraits {
-    static void pushRefPtr(InspectorArray* array, PassRefPtr<InspectorValue> value)
+    void addItem(int value)
     {
-        array->pushValue(value);
+        openAccessors().pushInteger(value);
+    }
+    
+    static Ref<Array<T>> create()
+    {
+        return adoptRef(*new Array<T>());
     }
-};
-
-template<>
-struct ArrayItemHelper<String> {
-    struct Traits {
-        static void pushRaw(InspectorArray* array, const String& value)
-        {
-            array->pushString(value);
-        }
-    };
-};
-
-template<>
-struct ArrayItemHelper<int> {
-    struct Traits {
-        static void pushRaw(InspectorArray* array, int value)
-        {
-            array->pushInteger(value);
-        }
-    };
-};
-
-template<>
-struct ArrayItemHelper<double> {
-    struct Traits {
-        static void pushRaw(InspectorArray* array, double value)
-        {
-            array->pushDouble(value);
-        }
-    };
-};
-
-template<>
-struct ArrayItemHelper<bool> {
-    struct Traits {
-        static void pushRaw(InspectorArray* array, bool value)
-        {
-            array->pushBoolean(value);
-        }
-    };
-};
-
-template<>
-struct ArrayItemHelper<InspectorValue> {
-    struct Traits {
-        static void pushRefPtr(InspectorArray* array, PassRefPtr<InspectorValue> value)
-        {
-            array->pushValue(value);
-        }
-    };
-};
-
-template<>
-struct ArrayItemHelper<InspectorObject> {
-    struct Traits {
-        static void pushRefPtr(InspectorArray* array, PassRefPtr<InspectorValue> value)
-        {
-            array->pushValue(value);
-        }
-    };
-};
-
-template<>
-struct ArrayItemHelper<InspectorArray> {
-    struct Traits {
-        static void pushRefPtr(InspectorArray* array, PassRefPtr<InspectorArray> value)
-        {
-            array->pushArray(value);
-        }
-    };
-};
-
-template<typename T>
-struct ArrayItemHelper<Protocol::Array<T>> {
-    struct Traits {
-        static void pushRefPtr(InspectorArray* array, PassRefPtr<Protocol::Array<T>> value)
-        {
-            array->pushValue(value);
-        }
-    };
 };
 
 // Helper methods for Protocol and other Inspector types are provided by
@@ -192,8 +109,9 @@ template<typename T>
 struct BindingTraits {
     typedef T BindingType;
 
+    static void push(InspectorArray&, BindingType&);
     static InspectorValue::Type typeTag();
-    static PassRefPtr<T> runtimeCast(PassRefPtr<InspectorObject>);
+    static RefPtr<T> runtimeCast(RefPtr<InspectorObject>&&);
 #if !ASSERT_DISABLED
     static void assertValueHasExpectedType(InspectorValue*);
 #endif // !ASSERT_DISABLED
@@ -204,15 +122,16 @@ struct PrimitiveBindingTraits {
 #if !ASSERT_DISABLED
     static void assertValueHasExpectedType(InspectorValue* value)
     {
-        ASSERT(value->type() == TYPE);
+        ASSERT_ARG(value, value && value->type() == TYPE);
     }
 #endif // !ASSERT_DISABLED
 };
 
 template<typename T>
 struct BindingTraits<Protocol::Array<T>> {
-    static PassRefPtr<Array<T>> runtimeCast(PassRefPtr<InspectorValue> value)
+    static RefPtr<Array<T>> runtimeCast(RefPtr<InspectorValue>&& value)
     {
+        ASSERT_ARG(value, value);
         RefPtr<InspectorArray> array;
         bool castSucceeded = value->asArray(array);
         ASSERT_UNUSED(castSucceeded, castSucceeded);
@@ -226,6 +145,7 @@ struct BindingTraits<Protocol::Array<T>> {
 #if !ASSERT_DISABLED
     static void assertValueHasExpectedType(InspectorValue* value)
     {
+        ASSERT_ARG(value, value);
         RefPtr<InspectorArray> array;
         bool castSucceeded = value->asArray(array);
         ASSERT_UNUSED(castSucceeded, castSucceeded);
index 2a2a0bc..42a6b5f 100644 (file)
@@ -347,7 +347,7 @@ bool decodeString(const UChar* start, const UChar* end, String& output)
     return true;
 }
 
-PassRefPtr<InspectorValue> buildValue(const UChar* start, const UChar* end, const UChar** valueTokenEnd, int depth)
+RefPtr<InspectorValue> buildValue(const UChar* start, const UChar* end, const UChar** valueTokenEnd, int depth)
 {
     if (depth > stackLimit)
         return nullptr;
@@ -385,14 +385,14 @@ PassRefPtr<InspectorValue> buildValue(const UChar* start, const UChar* end, cons
         break;
     }
     case ARRAY_BEGIN: {
-        RefPtr<InspectorArray> array = InspectorArray::create();
+        Ref<InspectorArray> array = InspectorArray::create();
         start = tokenEnd;
         token = parseToken(start, end, &tokenStart, &tokenEnd);
         while (token != ARRAY_END) {
             RefPtr<InspectorValue> arrayNode = buildValue(start, end, &tokenEnd, depth + 1);
             if (!arrayNode)
                 return nullptr;
-            array->pushValue(arrayNode);
+            array->pushValue(WTF::move(arrayNode));
 
             // After a list value, we expect a comma or the end of the list.
             start = tokenEnd;
@@ -409,11 +409,11 @@ PassRefPtr<InspectorValue> buildValue(const UChar* start, const UChar* end, cons
         }
         if (token != ARRAY_END)
             return nullptr;
-        result = array.release();
+        result = WTF::move(array);
         break;
     }
     case OBJECT_BEGIN: {
-        RefPtr<InspectorObject> object = InspectorObject::create();
+        Ref<InspectorObject> object = InspectorObject::create();
         start = tokenEnd;
         token = parseToken(start, end, &tokenStart, &tokenEnd);
         while (token != OBJECT_END) {
@@ -432,7 +432,7 @@ PassRefPtr<InspectorValue> buildValue(const UChar* start, const UChar* end, cons
             RefPtr<InspectorValue> value = buildValue(start, end, &tokenEnd, depth + 1);
             if (!value)
                 return nullptr;
-            object->setValue(key, value);
+            object->setValue(key, WTF::move(value));
             start = tokenEnd;
 
             // After a key/value pair, we expect a comma or the end of the
@@ -450,7 +450,7 @@ PassRefPtr<InspectorValue> buildValue(const UChar* start, const UChar* end, cons
         }
         if (token != OBJECT_END)
             return nullptr;
-        result = object.release();
+        result = WTF::move(object);
         break;
     }
 
@@ -739,8 +739,8 @@ InspectorObject* InspectorObjectBase::openAccessors()
 
 bool InspectorObjectBase::getBoolean(const String& name, bool& output) const
 {
-    RefPtr<InspectorValue> value = get(name);
-    if (!value)
+    RefPtr<InspectorValue> value;
+    if (!getValue(name, value))
         return false;
 
     return value->asBoolean(output);
@@ -748,40 +748,39 @@ bool InspectorObjectBase::getBoolean(const String& name, bool& output) const
 
 bool InspectorObjectBase::getString(const String& name, String& output) const
 {
-    RefPtr<InspectorValue> value = get(name);
-    if (!value)
+    RefPtr<InspectorValue> value;
+    if (!getValue(name, value))
         return false;
+
     return value->asString(output);
 }
 
-PassRefPtr<InspectorObject> InspectorObjectBase::getObject(const String& name) const
+bool InspectorObjectBase::getObject(const String& name, RefPtr<InspectorObject>& output) const
 {
-    PassRefPtr<InspectorValue> value = get(name);
-    if (!value)
-        return nullptr;
+    RefPtr<InspectorValue> value;
+    if (!getValue(name, value))
+        return false;
 
-    RefPtr<InspectorObject> result;
-    value->asObject(result);
-    return result.release();
+    return value->asObject(output);
 }
 
-PassRefPtr<InspectorArray> InspectorObjectBase::getArray(const String& name) const
+bool InspectorObjectBase::getArray(const String& name, RefPtr<InspectorArray>& output) const
 {
-    PassRefPtr<InspectorValue> value = get(name);
-    if (!value)
-        return nullptr;
+    RefPtr<InspectorValue> value;
+    if (!getValue(name, value))
+        return false;
 
-    RefPtr<InspectorArray> result;
-    value->asArray(result);
-    return result.release();
+    return value->asArray(output);
 }
 
-PassRefPtr<InspectorValue> InspectorObjectBase::get(const String& name) const
+bool InspectorObjectBase::getValue(const String& name, RefPtr<InspectorValue>& output) const
 {
-    Dictionary::const_iterator it = m_data.find(name);
-    if (it == m_data.end())
-        return nullptr;
-    return it->value;
+    Dictionary::const_iterator findResult = m_data.find(name);
+    if (findResult == m_data.end())
+        return false;
+
+    output = findResult->value;
+    return true;
 }
 
 void InspectorObjectBase::remove(const String& name)
@@ -799,13 +798,13 @@ void InspectorObjectBase::writeJSON(StringBuilder& output) const
 {
     output.append('{');
     for (size_t i = 0; i < m_order.size(); ++i) {
-        Dictionary::const_iterator it = m_data.find(m_order[i]);
-        ASSERT(it != m_data.end());
+        auto findResult = m_data.find(m_order[i]);
+        ASSERT(findResult != m_data.end());
         if (i)
             output.append(',');
-        doubleQuoteString(it->key, output);
+        doubleQuoteString(findResult->key, output);
         output.append(':');
-        it->value->writeJSON(output);
+        findResult->value->writeJSON(output);
     }
     output.append('}');
 }
@@ -845,50 +844,50 @@ InspectorArrayBase::InspectorArrayBase()
 {
 }
 
-PassRefPtr<InspectorValue> InspectorArrayBase::get(size_t index)
+RefPtr<InspectorValue> InspectorArrayBase::get(size_t index)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(index < m_data.size());
     return m_data[index];
 }
 
-PassRefPtr<InspectorObject> InspectorObject::create()
+Ref<InspectorObject> InspectorObject::create()
 {
-    return adoptRef(new InspectorObject);
+    return adoptRef(*new InspectorObject);
 }
 
-PassRefPtr<InspectorArray> InspectorArray::create()
+Ref<InspectorArray> InspectorArray::create()
 {
-    return adoptRef(new InspectorArray);
+    return adoptRef(*new InspectorArray);
 }
 
-PassRefPtr<InspectorValue> InspectorValue::null()
+Ref<InspectorValue> InspectorValue::null()
 {
-    return adoptRef(new InspectorValue);
+    return adoptRef(*new InspectorValue);
 }
 
-PassRefPtr<InspectorString> InspectorString::create(const String& value)
+Ref<InspectorString> InspectorString::create(const String& value)
 {
-    return adoptRef(new InspectorString(value));
+    return adoptRef(*new InspectorString(value));
 }
 
-PassRefPtr<InspectorString> InspectorString::create(const char* value)
+Ref<InspectorString> InspectorString::create(const char* value)
 {
-    return adoptRef(new InspectorString(value));
+    return adoptRef(*new InspectorString(value));
 }
 
-PassRefPtr<InspectorBasicValue> InspectorBasicValue::create(bool value)
+Ref<InspectorBasicValue> InspectorBasicValue::create(bool value)
 {
-    return adoptRef(new InspectorBasicValue(value));
+    return adoptRef(*new InspectorBasicValue(value));
 }
 
-PassRefPtr<InspectorBasicValue> InspectorBasicValue::create(int value)
+Ref<InspectorBasicValue> InspectorBasicValue::create(int value)
 {
-    return adoptRef(new InspectorBasicValue(value));
+    return adoptRef(*new InspectorBasicValue(value));
 }
 
-PassRefPtr<InspectorBasicValue> InspectorBasicValue::create(double value)
+Ref<InspectorBasicValue> InspectorBasicValue::create(double value)
 {
-    return adoptRef(new InspectorBasicValue(value));
+    return adoptRef(*new InspectorBasicValue(value));
 }
 
 } // namespace Inspector
index 296af7d..baffcb0 100644 (file)
@@ -32,7 +32,7 @@
 #ifndef InspectorValues_h
 #define InspectorValues_h
 
-#include <wtf/Forward.h>
+#include <wtf/Assertions.h>
 #include <wtf/HashMap.h>
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
@@ -54,7 +54,7 @@ public:
         : m_type(Type::Null) { }
     virtual ~InspectorValue() { }
 
-    static PassRefPtr<InspectorValue> null();
+    static Ref<InspectorValue> null();
 
     enum class Type {
         Null = 0,
@@ -99,9 +99,9 @@ private:
 class JS_EXPORT_PRIVATE InspectorBasicValue : public InspectorValue {
 public:
 
-    static PassRefPtr<InspectorBasicValue> create(bool);
-    static PassRefPtr<InspectorBasicValue> create(int);
-    static PassRefPtr<InspectorBasicValue> create(double);
+    static Ref<InspectorBasicValue> create(bool);
+    static Ref<InspectorBasicValue> create(int);
+    static Ref<InspectorBasicValue> create(double);
 
     virtual bool asBoolean(bool&) const override;
     // Numbers from the frontend are always parsed as doubles, so we allow
@@ -138,8 +138,8 @@ private:
 
 class JS_EXPORT_PRIVATE InspectorString : public InspectorValue {
 public:
-    static PassRefPtr<InspectorString> create(const String&);
-    static PassRefPtr<InspectorString> create(const char*);
+    static Ref<InspectorString> create(const String&);
+    static Ref<InspectorString> create(const char*);
 
     virtual bool asString(String& output) const override;
 
@@ -177,9 +177,9 @@ protected:
     void setInteger(const String& name, int);
     void setDouble(const String& name, double);
     void setString(const String& name, const String&);
-    void setValue(const String& name, PassRefPtr<InspectorValue>);
-    void setObject(const String& name, PassRefPtr<InspectorObjectBase>);
-    void setArray(const String& name, PassRefPtr<InspectorArrayBase>);
+    void setValue(const String& name, RefPtr<InspectorValue>&&);
+    void setObject(const String& name, RefPtr<InspectorObjectBase>&&);
+    void setArray(const String& name, RefPtr<InspectorArrayBase>&&);
 
     iterator find(const String& name);
     const_iterator find(const String& name) const;
@@ -188,23 +188,25 @@ protected:
     bool getBoolean(const String& name, bool& output) const;
     template<class T> bool getDouble(const String& name, T& output) const
     {
-        RefPtr<InspectorValue> value = get(name);
-        if (!value)
+        RefPtr<InspectorValue> value;
+        if (!getValue(name, value))
             return false;
+
         return value->asDouble(output);
     }
     template<class T> bool getInteger(const String& name, T& output) const
     {
-        RefPtr<InspectorValue> value = get(name);
-        if (!value)
+        RefPtr<InspectorValue> value;
+        if (!getValue(name, value))
             return false;
+
         return value->asInteger(output);
     }
 
     bool getString(const String& name, String& output) const;
-    PassRefPtr<InspectorObject> getObject(const String& name) const;
-    PassRefPtr<InspectorArray> getArray(const String& name) const;
-    PassRefPtr<InspectorValue> get(const String& name) const;
+    bool getObject(const String& name, RefPtr<InspectorObject>&) const;
+    bool getArray(const String& name, RefPtr<InspectorArray>&) const;
+    bool getValue(const String& name, RefPtr<InspectorValue>&) const;
 
     void remove(const String& name);
 
@@ -227,7 +229,7 @@ private:
 
 class InspectorObject : public InspectorObjectBase {
 public:
-    static JS_EXPORT_PRIVATE PassRefPtr<InspectorObject> create();
+    static JS_EXPORT_PRIVATE Ref<InspectorObject> create();
 
     using InspectorObjectBase::asObject;
 
@@ -246,7 +248,7 @@ public:
     using InspectorObjectBase::getString;
     using InspectorObjectBase::getObject;
     using InspectorObjectBase::getArray;
-    using InspectorObjectBase::get;
+    using InspectorObjectBase::getValue;
 
     using InspectorObjectBase::remove;
 
@@ -273,11 +275,11 @@ protected:
     void pushInteger(int);
     void pushDouble(double);
     void pushString(const String&);
-    void pushValue(PassRefPtr<InspectorValue>);
-    void pushObject(PassRefPtr<InspectorObject>);
-    void pushArray(PassRefPtr<InspectorArray>);
+    void pushValue(RefPtr<InspectorValue>&&);
+    void pushObject(RefPtr<InspectorObjectBase>&&);
+    void pushArray(RefPtr<InspectorArrayBase>&&);
 
-    PassRefPtr<InspectorValue> get(size_t index);
+    RefPtr<InspectorValue> get(size_t index);
 
     virtual void writeJSON(StringBuilder& output) const override;
 
@@ -295,7 +297,7 @@ private:
 
 class InspectorArray : public InspectorArrayBase {
 public:
-    static JS_EXPORT_PRIVATE PassRefPtr<InspectorArray> create();
+    static JS_EXPORT_PRIVATE Ref<InspectorArray> create();
 
     using InspectorArrayBase::asArray;
 
@@ -344,24 +346,24 @@ inline void InspectorObjectBase::setString(const String& name, const String& val
     setValue(name, InspectorString::create(value));
 }
 
-inline void InspectorObjectBase::setValue(const String& name, PassRefPtr<InspectorValue> value)
+inline void InspectorObjectBase::setValue(const String& name, RefPtr<InspectorValue>&& value)
 {
     ASSERT(value);
-    if (m_data.set(name, value).isNewEntry)
+    if (m_data.set(name, WTF::move(value)).isNewEntry)
         m_order.append(name);
 }
 
-inline void InspectorObjectBase::setObject(const String& name, PassRefPtr<InspectorObjectBase> value)
+inline void InspectorObjectBase::setObject(const String& name, RefPtr<InspectorObjectBase>&& value)
 {
     ASSERT(value);
-    if (m_data.set(name, value).isNewEntry)
+    if (m_data.set(name, WTF::move(value)).isNewEntry)
         m_order.append(name);
 }
 
-inline void InspectorObjectBase::setArray(const String& name, PassRefPtr<InspectorArrayBase> value)
+inline void InspectorObjectBase::setArray(const String& name, RefPtr<InspectorArrayBase>&& value)
 {
     ASSERT(value);
-    if (m_data.set(name, value).isNewEntry)
+    if (m_data.set(name, WTF::move(value)).isNewEntry)
         m_order.append(name);
 }
 
@@ -385,22 +387,22 @@ inline void InspectorArrayBase::pushString(const String& value)
     m_data.append(InspectorString::create(value));
 }
 
-inline void InspectorArrayBase::pushValue(PassRefPtr<InspectorValue> value)
+inline void InspectorArrayBase::pushValue(RefPtr<InspectorValue>&& value)
 {
     ASSERT(value);
-    m_data.append(value);
+    m_data.append(WTF::move(value));
 }
 
-inline void InspectorArrayBase::pushObject(PassRefPtr<InspectorObject> value)
+inline void InspectorArrayBase::pushObject(RefPtr<InspectorObjectBase>&& value)
 {
     ASSERT(value);
-    m_data.append(value);
+    m_data.append(WTF::move(value));
 }
 
-inline void InspectorArrayBase::pushArray(PassRefPtr<InspectorArray> value)
+inline void InspectorArrayBase::pushArray(RefPtr<InspectorArrayBase>&& value)
 {
     ASSERT(value);
-    m_data.append(value);
+    m_data.append(WTF::move(value));
 }
 
 } // namespace Inspector
index 500afe2..a7fb104 100644 (file)
@@ -75,19 +75,18 @@ JSGlobalObjectConsoleClient::JSGlobalObjectConsoleClient(InspectorConsoleAgent*
     });
 }
 
-void JSGlobalObjectConsoleClient::messageWithTypeAndLevel(MessageType type, MessageLevel level, JSC::ExecState* exec, PassRefPtr<ScriptArguments> prpArguments)
+void JSGlobalObjectConsoleClient::messageWithTypeAndLevel(MessageType type, MessageLevel level, JSC::ExecState* exec, RefPtr<ScriptArguments>&& arguments)
 {
-    RefPtr<ScriptArguments> arguments = prpArguments;
 
     if (JSGlobalObjectConsoleClient::logToSystemConsole())
-        ConsoleClient::printConsoleMessageWithArguments(MessageSource::ConsoleAPI, type, level, exec, arguments);
+        ConsoleClient::printConsoleMessageWithArguments(MessageSource::ConsoleAPI, type, level, exec, arguments.copyRef());
 
     String message;
     arguments->getFirstArgumentAsString(message);
-    m_consoleAgent->addMessageToConsole(MessageSource::ConsoleAPI, type, level, message, exec, arguments.release());
+    m_consoleAgent->addMessageToConsole(MessageSource::ConsoleAPI, type, level, message, exec, WTF::move(arguments));
 }
 
-void JSGlobalObjectConsoleClient::count(ExecState* exec, PassRefPtr<ScriptArguments> arguments)
+void JSGlobalObjectConsoleClient::count(ExecState* exec, RefPtr<ScriptArguments>&& arguments)
 {
     m_consoleAgent->count(exec, arguments);
 }
@@ -110,10 +109,10 @@ void JSGlobalObjectConsoleClient::time(ExecState*, const String& title)
 void JSGlobalObjectConsoleClient::timeEnd(ExecState* exec, const String& title)
 {
     RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(exec, 1));
-    m_consoleAgent->stopTiming(title, callStack.release());
+    m_consoleAgent->stopTiming(title, WTF::move(callStack));
 }
 
-void JSGlobalObjectConsoleClient::timeStamp(ExecState*, PassRefPtr<ScriptArguments>)
+void JSGlobalObjectConsoleClient::timeStamp(ExecState*, RefPtr<ScriptArguments>&&)
 {
     // FIXME: JSContext inspection needs a timeline.
     warnUnimplemented(ASCIILiteral("console.timeStamp"));
index f4ab91e..e35e9b6 100644 (file)
@@ -43,17 +43,17 @@ public:
     static void initializeLogToSystemConsole();
 
 protected:
-    virtual void messageWithTypeAndLevel(MessageType, MessageLevel, JSC::ExecState*, PassRefPtr<ScriptArguments>) override;
-    virtual void count(JSC::ExecState*, PassRefPtr<ScriptArguments>) override;
+    virtual void messageWithTypeAndLevel(MessageType, MessageLevel, JSC::ExecState*, RefPtr<ScriptArguments>&&) override;
+    virtual void count(JSC::ExecState*, RefPtr<ScriptArguments>&&) override;
     virtual void profile(JSC::ExecState*, const String& title) override;
     virtual void profileEnd(JSC::ExecState*, const String& title) override;
     virtual void time(JSC::ExecState*, const String& title) override;
     virtual void timeEnd(JSC::ExecState*, const String& title) override;
-    virtual void timeStamp(JSC::ExecState*, PassRefPtr<ScriptArguments>) override;
+    virtual void timeStamp(JSC::ExecState*, RefPtr<ScriptArguments>&&) override;
 
 private:
     void warnUnimplemented(const String& method);
-    void internalAddMessage(MessageType, MessageLevel, JSC::ExecState*, PassRefPtr<ScriptArguments>);
+    void internalAddMessage(MessageType, MessageLevel, JSC::ExecState*, RefPtr<ScriptArguments>&&);
 
     InspectorConsoleAgent* m_consoleAgent;
 };
index bc8c4b1..b8adecb 100644 (file)
@@ -222,9 +222,9 @@ void JSGlobalObjectInspectorController::frontendInitialized()
 #endif
 }
 
-PassRefPtr<Stopwatch> JSGlobalObjectInspectorController::executionStopwatch()
+Ref<Stopwatch> JSGlobalObjectInspectorController::executionStopwatch()
 {
-    return m_executionStopwatch;
+    return m_executionStopwatch.copyRef();
 }
 
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
index a60d47b..2a02184 100644 (file)
@@ -93,7 +93,7 @@ public:
     virtual void willCallInjectedScriptFunction(JSC::ExecState*, const String&, int) override { }
     virtual void didCallInjectedScriptFunction(JSC::ExecState*) override { }
     virtual void frontendInitialized() override;
-    virtual PassRefPtr<WTF::Stopwatch> executionStopwatch() override;
+    virtual Ref<WTF::Stopwatch> executionStopwatch() override;
 
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
     virtual AugmentableInspectorControllerClient* augmentableInspectorControllerClient() const override { return m_augmentingClient; } 
@@ -115,7 +115,7 @@ private:
     InspectorAgentRegistry m_agents;
     InspectorFrontendChannel* m_inspectorFrontendChannel;
     RefPtr<InspectorBackendDispatcher> m_inspectorBackendDispatcher;
-    RefPtr<WTF::Stopwatch> m_executionStopwatch;
+    Ref<WTF::Stopwatch> m_executionStopwatch;
     bool m_includeNativeCallStackWithExceptions;
     bool m_isAutomaticInspection;
 
index 7c950e8..28c2af7 100644 (file)
@@ -58,7 +58,7 @@ bool ScriptCallFrame::isEqual(const ScriptCallFrame& o) const
 }
 
 #if ENABLE(INSPECTOR)
-PassRefPtr<Inspector::Protocol::Console::CallFrame> ScriptCallFrame::buildInspectorObject() const
+Ref<Inspector::Protocol::Console::CallFrame> ScriptCallFrame::buildInspectorObject() const
 {
     return Inspector::Protocol::Console::CallFrame::create()
         .setFunctionName(m_functionName)
index 6a9cd77..017ddd0 100644 (file)
@@ -54,7 +54,7 @@ public:
     bool isEqual(const ScriptCallFrame&) const;
 
 #if ENABLE(INSPECTOR)
-    PassRefPtr<Inspector::Protocol::Console::CallFrame> buildInspectorObject() const;
+    Ref<Inspector::Protocol::Console::CallFrame> buildInspectorObject() const;
 #endif
 
 private:
index 6f81a58..aa452ad 100644 (file)
 
 namespace Inspector {
 
-PassRefPtr<ScriptCallStack> ScriptCallStack::create()
+Ref<ScriptCallStack> ScriptCallStack::create()
 {
-    return adoptRef(new ScriptCallStack);
+    return adoptRef(*new ScriptCallStack);
 }
 
-PassRefPtr<ScriptCallStack> ScriptCallStack::create(Vector<ScriptCallFrame>& frames)
+Ref<ScriptCallStack> ScriptCallStack::create(Vector<ScriptCallFrame>& frames)
 {
-    return adoptRef(new ScriptCallStack(frames));
+    return adoptRef(*new ScriptCallStack(frames));
 }
 
 ScriptCallStack::ScriptCallStack()
@@ -107,12 +107,12 @@ bool ScriptCallStack::isEqual(ScriptCallStack* o) const
 }
 
 #if ENABLE(INSPECTOR)
-PassRefPtr<Inspector::Protocol::Array<Inspector::Protocol::Console::CallFrame>> ScriptCallStack::buildInspectorArray() const
+Ref<Inspector::Protocol::Array<Inspector::Protocol::Console::CallFrame>> ScriptCallStack::buildInspectorArray() const
 {
-    RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Console::CallFrame>> frames = Inspector::Protocol::Array<Inspector::Protocol::Console::CallFrame>::create();
+    auto frames = Inspector::Protocol::Array<Inspector::Protocol::Console::CallFrame>::create();
     for (size_t i = 0; i < m_frames.size(); i++)
         frames->addItem(m_frames.at(i).buildInspectorObject());
-    return frames;
+    return WTF::move(frames);
 }
 #endif
 
index 63e3ce1..6db7de8 100644 (file)
@@ -47,8 +47,8 @@ class JS_EXPORT_PRIVATE ScriptCallStack : public RefCounted<ScriptCallStack> {
 public:
     static const size_t maxCallStackSizeToCapture = 200;
     
-    static PassRefPtr<ScriptCallStack> create();
-    static PassRefPtr<ScriptCallStack> create(Vector<ScriptCallFrame>&);
+    static Ref<ScriptCallStack> create();
+    static Ref<ScriptCallStack> create(Vector<ScriptCallFrame>&);
 
     ~ScriptCallStack();
 
@@ -62,7 +62,7 @@ public:
     bool isEqual(ScriptCallStack*) const;
 
 #if ENABLE(INSPECTOR)
-    PassRefPtr<Inspector::Protocol::Array<Inspector::Protocol::Console::CallFrame>> buildInspectorArray() const;
+    Ref<Inspector::Protocol::Array<Inspector::Protocol::Console::CallFrame>> buildInspectorArray() const;
 #endif
 
 private:
index 765af99..4f695a7 100644 (file)
@@ -72,7 +72,7 @@ void InspectorAgent::enable(ErrorString&)
     m_enabled = true;
 
     if (m_pendingInspectData.first)
-        inspect(m_pendingInspectData.first, m_pendingInspectData.second);
+        inspect(m_pendingInspectData.first.copyRef(), m_pendingInspectData.second.copyRef());
 
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
     if (m_pendingExtraDomainsData)
@@ -99,7 +99,7 @@ void InspectorAgent::initialized(ErrorString&)
     m_environment.frontendInitialized();
 }
 
-void InspectorAgent::inspect(PassRefPtr<Protocol::Runtime::RemoteObject> objectToInspect, PassRefPtr<InspectorObject> hints)
+void InspectorAgent::inspect(RefPtr<Protocol::Runtime::RemoteObject>&& objectToInspect, RefPtr<InspectorObject>&& hints)
 {
     if (m_enabled && m_frontendDispatcher) {
         m_frontendDispatcher->inspect(objectToInspect, hints);
@@ -130,9 +130,9 @@ void InspectorAgent::activateExtraDomain(const String& domainName)
         return;
     }
 
-    RefPtr<Inspector::Protocol::Array<String>> domainNames = Inspector::Protocol::Array<String>::create();
+    Ref<Inspector::Protocol::Array<String>> domainNames = Inspector::Protocol::Array<String>::create();
     domainNames->addItem(domainName);
-    m_frontendDispatcher->activateExtraDomains(domainNames.release());
+    m_frontendDispatcher->activateExtraDomains(WTF::move(domainNames));
 }
 
 void InspectorAgent::activateExtraDomains(const Vector<String>& extraDomains)
index c90e242..730dce6 100644 (file)
@@ -61,7 +61,7 @@ public:
     virtual void disable(ErrorString&) override;
     virtual void initialized(ErrorString&) override;
 
-    void inspect(PassRefPtr<Protocol::Runtime::RemoteObject> objectToInspect, PassRefPtr<InspectorObject> hints);
+    void inspect(RefPtr<Protocol::Runtime::RemoteObject>&& objectToInspect, RefPtr<InspectorObject>&& hints);
     void evaluateForTestInFrontend(const String& script);
 
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
index 47abdfd..03bd48a 100644 (file)
@@ -141,16 +141,16 @@ bool InspectorDebuggerAgent::isPaused()
 void InspectorDebuggerAgent::handleConsoleAssert(const String& message)
 {
     if (scriptDebugServer().pauseOnExceptionsState() != JSC::Debugger::DontPauseOnExceptions) {
-        RefPtr<Inspector::Protocol::Debugger::AssertPauseReason> reason = Inspector::Protocol::Debugger::AssertPauseReason::create();
+        Ref<Inspector::Protocol::Debugger::AssertPauseReason> reason = Inspector::Protocol::Debugger::AssertPauseReason::create().release();
         if (!message.isNull())
             reason->setMessage(message);
         breakProgram(InspectorDebuggerFrontendDispatcher::Reason::Assert, reason->openAccessors());
     }
 }
 
-static PassRefPtr<InspectorObject> buildObjectForBreakpointCookie(const String& url, int lineNumber, int columnNumber, const String& condition, RefPtr<InspectorArray>& actions, bool isRegex, bool autoContinue)
+static Ref<InspectorObject> buildObjectForBreakpointCookie(const String& url, int lineNumber, int columnNumber, const String& condition, RefPtr<InspectorArray>& actions, bool isRegex, bool autoContinue)
 {
-    RefPtr<InspectorObject> breakpointObject = InspectorObject::create();
+    Ref<InspectorObject> breakpointObject = InspectorObject::create();
     breakpointObject->setString(ASCIILiteral("url"), url);
     breakpointObject->setInteger(ASCIILiteral("lineNumber"), lineNumber);
     breakpointObject->setInteger(ASCIILiteral("columnNumber"), columnNumber);
@@ -239,7 +239,7 @@ bool InspectorDebuggerAgent::breakpointActionsFromProtocol(ErrorString& errorStr
     return true;
 }
 
-void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString& errorString, int lineNumber, const String* const optionalURL, const String* const optionalURLRegex, const int* const optionalColumnNumber, const RefPtr<InspectorObject>* options, Inspector::Protocol::Debugger::BreakpointId* outBreakpointIdentifier, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Debugger::Location>>& locations)
+void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString& errorString, int lineNumber, const String* const optionalURL, const String* const optionalURLRegex, const int* const optionalColumnNumber, const RefPtr<InspectorObject>&& options, Inspector::Protocol::Debugger::BreakpointId* outBreakpointIdentifier, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Debugger::Location>>& locations)
 {
     locations = Inspector::Protocol::Array<Inspector::Protocol::Debugger::Location>::create();
     if (!optionalURL == !optionalURLRegex) {
@@ -261,9 +261,9 @@ void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString& errorString, int li
     bool autoContinue = false;
     RefPtr<InspectorArray> actions;
     if (options) {
-        (*options)->getString(ASCIILiteral("condition"), condition);
-        (*options)->getBoolean(ASCIILiteral("autoContinue"), autoContinue);
-        actions = (*options)->getArray(ASCIILiteral("actions"));
+        options->getString(ASCIILiteral("condition"), condition);
+        options->getBoolean(ASCIILiteral("autoContinue"), autoContinue);
+        options->getArray(ASCIILiteral("actions"), actions);
     }
 
     BreakpointActions breakpointActions;
@@ -280,7 +280,7 @@ void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString& errorString, int li
 
         RefPtr<Inspector::Protocol::Debugger::Location> location = resolveBreakpoint(breakpointIdentifier, it->key, breakpoint);
         if (location)
-            locations->addItem(location);
+            locations->addItem(WTF::move(location));
     }
     *outBreakpointIdentifier = breakpointIdentifier;
 }
@@ -300,7 +300,7 @@ static bool parseLocation(ErrorString& errorString, InspectorObject& location, J
     return true;
 }
 
-void InspectorDebuggerAgent::setBreakpoint(ErrorString& errorString, const RefPtr<InspectorObject>& location, const RefPtr<InspectorObject>* options, Inspector::Protocol::Debugger::BreakpointId* outBreakpointIdentifier, RefPtr<Inspector::Protocol::Debugger::Location>& actualLocation)
+void InspectorDebuggerAgent::setBreakpoint(ErrorString& errorString, const RefPtr<InspectorObject>&& location, const RefPtr<InspectorObject>&& options, Inspector::Protocol::Debugger::BreakpointId* outBreakpointIdentifier, RefPtr<Inspector::Protocol::Debugger::Location>& actualLocation)
 {
     JSC::SourceID sourceID;
     unsigned lineNumber;
@@ -312,9 +312,9 @@ void InspectorDebuggerAgent::setBreakpoint(ErrorString& errorString, const RefPt
     bool autoContinue = false;
     RefPtr<InspectorArray> actions;
     if (options) {
-        (*options)->getString(ASCIILiteral("condition"), condition);
-        (*options)->getBoolean(ASCIILiteral("autoContinue"), autoContinue);
-        actions = (*options)->getArray(ASCIILiteral("actions"));
+        options->getString(ASCIILiteral("condition"), condition);
+        options->getBoolean(ASCIILiteral("autoContinue"), autoContinue);
+        options->getArray(ASCIILiteral("actions"), actions);
     }
 
     BreakpointActions breakpointActions;
@@ -350,7 +350,7 @@ void InspectorDebuggerAgent::removeBreakpoint(ErrorString&, const String& breakp
     }
 }
 
-void InspectorDebuggerAgent::continueToLocation(ErrorString& errorString, const RefPtr<InspectorObject>& location)
+void InspectorDebuggerAgent::continueToLocation(ErrorString& errorString, const RefPtr<InspectorObject>&& location)
 {
     if (m_continueToLocationBreakpointID != JSC::noBreakpointID) {
         scriptDebugServer().removeBreakpoint(m_continueToLocationBreakpointID);
@@ -368,7 +368,7 @@ void InspectorDebuggerAgent::continueToLocation(ErrorString& errorString, const
     resume(errorString);
 }
 
-PassRefPtr<Inspector::Protocol::Debugger::Location> InspectorDebuggerAgent::resolveBreakpoint(const String& breakpointIdentifier, JSC::SourceID sourceID, const ScriptBreakpoint& breakpoint)
+RefPtr<Inspector::Protocol::Debugger::Location> InspectorDebuggerAgent::resolveBreakpoint(const String& breakpointIdentifier, JSC::SourceID sourceID, const ScriptBreakpoint& breakpoint)
 {
     ScriptsMap::iterator scriptIterator = m_scripts.find(sourceID);
     if (scriptIterator == m_scripts.end())
@@ -388,11 +388,12 @@ PassRefPtr<Inspector::Protocol::Debugger::Location> InspectorDebuggerAgent::reso
         debugServerBreakpointIDsIterator = m_breakpointIdentifierToDebugServerBreakpointIDs.set(breakpointIdentifier, Vector<JSC::BreakpointID>()).iterator;
     debugServerBreakpointIDsIterator->value.append(debugServerBreakpointID);
 
-    RefPtr<Inspector::Protocol::Debugger::Location> location = Inspector::Protocol::Debugger::Location::create()
+    auto location = Inspector::Protocol::Debugger::Location::create()
         .setScriptId(String::number(sourceID))
-        .setLineNumber(actualLineNumber);
+        .setLineNumber(actualLineNumber)
+        .release();
     location->setColumnNumber(actualColumnNumber);
-    return location;
+    return WTF::move(location);
 }
 
 void InspectorDebuggerAgent::searchInContent(ErrorString& error, const String& scriptIDStr, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::GenericTypes::SearchMatch>>& results)
@@ -430,13 +431,13 @@ void InspectorDebuggerAgent::getFunctionDetails(ErrorString& errorString, const
     injectedScript.getFunctionDetails(errorString, functionId, &details);
 }
 
-void InspectorDebuggerAgent::schedulePauseOnNextStatement(InspectorDebuggerFrontendDispatcher::Reason breakReason, PassRefPtr<InspectorObject> data)
+void InspectorDebuggerAgent::schedulePauseOnNextStatement(InspectorDebuggerFrontendDispatcher::Reason breakReason, RefPtr<InspectorObject>&& data)
 {
     if (m_javaScriptPauseScheduled)
         return;
 
     m_breakReason = breakReason;
-    m_breakAuxData = data;
+    m_breakAuxData = WTF::move(data);
     scriptDebugServer().setPauseOnNextStatement(true);
 }
 
@@ -544,12 +545,14 @@ void InspectorDebuggerAgent::setOverlayMessage(ErrorString&, const String*)
 void InspectorDebuggerAgent::scriptExecutionBlockedByCSP(const String& directiveText)
 {
     if (scriptDebugServer().pauseOnExceptionsState() != JSC::Debugger::DontPauseOnExceptions) {
-        RefPtr<Inspector::Protocol::Debugger::CSPViolationPauseReason> reason = Inspector::Protocol::Debugger::CSPViolationPauseReason::create().setDirective(directiveText);
+        auto reason = Inspector::Protocol::Debugger::CSPViolationPauseReason::create()
+            .setDirective(directiveText)
+            .release();
         breakProgram(InspectorDebuggerFrontendDispatcher::Reason::CSPViolation, reason->openAccessors());
     }
 }
 
-PassRefPtr<Inspector::Protocol::Array<Inspector::Protocol::Debugger::CallFrame>> InspectorDebuggerAgent::currentCallFrames()
+Ref<Inspector::Protocol::Array<Inspector::Protocol::Debugger::CallFrame>> InspectorDebuggerAgent::currentCallFrames()
 {
     if (!m_pausedScriptState)
         return Inspector::Protocol::Array<Inspector::Protocol::Debugger::CallFrame>::create();
@@ -606,7 +609,8 @@ void InspectorDebuggerAgent::didParseSource(JSC::SourceID sourceID, const Script
         breakpointObject->getString(ASCIILiteral("condition"), breakpoint.condition);
         breakpointObject->getBoolean(ASCIILiteral("autoContinue"), breakpoint.autoContinue);
         ErrorString errorString;
-        RefPtr<InspectorArray> actions = breakpointObject->getArray(ASCIILiteral("actions"));
+        RefPtr<InspectorArray> actions;
+        breakpointObject->getArray(ASCIILiteral("actions"), actions);
         if (!breakpointActionsFromProtocol(errorString, actions, &breakpoint.actions)) {
             ASSERT_NOT_REACHED();
             continue;
@@ -665,14 +669,15 @@ void InspectorDebuggerAgent::breakpointActionProbe(JSC::ExecState* scriptState,
 {
     InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(scriptState);
     RefPtr<Protocol::Runtime::RemoteObject> payload = injectedScript.wrapObject(sample, objectGroupForBreakpointAction(action));
-    RefPtr<Protocol::Debugger::ProbeSample> result = Protocol::Debugger::ProbeSample::create()
+    auto result = Protocol::Debugger::ProbeSample::create()
         .setProbeId(action.identifier)
         .setBatchId(batchId)
         .setSampleId(sampleId)
         .setTimestamp(m_injectedScriptManager->inspectorEnvironment().executionStopwatch()->elapsedTime())
-        .setPayload(payload.release());
+        .setPayload(payload.release())
+        .release();
 
-    m_frontendDispatcher->didSampleProbe(result.release());
+    m_frontendDispatcher->didSampleProbe(WTF::move(result));
 }
 
 void InspectorDebuggerAgent::didContinue()
@@ -687,10 +692,10 @@ void InspectorDebuggerAgent::didContinue()
     m_frontendDispatcher->resumed();
 }
 
-void InspectorDebuggerAgent::breakProgram(InspectorDebuggerFrontendDispatcher::Reason breakReason, PassRefPtr<InspectorObject> data)
+void InspectorDebuggerAgent::breakProgram(InspectorDebuggerFrontendDispatcher::Reason breakReason, RefPtr<InspectorObject>&& data)
 {
     m_breakReason = breakReason;
-    m_breakAuxData = data;
+    m_breakAuxData = WTF::move(data);
     scriptDebugServer().breakProgram();
 }
 
index 0ae7331..9a74cc5 100644 (file)
@@ -42,7 +42,6 @@
 #include <wtf/Forward.h>
 #include <wtf/HashMap.h>
 #include <wtf/Noncopyable.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/Vector.h>
 #include <wtf/text/StringHash.h>
 
@@ -74,10 +73,10 @@ public:
     virtual void enable(ErrorString&) override;
     virtual void disable(ErrorString&) override;
     virtual void setBreakpointsActive(ErrorString&, bool active) override;
-    virtual void setBreakpointByUrl(ErrorString&, int lineNumber, const String* optionalURL, const String* optionalURLRegex, const int* optionalColumnNumber, const RefPtr<Inspector::InspectorObject>* options, Inspector::Protocol::Debugger::BreakpointId*, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Debugger::Location>>& locations) override;
-    virtual void setBreakpoint(ErrorString&, const RefPtr<Inspector::InspectorObject>& location, const RefPtr<Inspector::InspectorObject>* options, Inspector::Protocol::Debugger::BreakpointId*, RefPtr<Inspector::Protocol::Debugger::Location>& actualLocation) override;
+    virtual void setBreakpointByUrl(ErrorString&, int lineNumber, const String* optionalURL, const String* optionalURLRegex, const int* optionalColumnNumber, const RefPtr<Inspector::InspectorObject>&& options, Inspector::Protocol::Debugger::BreakpointId*, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Debugger::Location>>& locations) override;
+    virtual void setBreakpoint(ErrorString&, const RefPtr<Inspector::InspectorObject>&& location, const RefPtr<Inspector::InspectorObject>&& options, Inspector::Protocol::Debugger::BreakpointId*, RefPtr<Inspector::Protocol::Debugger::Location>& actualLocation) override;
     virtual void removeBreakpoint(ErrorString&, const String& breakpointIdentifier) override;
-    virtual void continueToLocation(ErrorString&, const RefPtr<InspectorObject>& location) override;
+    virtual void continueToLocation(ErrorString&, const RefPtr<InspectorObject>&& location) override;
     virtual void searchInContent(ErrorString&, const String& scriptID, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::GenericTypes::SearchMatch>>&) override;
     virtual void getScriptSource(ErrorString&, const String& scriptID, String* scriptSource) override;
     virtual void getFunctionDetails(ErrorString&, const String& functionId, RefPtr<Inspector::Protocol::Debugger::FunctionDetails>&) override;
@@ -94,9 +93,9 @@ public:
     
     void handleConsoleAssert(const String& message);
 
-    void schedulePauseOnNextStatement(InspectorDebuggerFrontendDispatcher::Reason breakReason, PassRefPtr<InspectorObject> data);
+    void schedulePauseOnNextStatement(InspectorDebuggerFrontendDispatcher::Reason breakReason, RefPtr<InspectorObject>&& data);
     void cancelPauseOnNextStatement();
-    void breakProgram(InspectorDebuggerFrontendDispatcher::Reason breakReason, PassRefPtr<InspectorObject> data);
+    void breakProgram(InspectorDebuggerFrontendDispatcher::Reason breakReason, RefPtr<InspectorObject>&& data);
     void scriptExecutionBlockedByCSP(const String& directiveText);
 
     class Listener {
@@ -132,7 +131,7 @@ protected:
     void didClearGlobalObject();
 
 private:
-    PassRefPtr<Inspector::Protocol::Array<Inspector::Protocol::Debugger::CallFrame>> currentCallFrames();
+    Ref<Inspector::Protocol::Array<Inspector::Protocol::Debugger::CallFrame>> currentCallFrames();
 
     virtual void didParseSource(JSC::SourceID, const Script&) override final;
     virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage) override final;
@@ -140,7 +139,7 @@ private:
     virtual void breakpointActionSound(int breakpointActionIdentifier) override;
     virtual void breakpointActionProbe(JSC::ExecState*, const ScriptBreakpointAction&, unsigned batchId, unsigned sampleId, const Deprecated::ScriptValue& sample) override final;
 
-    PassRefPtr<Inspector::Protocol::Debugger::Location> resolveBreakpoint(const String& breakpointIdentifier, JSC::SourceID, const ScriptBreakpoint&);
+    RefPtr<Inspector::Protocol::Debugger::Location> resolveBreakpoint(const String& breakpointIdentifier, JSC::SourceID, const ScriptBreakpoint&);
     bool assertPaused(ErrorString&);
     void clearDebuggerBreakpointState();
     void clearInspectorBreakpointState();
index 632def3..a3941d3 100644 (file)
@@ -80,12 +80,12 @@ static ScriptDebugServer::PauseOnExceptionsState setPauseOnExceptionsState(Scrip
     return presentState;
 }
 
-static PassRefPtr<Inspector::Protocol::Runtime::ErrorRange> buildErrorRangeObject(const JSTokenLocation& tokenLocation)
+static Ref<Inspector::Protocol::Runtime::ErrorRange> buildErrorRangeObject(const JSTokenLocation& tokenLocation)
 {
-    RefPtr<Inspector::Protocol::Runtime::ErrorRange> result = Inspector::Protocol::Runtime::ErrorRange::create()
+    return Inspector::Protocol::Runtime::ErrorRange::create()
         .setStartOffset(tokenLocation.startOffset)
-        .setEndOffset(tokenLocation.endOffset);
-    return result.release();
+        .setEndOffset(tokenLocation.endOffset)
+        .release();
 }
 
 void InspectorRuntimeAgent::parse(ErrorString&, const String& expression, Inspector::Protocol::Runtime::SyntaxErrorType* result, Inspector::Protocol::OptOutput<String>* message, RefPtr<Inspector::Protocol::Runtime::ErrorRange>& range)
@@ -137,7 +137,7 @@ void InspectorRuntimeAgent::evaluate(ErrorString& errorString, const String& exp
     }
 }
 
-void InspectorRuntimeAgent::callFunctionOn(ErrorString& errorString, const String& objectId, const String& expression, const RefPtr<InspectorArray>* const optionalArguments, const bool* const doNotPauseOnExceptionsAndMuteConsole, const bool* const returnByValue, const bool* generatePreview, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* wasThrown)
+void InspectorRuntimeAgent::callFunctionOn(ErrorString& errorString, const String& objectId, const String& expression, const RefPtr<InspectorArray>&& optionalArguments, const bool* const doNotPauseOnExceptionsAndMuteConsole, const bool* const returnByValue, const bool* generatePreview, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* wasThrown)
 {
     InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId);
     if (injectedScript.hasNoValue()) {
@@ -147,7 +147,7 @@ void InspectorRuntimeAgent::callFunctionOn(ErrorString& errorString, const Strin
 
     String arguments;
     if (optionalArguments)
-        arguments = (*optionalArguments)->toJSONString();
+        arguments = optionalArguments->toJSONString();
 
     ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = ScriptDebugServer::DontPauseOnExceptions;
     if (asBool(doNotPauseOnExceptionsAndMuteConsole))
@@ -197,7 +197,7 @@ void InspectorRuntimeAgent::run(ErrorString&)
 {
 }
 
-void InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets(ErrorString& errorString, const RefPtr<Inspector::InspectorArray>& locations, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::TypeDescription>>& typeDescriptions)
+void InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets(ErrorString& errorString, const RefPtr<Inspector::InspectorArray>&& locations, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::TypeDescription>>& typeDescriptions)
 {
     static const bool verbose = false;
     VM& vm = globalVM();
@@ -237,8 +237,9 @@ void InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets(ErrorString& er
         }
 
         bool isValid = typeLocation && typeSet && !typeSet->isEmpty();
-        RefPtr<Inspector::Protocol::Runtime::TypeDescription> description = Inspector::Protocol::Runtime::TypeDescription::create()
-            .setIsValid(isValid);
+        auto description = Inspector::Protocol::Runtime::TypeDescription::create()
+            .setIsValid(isValid)
+            .release();
 
         if (isValid) {
             description->setLeastCommonAncestor(typeSet->leastCommonAncestor());
@@ -247,7 +248,7 @@ void InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets(ErrorString& er
             description->setIsTruncated(typeSet->isOverflown());
         }
 
-        typeDescriptions->addItem(description);
+        typeDescriptions->addItem(WTF::move(description));
     }
 
     double end = currentTimeMS();
@@ -331,11 +332,12 @@ void InspectorRuntimeAgent::getBasicBlocks(ErrorString& errorString, const Strin
     const Vector<BasicBlockRange>& basicBlockRanges = vm.controlFlowProfiler()->getBasicBlocksForSourceID(sourceID, vm);
     basicBlocks = Inspector::Protocol::Array<Inspector::Protocol::Runtime::BasicBlock>::create();
     for (const BasicBlockRange& block : basicBlockRanges) {
-        RefPtr<Inspector::Protocol::Runtime::BasicBlock> location = Inspector::Protocol::Runtime::BasicBlock::create()
+        Ref<Inspector::Protocol::Runtime::BasicBlock> location = Inspector::Protocol::Runtime::BasicBlock::create()
             .setStartOffset(block.m_startOffset)
             .setEndOffset(block.m_endOffset)
-            .setHasExecuted(block.m_hasExecuted);
-        basicBlocks->addItem(location);
+            .setHasExecuted(block.m_hasExecuted)
+            .release();
+        basicBlocks->addItem(WTF::move(location));
     }
 }
 
index e5d73e0..2e028a1 100644 (file)
@@ -63,12 +63,12 @@ public:
     virtual void disable(ErrorString&) override { m_enabled = false; }
     virtual void parse(ErrorString&, const String& expression, Inspector::Protocol::Runtime::SyntaxErrorType* result, Inspector::Protocol::OptOutput<String>* message, RefPtr<Inspector::Protocol::Runtime::ErrorRange>&) override final;
     virtual void evaluate(ErrorString&, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const int* executionContextId, const bool* returnByValue, const bool* generatePreview, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* wasThrown) override final;
-    virtual void callFunctionOn(ErrorString&, const String& objectId, const String& expression, const RefPtr<Inspector::InspectorArray>* optionalArguments, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* wasThrown) override final;
+    virtual void callFunctionOn(ErrorString&, const String& objectId, const String& expression, const RefPtr<Inspector::InspectorArray>&& optionalArguments, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* wasThrown) override final;
     virtual void releaseObject(ErrorString&, const ErrorString& objectId) override final;
     virtual void getProperties(ErrorString&, const String& objectId, const bool* ownProperties, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties) override final;
     virtual void releaseObjectGroup(ErrorString&, const String& objectGroup) override final;
     virtual void run(ErrorString&) override;
-    virtual void getRuntimeTypesForVariablesAtOffsets(ErrorString&, const RefPtr<Inspector::InspectorArray>& locations, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::TypeDescription>>&) override;
+    virtual void getRuntimeTypesForVariablesAtOffsets(ErrorString&, const RefPtr<Inspector::InspectorArray>&& locations, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::TypeDescription>>&) override;
     virtual void enableTypeProfiler(ErrorString&) override;
     virtual void disableTypeProfiler(ErrorString&) override;
     virtual void getBasicBlocks(ErrorString&, const String& in_sourceID, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::BasicBlock>>& out_basicBlocks) override;
index a83e2fa..ba4910d 100644 (file)
@@ -116,12 +116,11 @@ class CppGenerator:
         if isinstance(_type, EnumType):
             _type = _type.primitive_type  # Fall through to primitive.
 
-        sigil = '*' if parameter.is_optional else '&'
         # This handles the 'any' type and objects with defined properties.
         if isinstance(_type, ObjectType) or _type.qualified_name() is 'object':
-            return 'const RefPtr<Inspector::InspectorObject>' + sigil
+            return 'const RefPtr<Inspector::InspectorObject>&&'
         if isinstance(_type, ArrayType):
-            return 'const RefPtr<Inspector::InspectorArray>' + sigil
+            return 'const RefPtr<Inspector::InspectorArray>&&'
         if isinstance(_type, PrimitiveType):
             cpp_name = CppGenerator.cpp_name_for_primitive_type(_type)
             if parameter.is_optional:
@@ -144,7 +143,7 @@ class CppGenerator:
     @staticmethod
     def cpp_type_for_type_with_name(_type, type_name, is_optional):
         if isinstance(_type, (ArrayType, ObjectType)):
-            return 'PassRefPtr<%s>' % CppGenerator.cpp_protocol_type_for_type(_type)
+            return 'RefPtr<%s>' % CppGenerator.cpp_protocol_type_for_type(_type)
         if isinstance(_type, AliasedType):
             builder_type = CppGenerator.cpp_protocol_type_for_type(_type)
             if is_optional:
@@ -158,9 +157,9 @@ class CppGenerator:
         if isinstance(_type, PrimitiveType):
             cpp_name = CppGenerator.cpp_name_for_primitive_type(_type)
             if _type.qualified_name() in ['object']:
-                return 'PassRefPtr<Inspector::InspectorObject>'
+                return 'RefPtr<Inspector::InspectorObject>'
             elif _type.qualified_name() in ['any']:
-                return 'PassRefPtr<Inspector::InspectorValue>'
+                return 'RefPtr<Inspector::InspectorValue>'
             elif is_optional:
                 return 'const %s* const' % cpp_name
             elif _type.qualified_name() in ['string']:
@@ -212,7 +211,7 @@ class CppGenerator:
             _type = _type.primitive_type  # Fall through.
 
         if isinstance(_type, (ObjectType, ArrayType)):
-            return 'PassRefPtr<%s>' % CppGenerator.cpp_protocol_type_for_type(_type)
+            return 'RefPtr<%s>&&' % CppGenerator.cpp_protocol_type_for_type(_type)
         if isinstance(_type, PrimitiveType):
             cpp_name = CppGenerator.cpp_name_for_primitive_type(_type)
             if parameter.is_optional:
@@ -297,5 +296,9 @@ class CppGenerator:
         return not isinstance(_type, (ArrayType, ObjectType))
 
     @staticmethod
+    def should_use_references_for_type(_type):
+        return isinstance(_type, (ArrayType, ObjectType)) or (isinstance(_type, (PrimitiveType)) and _type.qualified_name() in ["any", "object"])
+
+    @staticmethod
     def should_pass_by_copy_for_return_type(_type):
         return isinstance(_type, (ArrayType, ObjectType)) or (isinstance(_type, (PrimitiveType)) and _type.qualified_name() == "object")
index e048842..45c5417 100755 (executable)
@@ -76,7 +76,7 @@ namespace Inspector {
 
 class AlternateInspectorBackendDispatcher {
 public:
-    void setBackendDispatcher(PassRefPtr<InspectorBackendDispatcher> dispatcher) { m_backendDispatcher = dispatcher; }
+    void setBackendDispatcher(RefPtr<InspectorBackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(dispatcher); }
     InspectorBackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
 private:
     RefPtr<InspectorBackendDispatcher> m_backendDispatcher;
@@ -108,11 +108,11 @@ protected:
     BackendDispatcherHeaderDomainDispatcherDeclaration = (
     """${classAndExportMacro} Inspector${domainName}BackendDispatcher final : public Inspector::InspectorSupplementalBackendDispatcher {
 public:
-    static PassRefPtr<Inspector${domainName}BackendDispatcher> create(Inspector::InspectorBackendDispatcher*, Inspector${domainName}BackendDispatcherHandler*);
-    virtual void dispatch(long callId, const String& method, PassRefPtr<Inspector::InspectorObject> message) override;
+    static Ref<Inspector${domainName}BackendDispatcher> create(Inspector::InspectorBackendDispatcher*, Inspector${domainName}BackendDispatcherHandler*);
+    virtual void dispatch(long callId, const String& method, Ref<Inspector::InspectorObject>&& message) override;
 ${commandDeclarations}
 private:
-    Inspector${domainName}BackendDispatcher(Inspector::InspectorBackendDispatcher*, Inspector${domainName}BackendDispatcherHandler*);
+    Inspector${domainName}BackendDispatcher(Inspector::InspectorBackendDispatcher&, Inspector${domainName}BackendDispatcherHandler*);
     Inspector${domainName}BackendDispatcherHandler* m_agent;
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 public:
@@ -125,13 +125,13 @@ private:
     BackendDispatcherHeaderAsyncCommandDeclaration = (
     """    ${classAndExportMacro} ${callbackName} : public Inspector::InspectorBackendDispatcher::CallbackBase {
     public:
-        ${callbackName}(PassRefPtr<Inspector::InspectorBackendDispatcher>, int id);
+        ${callbackName}(Ref<Inspector::InspectorBackendDispatcher>&&, int id);
         void sendSuccess(${outParameters});
     };
     virtual void ${commandName}(${inParameters}) = 0;""")
 
     BackendDispatcherImplementationSmallSwitch = (
-    """void Inspector${domainName}BackendDispatcher::dispatch(long callId, const String& method, PassRefPtr<InspectorObject> message)
+    """void Inspector${domainName}BackendDispatcher::dispatch(long callId, const String& method, Ref<InspectorObject>&& message)
 {
     Ref<Inspector${domainName}BackendDispatcher> protect(*this);
 
@@ -141,7 +141,7 @@ ${dispatchCases}
 }""")
 
     BackendDispatcherImplementationLargeSwitch = (
-"""void Inspector${domainName}BackendDispatcher::dispatch(long callId, const String& method, PassRefPtr<InspectorObject> message)
+"""void Inspector${domainName}BackendDispatcher::dispatch(long callId, const String& method, Ref<InspectorObject>&& message)
 {
     Ref<Inspector${domainName}BackendDispatcher> protect(*this);
 
@@ -166,16 +166,16 @@ ${dispatchCases}
         return;
     }
 
-    ((*this).*it->value)(callId, *message.get());
+    ((*this).*it->value)(callId, message.get());
 }""")
 
     BackendDispatcherImplementationDomainConstructor = (
-    """PassRefPtr<Inspector${domainName}BackendDispatcher> Inspector${domainName}BackendDispatcher::create(InspectorBackendDispatcher* backendDispatcher, Inspector${domainName}BackendDispatcherHandler* agent)
+    """Ref<Inspector${domainName}BackendDispatcher> Inspector${domainName}BackendDispatcher::create(InspectorBackendDispatcher* backendDispatcher, Inspector${domainName}BackendDispatcherHandler* agent)
 {
-    return adoptRef(new Inspector${domainName}BackendDispatcher(backendDispatcher, agent));
+    return adoptRef(*new Inspector${domainName}BackendDispatcher(*backendDispatcher, agent));
 }
 
-Inspector${domainName}BackendDispatcher::Inspector${domainName}BackendDispatcher(InspectorBackendDispatcher* backendDispatcher, Inspector${domainName}BackendDispatcherHandler* agent)
+Inspector${domainName}BackendDispatcher::Inspector${domainName}BackendDispatcher(InspectorBackendDispatcher& backendDispatcher, Inspector${domainName}BackendDispatcherHandler* agent)
     : InspectorSupplementalBackendDispatcher(backendDispatcher)
     , m_agent(agent)
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
@@ -186,26 +186,25 @@ Inspector${domainName}BackendDispatcher::Inspector${domainName}BackendDispatcher
 }""")
 
     BackendDispatcherImplementationPrepareCommandArguments = (
-"""    RefPtr<InspectorArray> protocolErrors = InspectorArray::create();
-    RefPtr<InspectorObject> paramsContainer = message.getObject(ASCIILiteral("params"));
-    InspectorObject* paramsContainerPtr = paramsContainer.get();
-    InspectorArray* protocolErrorsPtr = protocolErrors.get();
+"""    auto protocolErrors = Inspector::Protocol::Array<String>::create();
+    RefPtr<InspectorObject> paramsContainer;
+    message.getObject(ASCIILiteral("params"), paramsContainer);
 ${inParameterDeclarations}
     if (protocolErrors->length()) {
         String errorMessage = String::format("Some arguments of method \'%s\' can't be processed", "${domainName}.${commandName}");
-        m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::InvalidParams, errorMessage, protocolErrors.release());
+        m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::InvalidParams, errorMessage, WTF::move(protocolErrors));
         return;
     }
 """)
 
     BackendDispatcherImplementationAsyncCommand = (
-"""Inspector${domainName}BackendDispatcherHandler::${callbackName}::${callbackName}(PassRefPtr<InspectorBackendDispatcher> backendDispatcher, int id) : Inspector::InspectorBackendDispatcher::CallbackBase(backendDispatcher, id) { }
+"""Inspector${domainName}BackendDispatcherHandler::${callbackName}::${callbackName}(Ref<InspectorBackendDispatcher>&& backendDispatcher, int id) : Inspector::InspectorBackendDispatcher::CallbackBase(WTF::move(backendDispatcher), id) { }
 
 void Inspector${domainName}BackendDispatcherHandler::${callbackName}::sendSuccess(${formalParameters})
 {
-    RefPtr<InspectorObject> jsonMessage = InspectorObject::create();
+    Ref<InspectorObject> jsonMessage = InspectorObject::create();
 ${outParameterAssignments}
-    sendIfActive(jsonMessage, ErrorString());
+    sendIfActive(WTF::move(jsonMessage), ErrorString());
 }""")
 
     FrontendDispatcherDomainDispatcherDeclaration = (
@@ -228,26 +227,23 @@ private:
             return *reinterpret_cast<Builder<STATE | STEP>*>(this);
         }
 
-        Builder(PassRefPtr</*${objectType}*/Inspector::InspectorObject> ptr)
+        Builder(Ref</*${objectType}*/Inspector::InspectorObject>&& object)
+            : m_result(WTF::move(object))
         {
             COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
-            m_result = ptr;
         }
         friend class ${objectType};
     public:""")
 
     ProtocolObjectBuilderDeclarationPostlude = (
 """
-        operator RefPtr<${objectType}>& ()
+        Ref<${objectType}> release()
         {
             COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
             COMPILE_ASSERT(sizeof(${objectType}) == sizeof(Inspector::InspectorObject), cannot_cast);
-            return *reinterpret_cast<RefPtr<${objectType}>*>(&m_result);
-        }
 
-        PassRefPtr<${objectType}> release()
-        {
-            return RefPtr<${objectType}>(*this).release();
+            Ref<Inspector::InspectorObject> result = m_result.releaseNonNull();
+            return WTF::move(*reinterpret_cast<Ref<${objectType}>*>(&result));
         }
     };
 
@@ -258,11 +254,10 @@ ${constructorExample}
     static Builder<NoFieldsSet> create()
     {
         return Builder<NoFieldsSet>(Inspector::InspectorObject::create());
-    }
-    typedef Inspector::Protocol::StructItemTraits ItemTraits;""")
+    }""")
 
     ProtocolObjectRuntimeCast = (
-"""PassRefPtr<${objectType}> BindingTraits<${objectType}>::runtimeCast(PassRefPtr<Inspector::InspectorValue> value)
+"""RefPtr<${objectType}> BindingTraits<${objectType}>::runtimeCast(RefPtr<Inspector::InspectorValue>&& value)
 {
     RefPtr<Inspector::InspectorObject> result;
     bool castSucceeded = value->asObject(result);
index 1272c00..a241c53 100755 (executable)
@@ -52,7 +52,6 @@ class CppBackendDispatcherHeaderGenerator(Generator):
         headers = [
             '"InspectorProtocolObjects.h"',
             '<inspector/InspectorBackendDispatcher.h>',
-            '<wtf/PassRefPtr.h>',
             '<wtf/text/WTFString.h>']
 
         typedefs = [('String', 'ErrorString')]
@@ -157,7 +156,7 @@ class CppBackendDispatcherHeaderGenerator(Generator):
         in_parameters = ['ErrorString&']
         for _parameter in command.call_parameters:
             in_parameters.append("%s in_%s" % (CppGenerator.cpp_type_for_unchecked_formal_in_parameter(_parameter), _parameter.parameter_name))
-        in_parameters.append("PassRefPtr<%s> callback" % callbackName)
+        in_parameters.append("Ref<%s>&& callback" % callbackName)
 
         out_parameters = []
         for _parameter in command.return_parameters:
index 84615dd..582de4b 100755 (executable)
@@ -104,10 +104,10 @@ class CppBackendDispatcherImplementationGenerator(Generator):
     def _generate_small_dispatcher_switch_implementation_for_domain(self, domain):
         cases = []
         cases.append('    if (method == "%s")' % domain.commands[0].command_name)
-        cases.append('        %s(callId, *message.get());' % domain.commands[0].command_name)
+        cases.append('        %s(callId, message);' % domain.commands[0].command_name)
         for command in domain.commands[1:]:
             cases.append('    else if (method == "%s")' % command.command_name)
-            cases.append('        %s(callId, *message.get());' % command.command_name)
+            cases.append('        %s(callId, message);' % command.command_name)
 
         switch_args = {
             'domainName': domain.domain_name,
@@ -178,22 +178,29 @@ class CppBackendDispatcherImplementationGenerator(Generator):
                 out_success_argument = '&%s_valueFound' % parameter.parameter_name
                 in_parameter_declarations.append('    bool %s_valueFound = false;' % parameter.parameter_name)
 
+            parameter_expression = 'in_' + parameter.parameter_name
+            if CppGenerator.should_use_references_for_type(parameter.type):
+                parameter_expression = '%s.copyRef()' % parameter_expression
+            elif parameter.is_optional:
+                parameter_expression = '&%s' % parameter_expression
+
             param_args = {
                 'parameterType': CppGenerator.cpp_type_for_stack_in_parameter(parameter),
                 'parameterName': parameter.parameter_name,
+                'parameterExpression': parameter_expression,
                 'keyedGetMethod': CppGenerator.cpp_getter_method_for_type(parameter.type),
                 'successOutParam': out_success_argument
             }
 
-            in_parameter_declarations.append('    %(parameterType)s in_%(parameterName)s = InspectorBackendDispatcher::%(keyedGetMethod)s(paramsContainerPtr, ASCIILiteral("%(parameterName)s"), %(successOutParam)s, protocolErrorsPtr);' % param_args)
+            in_parameter_declarations.append('    %(parameterType)s in_%(parameterName)s = InspectorBackendDispatcher::%(keyedGetMethod)s(paramsContainer.get(), ASCIILiteral("%(parameterName)s"), %(successOutParam)s, protocolErrors.get());' % param_args)
 
             if parameter.is_optional:
-                optional_in_parameter_string = '%(parameterName)s_valueFound ? &in_%(parameterName)s : nullptr' % param_args
+                optional_in_parameter_string = '%(parameterName)s_valueFound ? %(parameterExpression)s : nullptr' % param_args
                 alternate_dispatcher_method_parameters.append(optional_in_parameter_string)
                 method_parameters.append(optional_in_parameter_string)
             else:
-                alternate_dispatcher_method_parameters.append('in_' + parameter.parameter_name)
-                method_parameters.append('in_' + parameter.parameter_name)
+                alternate_dispatcher_method_parameters.append(parameter_expression)
+                method_parameters.append(parameter_expression)
 
         if command.is_async:
             async_args = {
@@ -204,7 +211,7 @@ class CppBackendDispatcherImplementationGenerator(Generator):
             out_parameter_assignments.append('        callback->disable();')
             out_parameter_assignments.append('        m_backendDispatcher->reportProtocolError(&callId, Inspector::InspectorBackendDispatcher::ServerError, error);')
             out_parameter_assignments.append('        return;')
-            method_parameters.append('callback')
+            method_parameters.append('callback.copyRef()')
 
         else:
             for parameter in command.return_parameters:
@@ -261,9 +268,9 @@ class CppBackendDispatcherImplementationGenerator(Generator):
         lines.append('')
 
         lines.append('    ErrorString error;')
-        lines.append('    RefPtr<InspectorObject> result = InspectorObject::create();')
+        lines.append('    Ref<InspectorObject> result = InspectorObject::create();')
         if command.is_async:
-            lines.append('    RefPtr<Inspector%(domainName)sBackendDispatcherHandler::%(callbackName)s> callback = adoptRef(new Inspector%(domainName)sBackendDispatcherHandler::%(callbackName)s(m_backendDispatcher,callId));' % command_args)
+            lines.append('    Ref<Inspector%(domainName)sBackendDispatcherHandler::%(callbackName)s> callback = adoptRef(*new Inspector%(domainName)sBackendDispatcherHandler::%(callbackName)s(m_backendDispatcher.copyRef(), callId));' % command_args)
         if len(command.return_parameters) > 0:
             lines.extend(out_parameter_declarations)
         lines.append('    m_agent->%(commandName)s(%(invocationParameters)s);' % command_args)
@@ -282,6 +289,6 @@ class CppBackendDispatcherImplementationGenerator(Generator):
             lines.append('')
 
         if not command.is_async:
-            lines.append('    m_backendDispatcher->sendResponse(callId, result.release(), error);')
+            lines.append('    m_backendDispatcher->sendResponse(callId, WTF::move(result), error);')
         lines.append('}')
         return "\n".join(lines)
index ae04adf..ff09ab3 100755 (executable)
@@ -53,7 +53,6 @@ class CppFrontendDispatcherHeaderGenerator(Generator):
             '"InspectorProtocolObjects.h"',
             '<inspector/InspectorFrontendChannel.h>',
             '<inspector/InspectorValues.h>',
-            '<wtf/PassRefPtr.h>',
             '<wtf/text/WTFString.h>']
 
         header_args = {
index 4270b3b..88f58f4 100755 (executable)
@@ -107,13 +107,13 @@ class CppFrontendDispatcherImplementationGenerator(Generator):
 
         lines.append('void Inspector%(domainName)sFrontendDispatcher::%(eventName)s(%(formalParameters)s)' % event_args)
         lines.append('{')
-        lines.append('    RefPtr<InspectorObject> jsonMessage = InspectorObject::create();')
+        lines.append('    Ref<InspectorObject> jsonMessage = InspectorObject::create();')
         lines.append('    jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("%(domainName)s.%(eventName)s"));' % event_args)
 
         if len(parameter_assignments) > 0:
-            lines.append('    RefPtr<InspectorObject> paramsObject = InspectorObject::create();')
+            lines.append('    Ref<InspectorObject> paramsObject = InspectorObject::create();')
             lines.extend(parameter_assignments)
-            lines.append('    jsonMessage->setObject(ASCIILiteral("params"), paramsObject);')
+            lines.append('    jsonMessage->setObject(ASCIILiteral("params"), paramsObject.copyRef());')
 
         lines.append('')
         lines.append('    m_inspectorFrontendChannel->sendMessageToFrontend(jsonMessage->toJSONString());')
index d60c6ad..9611650 100755 (executable)
@@ -52,7 +52,6 @@ class CppProtocolTypesHeaderGenerator(Generator):
         headers = set([
             '<inspector/InspectorProtocolTypes.h>',
             '<wtf/Assertions.h>',
-            '<wtf/PassRefPtr.h>'
         ])
 
         export_macro = self.model().framework.setting('export_macro', None)
@@ -195,9 +194,10 @@ class CppProtocolTypesHeaderGenerator(Generator):
         lines.append(self._generate_builder_state_enum(type_declaration))
 
         constructor_example = []
-        constructor_example.append('     * RefPtr<%s> result = %s::create()' % (object_name, object_name))
+        constructor_example.append('     * Ref<%s> result = %s::create()' % (object_name, object_name))
         for member in required_members:
             constructor_example.append('     *     .set%s(...)' % ucfirst(member.member_name))
+        constructor_example.append('     *     .release()')
 
         builder_args = {
             'objectType': object_name,
@@ -302,6 +302,8 @@ class CppProtocolTypesHeaderGenerator(Generator):
         lines.append('    {')
         if isinstance(type_member.type, EnumType):
             lines.append('        InspectorObjectBase::%(keyedSet)s(ASCIILiteral("%(name)s"), Inspector::Protocol::getEnumConstantValue(static_cast<int>(value)));' % setter_args)
+        elif CppGenerator.should_use_references_for_type(type_member.type):
+            lines.append('        InspectorObjectBase::%(keyedSet)s(ASCIILiteral("%(name)s"), WTF::move(value));' % setter_args)
         else:
             lines.append('        InspectorObjectBase::%(keyedSet)s(ASCIILiteral("%(name)s"), value);' % setter_args)
         lines.append('    }')
@@ -333,7 +335,7 @@ class CppProtocolTypesHeaderGenerator(Generator):
         for argument in type_arguments:
             lines.append('template<> %s BindingTraits<%s> {' % (' '.join(struct_keywords), argument[0]))
             if argument[1]:
-                lines.append('static PassRefPtr<%s> runtimeCast(PassRefPtr<Inspector::InspectorValue> value);' % argument[0])
+                lines.append('static RefPtr<%s> runtimeCast(RefPtr<Inspector::InspectorValue>&& value);' % argument[0])
             lines.append('#if !ASSERT_DISABLED')
             lines.append('%s assertValueHasExpectedType(Inspector::InspectorValue*);' % ' '.join(function_keywords))
             lines.append('#endif // !ASSERT_DISABLED')
index 31ef494..2c263b5 100755 (executable)
@@ -122,6 +122,7 @@ class CppProtocolTypesImplementationGenerator(Generator):
         lines.append('#if !ASSERT_DISABLED')
         lines.append('void BindingTraits<%s>::assertValueHasExpectedType(Inspector::InspectorValue* value)' % (CppGenerator.cpp_protocol_type_for_type(object_declaration.type)))
         lines.append("""{
+    ASSERT_ARG(value, value);
     RefPtr<InspectorObject> object;
     bool castSucceeded = value->asObject(object);
     ASSERT_UNUSED(castSucceeded, castSucceeded);""")
@@ -169,6 +170,7 @@ class CppProtocolTypesImplementationGenerator(Generator):
         lines.append('#if !ASSERT_DISABLED')
         lines.append('void %s(Inspector::InspectorValue* value)' % CppGenerator.cpp_assertion_method_for_type_member(enum_member, object_declaration))
         lines.append('{')
+        lines.append('    ASSERT_ARG(value, value);')
         lines.append('    String result;')
         lines.append('    bool castSucceeded = value->asString(result);')
         lines.append('    ASSERT(castSucceeded);')
index 8ffae9b..d8e6124 100755 (executable)
@@ -32,7 +32,7 @@ from string import Template
 
 from cpp_generator import CppGenerator
 from generator import Generator
-from models import Frameworks
+from models import PrimitiveType, EnumType, AliasedType, Frameworks
 from objc_generator import ObjCTypeCategory, ObjCGenerator, join_type_and_name
 from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
 
@@ -111,7 +111,7 @@ class ObjCConfigurationImplementationGenerator(Generator):
             lines.append('    id successCallback = ^{')
 
         if command.return_parameters:
-            lines.append('        RefPtr<InspectorObject> resultObject = InspectorObject::create();')
+            lines.append('        Ref<InspectorObject> resultObject = InspectorObject::create();')
 
             required_pointer_parameters = filter(lambda parameter: not parameter.is_optional and ObjCGenerator.is_type_objc_pointer_type(parameter.type), command.return_parameters)
             for parameter in required_pointer_parameters:
@@ -133,7 +133,7 @@ class ObjCConfigurationImplementationGenerator(Generator):
                 else:
                     lines.append('        if (%s)' % var_name)
                     lines.append('            resultObject->%s(ASCIILiteral("%s"), %s);' % (keyed_set_method, parameter.parameter_name, export_expression))
-            lines.append('        backendDispatcher()->sendResponse(callId, resultObject.release(), String());')
+            lines.append('        backendDispatcher()->sendResponse(callId, WTF::move(resultObject), String());')
         else:
             lines.append('        backendDispatcher()->sendResponse(callId, InspectorObject::create(), String());')
 
@@ -145,12 +145,22 @@ class ObjCConfigurationImplementationGenerator(Generator):
         if command.call_parameters:
             lines.append('')
 
+        def in_param_expression(param_name, parameter):
+            _type = parameter.type
+            if isinstance(_type, AliasedType):
+                _type = _type.aliased_type  # Fall through to enum or primitive.
+            if isinstance(_type, EnumType):
+                _type = _type.primitive_type  # Fall through to primitive.
+            if isinstance(_type, PrimitiveType):
+                return '*%s' % param_name if parameter.is_optional else param_name
+            return '%s.copyRef()' % param_name
+
         for parameter in command.call_parameters:
             in_param_name = 'in_%s' % parameter.parameter_name
             objc_in_param_name = 'o_%s' % in_param_name
             objc_type = ObjCGenerator.objc_type_for_param(domain, command.command_name, parameter, False)
-            in_param_optional_safe_name = '*%s' % in_param_name if parameter.is_optional else in_param_name
-            import_expression = ObjCGenerator.objc_protocol_import_expression_for_parameter(in_param_optional_safe_name, domain, command.command_name, parameter)
+            param_expression = in_param_expression(in_param_name, parameter)
+            import_expression = ObjCGenerator.objc_protocol_import_expression_for_parameter(param_expression, domain, command.command_name, parameter)
             if not parameter.is_optional:
                 lines.append('    %s = %s;' % (join_type_and_name(objc_type, objc_in_param_name), import_expression))
             else:
index 3b836fa..7313606 100755 (executable)
@@ -116,7 +116,7 @@ class ObjCFrontendDispatcherImplementationGenerator(Generator):
         if required_pointer_parameters or optional_pointer_parameters:
             lines.append('')
 
-        lines.append('    RefPtr<InspectorObject> jsonMessage = InspectorObject::create();')
+        lines.append('    Ref<InspectorObject> jsonMessage = InspectorObject::create();')
         lines.append('    jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("%s.%s"));' % (domain.domain_name, event.event_name))
         if event.event_parameters:
             lines.extend(self._generate_event_out_parameters(domain, event))
@@ -136,7 +136,7 @@ class ObjCFrontendDispatcherImplementationGenerator(Generator):
 
     def _generate_event_out_parameters(self, domain, event):
         lines = []
-        lines.append('    RefPtr<InspectorObject> paramsObject = InspectorObject::create();')
+        lines.append('    Ref<InspectorObject> paramsObject = InspectorObject::create();')
         for parameter in event.event_parameters:
             keyed_set_method = CppGenerator.cpp_setter_method_for_type(parameter.type)
             var_name = parameter.parameter_name
@@ -147,5 +147,5 @@ class ObjCFrontendDispatcherImplementationGenerator(Generator):
             else:
                 lines.append('    if (%s)' % (parameter.parameter_name))
                 lines.append('        paramsObject->%s(ASCIILiteral("%s"), %s);' % (keyed_set_method, parameter.parameter_name, export_expression))
-        lines.append('    jsonMessage->setObject(ASCIILiteral("params"), paramsObject);')
+        lines.append('    jsonMessage->setObject(ASCIILiteral("params"), paramsObject.copyRef());')
         return lines
index 5154fea..473100b 100755 (executable)
@@ -58,7 +58,6 @@ class ObjCProtocolTypesImplementationGenerator(Generator):
             '"%sEnumConversionHelpers.h"' % ObjCGenerator.OBJC_PREFIX,
             '<JavaScriptCore/InspectorValues.h>',
             '<wtf/Assertions.h>',
-            '<wtf/PassRefPtr.h>',
         ]
 
         header_args = {
index 9c4dac6..c364158 100644 (file)
@@ -41,7 +41,7 @@ namespace Inspector {
 
 class AlternateInspectorBackendDispatcher {
 public:
-    void setBackendDispatcher(PassRefPtr<InspectorBackendDispatcher> dispatcher) { m_backendDispatcher = dispatcher; }
+    void setBackendDispatcher(RefPtr<InspectorBackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(dispatcher); }
     InspectorBackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
 private:
     RefPtr<InspectorBackendDispatcher> m_backendDispatcher;
@@ -143,7 +143,6 @@ InspectorBackend.activateDomain("Database");
 
 #include "InspectorProtocolObjects.h"
 #include <inspector/InspectorBackendDispatcher.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -172,32 +171,32 @@ public:
     virtual void executeSQLSyncOptionalReturnValues(ErrorString&, int in_databaseId, const String& in_query, RefPtr<Inspector::Protocol::Array<String>>& opt_out_columnNames, Inspector::Protocol::OptOutput<String>* opt_out_notes, Inspector::Protocol::OptOutput<double>* opt_out_timestamp, Inspector::Protocol::OptOutput<Inspector::InspectorObject>* opt_out_values, Inspector::Protocol::OptOutput<Inspector::InspectorValue>* opt_out_payload, Inspector::Protocol::OptOutput<int>* opt_out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& opt_out_sqlError, Inspector::Protocol::Database::PrimaryColors* opt_out_screenColor, InspectorDatabaseBackendDispatcherHandler::PrintColor* opt_out_printColor) = 0;
     class ExecuteSQLAsyncOptionalReturnValuesCallback : public Inspector::InspectorBackendDispatcher::CallbackBase {
     public:
-        ExecuteSQLAsyncOptionalReturnValuesCallback(PassRefPtr<Inspector::InspectorBackendDispatcher>, int id);
-        void sendSuccess(PassRefPtr<Inspector::Protocol::Array<String>> columnNames, Inspector::Protocol::OptOutput<String>* notes, Inspector::Protocol::OptOutput<double>* timestamp, Inspector::Protocol::OptOutput<Inspector::InspectorObject>* values, Inspector::Protocol::OptOutput<Inspector::InspectorValue>* payload, Inspector::Protocol::OptOutput<int>* databaseId, PassRefPtr<Inspector::Protocol::Database::Error> sqlError, Inspector::Protocol::OptOutput<String>* screenColor, Inspector::Protocol::OptOutput<String>* printColor);
+        ExecuteSQLAsyncOptionalReturnValuesCallback(Ref<Inspector::InspectorBackendDispatcher>&&, int id);
+        void sendSuccess(RefPtr<Inspector::Protocol::Array<String>>&& columnNames, Inspector::Protocol::OptOutput<String>* notes, Inspector::Protocol::OptOutput<double>* timestamp, Inspector::Protocol::OptOutput<Inspector::InspectorObject>* values, Inspector::Protocol::OptOutput<Inspector::InspectorValue>* payload, Inspector::Protocol::OptOutput<int>* databaseId, RefPtr<Inspector::Protocol::Database::Error>&& sqlError, Inspector::Protocol::OptOutput<String>* screenColor, Inspector::Protocol::OptOutput<String>* printColor);
     };
-    virtual void executeSQLAsyncOptionalReturnValues(ErrorString&, int in_databaseId, const String& in_query, PassRefPtr<ExecuteSQLAsyncOptionalReturnValuesCallback> callback) = 0;
+    virtual void executeSQLAsyncOptionalReturnValues(ErrorString&, int in_databaseId, const String& in_query, Ref<ExecuteSQLAsyncOptionalReturnValuesCallback>&& callback) = 0;
     virtual void executeSQLSync(ErrorString&, int in_databaseId, const String& in_query, RefPtr<Inspector::Protocol::Array<String>>& out_columnNames, String* out_notes, double* out_timestamp, Inspector::InspectorObject* out_values, Inspector::InspectorValue* out_payload, int* out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& out_sqlError, Inspector::Protocol::Database::PrimaryColors* out_screenColor, InspectorDatabaseBackendDispatcherHandler::PrintColor* out_printColor) = 0;
     class ExecuteSQLAsyncCallback : public Inspector::InspectorBackendDispatcher::CallbackBase {
     public:
-        ExecuteSQLAsyncCallback(PassRefPtr<Inspector::InspectorBackendDispatcher>, int id);
-        void sendSuccess(PassRefPtr<Inspector::Protocol::Array<String>> columnNames, const String& notes, double timestamp, Inspector::InspectorObject values, Inspector::InspectorValue payload, int databaseId, PassRefPtr<Inspector::Protocol::Database::Error> sqlError, const String& screenColor, const String& printColor);
+        ExecuteSQLAsyncCallback(Ref<Inspector::InspectorBackendDispatcher>&&, int id);
+        void sendSuccess(RefPtr<Inspector::Protocol::Array<String>>&& columnNames, const String& notes, double timestamp, Inspector::InspectorObject values, Inspector::InspectorValue payload, int databaseId, RefPtr<Inspector::Protocol::Database::Error>&& sqlError, const String& screenColor, const String& printColor);
     };
-    virtual void executeSQLAsync(ErrorString&, int in_databaseId, const String& in_query, PassRefPtr<ExecuteSQLAsyncCallback> callback) = 0;
+    virtual void executeSQLAsync(ErrorString&, int in_databaseId, const String& in_query, Ref<ExecuteSQLAsyncCallback>&& callback) = 0;
 protected:
     virtual ~InspectorDatabaseBackendDispatcherHandler();
 };
 
 class InspectorDatabaseBackendDispatcher final : public Inspector::InspectorSupplementalBackendDispatcher {
 public:
-    static PassRefPtr<InspectorDatabaseBackendDispatcher> create(Inspector::InspectorBackendDispatcher*, InspectorDatabaseBackendDispatcherHandler*);
-    virtual void dispatch(long callId, const String& method, PassRefPtr<Inspector::InspectorObject> message) override;
+    static Ref<InspectorDatabaseBackendDispatcher> create(Inspector::InspectorBackendDispatcher*, InspectorDatabaseBackendDispatcherHandler*);
+    virtual void dispatch(long callId, const String& method, Ref<Inspector::InspectorObject>&& message) override;
 private:
     void executeSQLSyncOptionalReturnValues(long callId, const Inspector::InspectorObject& message);
     void executeSQLAsyncOptionalReturnValues(long callId, const Inspector::InspectorObject& message);
     void executeSQLSync(long callId, const Inspector::InspectorObject& message);
     void executeSQLAsync(long callId, const Inspector::InspectorObject& message);
 private:
-    InspectorDatabaseBackendDispatcher(Inspector::InspectorBackendDispatcher*, InspectorDatabaseBackendDispatcherHandler*);
+    InspectorDatabaseBackendDispatcher(Inspector::InspectorBackendDispatcher&, InspectorDatabaseBackendDispatcherHandler*);
     InspectorDatabaseBackendDispatcherHandler* m_agent;
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 public:
@@ -262,12 +261,12 @@ namespace Inspector {
 
 InspectorDatabaseBackendDispatcherHandler::~InspectorDatabaseBackendDispatcherHandler() { }
 
-PassRefPtr<InspectorDatabaseBackendDispatcher> InspectorDatabaseBackendDispatcher::create(InspectorBackendDispatcher* backendDispatcher, InspectorDatabaseBackendDispatcherHandler* agent)
+Ref<InspectorDatabaseBackendDispatcher> InspectorDatabaseBackendDispatcher::create(InspectorBackendDispatcher* backendDispatcher, InspectorDatabaseBackendDispatcherHandler* agent)
 {
-    return adoptRef(new InspectorDatabaseBackendDispatcher(backendDispatcher, agent));
+    return adoptRef(*new InspectorDatabaseBackendDispatcher(*backendDispatcher, agent));
 }
 
-InspectorDatabaseBackendDispatcher::InspectorDatabaseBackendDispatcher(InspectorBackendDispatcher* backendDispatcher, InspectorDatabaseBackendDispatcherHandler* agent)
+InspectorDatabaseBackendDispatcher::InspectorDatabaseBackendDispatcher(InspectorBackendDispatcher& backendDispatcher, InspectorDatabaseBackendDispatcherHandler* agent)
     : InspectorSupplementalBackendDispatcher(backendDispatcher)
     , m_agent(agent)
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
@@ -277,33 +276,32 @@ InspectorDatabaseBackendDispatcher::InspectorDatabaseBackendDispatcher(Inspector
     m_backendDispatcher->registerDispatcherForDomain(ASCIILiteral("Database"), this);
 }
 
-void InspectorDatabaseBackendDispatcher::dispatch(long callId, const String& method, PassRefPtr<InspectorObject> message)
+void InspectorDatabaseBackendDispatcher::dispatch(long callId, const String& method, Ref<InspectorObject>&& message)
 {
     Ref<InspectorDatabaseBackendDispatcher> protect(*this);
 
     if (method == "executeSQLSyncOptionalReturnValues")
-        executeSQLSyncOptionalReturnValues(callId, *message.get());
+        executeSQLSyncOptionalReturnValues(callId, message);
     else if (method == "executeSQLAsyncOptionalReturnValues")
-        executeSQLAsyncOptionalReturnValues(callId, *message.get());
+        executeSQLAsyncOptionalReturnValues(callId, message);
     else if (method == "executeSQLSync")
-        executeSQLSync(callId, *message.get());
+        executeSQLSync(callId, message);
     else if (method == "executeSQLAsync")
-        executeSQLAsync(callId, *message.get());
+        executeSQLAsync(callId, message);
     else
         m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::MethodNotFound, makeString('\'', "Database", '.', method, "' was not found"));
 }
 
 void InspectorDatabaseBackendDispatcher::executeSQLSyncOptionalReturnValues(long callId, const InspectorObject& message)
 {
-    RefPtr<InspectorArray> protocolErrors = InspectorArray::create();
-    RefPtr<InspectorObject> paramsContainer = message.getObject(ASCIILiteral("params"));
-    InspectorObject* paramsContainerPtr = paramsContainer.get();
-    InspectorArray* protocolErrorsPtr = protocolErrors.get();
-    int in_databaseId = InspectorBackendDispatcher::getInteger(paramsContainerPtr, ASCIILiteral("databaseId"), nullptr, protocolErrorsPtr);
-    String in_query = InspectorBackendDispatcher::getString(paramsContainerPtr, ASCIILiteral("query"), nullptr, protocolErrorsPtr);
+    auto protocolErrors = Inspector::Protocol::Array<String>::create();
+    RefPtr<InspectorObject> paramsContainer;
+    message.getObject(ASCIILiteral("params"), paramsContainer);
+    int in_databaseId = InspectorBackendDispatcher::getInteger(paramsContainer.get(), ASCIILiteral("databaseId"), nullptr, protocolErrors.get());
+    String in_query = InspectorBackendDispatcher::getString(paramsContainer.get(), ASCIILiteral("query"), nullptr, protocolErrors.get());
     if (protocolErrors->length()) {
         String errorMessage = String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLSyncOptionalReturnValues");
-        m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::InvalidParams, errorMessage, protocolErrors.release());
+        m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::InvalidParams, errorMessage, WTF::move(protocolErrors));
         return;
     }
 
@@ -315,7 +313,7 @@ void InspectorDatabaseBackendDispatcher::executeSQLSyncOptionalReturnValues(long
 #endif
 
     ErrorString error;
-    RefPtr<InspectorObject> result = InspectorObject::create();
+    Ref<InspectorObject> result = InspectorObject::create();
     RefPtr<Inspector::Protocol::Array<String>> out_columnNames;
     Inspector::Protocol::OptOutput<String> out_notes;
     Inspector::Protocol::OptOutput<double> out_timestamp;
@@ -347,14 +345,14 @@ void InspectorDatabaseBackendDispatcher::executeSQLSyncOptionalReturnValues(long
         if (out_printColor.isAssigned())
             result->setString(ASCIILiteral("printColor"), out_printColor.getValue());
     }
-    m_backendDispatcher->sendResponse(callId, result.release(), error);
+    m_backendDispatcher->sendResponse(callId, WTF::move(result), error);
 }
 
-InspectorDatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback::ExecuteSQLAsyncOptionalReturnValuesCallback(PassRefPtr<InspectorBackendDispatcher> backendDispatcher, int id) : Inspector::InspectorBackendDispatcher::CallbackBase(backendDispatcher, id) { }
+InspectorDatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback::ExecuteSQLAsyncOptionalReturnValuesCallback(Ref<InspectorBackendDispatcher>&& backendDispatcher, int id) : Inspector::InspectorBackendDispatcher::CallbackBase(WTF::move(backendDispatcher), id) { }
 
-void InspectorDatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback::sendSuccess(PassRefPtr<Inspector::Protocol::Array<String>> columnNames, Inspector::Protocol::OptOutput<String>* notes, Inspector::Protocol::OptOutput<double>* timestamp, Inspector::Protocol::OptOutput<Inspector::InspectorObject>* values, Inspector::Protocol::OptOutput<Inspector::InspectorValue>* payload, Inspector::Protocol::OptOutput<int>* databaseId, PassRefPtr<Inspector::Protocol::Database::Error> sqlError, Inspector::Protocol::OptOutput<String>* screenColor, Inspector::Protocol::OptOutput<String>* printColor)
+void InspectorDatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback::sendSuccess(RefPtr<Inspector::Protocol::Array<String>>&& columnNames, Inspector::Protocol::OptOutput<String>* notes, Inspector::Protocol::OptOutput<double>* timestamp, Inspector::Protocol::OptOutput<Inspector::InspectorObject>* values, Inspector::Protocol::OptOutput<Inspector::InspectorValue>* payload, Inspector::Protocol::OptOutput<int>* databaseId, RefPtr<Inspector::Protocol::Database::Error>&& sqlError, Inspector::Protocol::OptOutput<String>* screenColor, Inspector::Protocol::OptOutput<String>* printColor)
 {
-    RefPtr<InspectorObject> jsonMessage = InspectorObject::create();
+    Ref<InspectorObject> jsonMessage = InspectorObject::create();
     if (columnNames)
         jsonMessage->setArray(ASCIILiteral("columnNames"), columnNames);
     if (notes.isAssigned())
@@ -373,20 +371,19 @@ void InspectorDatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnVal
         jsonMessage->setString(ASCIILiteral("screenColor"), screenColor.getValue());
     if (printColor.isAssigned())
         jsonMessage->setString(ASCIILiteral("printColor"), printColor.getValue());
-    sendIfActive(jsonMessage, ErrorString());
+    sendIfActive(WTF::move(jsonMessage), ErrorString());
 }
 
 void InspectorDatabaseBackendDispatcher::executeSQLAsyncOptionalReturnValues(long callId, const InspectorObject& message)
 {
-    RefPtr<InspectorArray> protocolErrors = InspectorArray::create();
-    RefPtr<InspectorObject> paramsContainer = message.getObject(ASCIILiteral("params"));
-    InspectorObject* paramsContainerPtr = paramsContainer.get();
-    InspectorArray* protocolErrorsPtr = protocolErrors.get();
-    int in_databaseId = InspectorBackendDispatcher::getInteger(paramsContainerPtr, ASCIILiteral("databaseId"), nullptr, protocolErrorsPtr);
-    String in_query = InspectorBackendDispatcher::getString(paramsContainerPtr, ASCIILiteral("query"), nullptr, protocolErrorsPtr);
+    auto protocolErrors = Inspector::Protocol::Array<String>::create();
+    RefPtr<InspectorObject> paramsContainer;
+    message.getObject(ASCIILiteral("params"), paramsContainer);
+    int in_databaseId = InspectorBackendDispatcher::getInteger(paramsContainer.get(), ASCIILiteral("databaseId"), nullptr, protocolErrors.get());
+    String in_query = InspectorBackendDispatcher::getString(paramsContainer.get(), ASCIILiteral("query"), nullptr, protocolErrors.get());
     if (protocolErrors->length()) {
         String errorMessage = String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLAsyncOptionalReturnValues");
-        m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::InvalidParams, errorMessage, protocolErrors.release());
+        m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::InvalidParams, errorMessage, WTF::move(protocolErrors));
         return;
     }
 
@@ -398,9 +395,9 @@ void InspectorDatabaseBackendDispatcher::executeSQLAsyncOptionalReturnValues(lon
 #endif
 
     ErrorString error;
-    RefPtr<InspectorObject> result = InspectorObject::create();
-    RefPtr<InspectorDatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback> callback = adoptRef(new InspectorDatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback(m_backendDispatcher,callId));
-    m_agent->executeSQLAsyncOptionalReturnValues(error, in_databaseId, in_query, callback);
+    Ref<InspectorObject> result = InspectorObject::create();
+    Ref<InspectorDatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback> callback = adoptRef(*new InspectorDatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback(m_backendDispatcher.copyRef(), callId));
+    m_agent->executeSQLAsyncOptionalReturnValues(error, in_databaseId, in_query, callback.copyRef());
 
     if (error.length()) {
         callback->disable();
@@ -411,15 +408,14 @@ void InspectorDatabaseBackendDispatcher::executeSQLAsyncOptionalReturnValues(lon
 
 void InspectorDatabaseBackendDispatcher::executeSQLSync(long callId, const InspectorObject& message)
 {
-    RefPtr<InspectorArray> protocolErrors = InspectorArray::create();
-    RefPtr<InspectorObject> paramsContainer = message.getObject(ASCIILiteral("params"));
-    InspectorObject* paramsContainerPtr = paramsContainer.get();
-    InspectorArray* protocolErrorsPtr = protocolErrors.get();
-    int in_databaseId = InspectorBackendDispatcher::getInteger(paramsContainerPtr, ASCIILiteral("databaseId"), nullptr, protocolErrorsPtr);
-    String in_query = InspectorBackendDispatcher::getString(paramsContainerPtr, ASCIILiteral("query"), nullptr, protocolErrorsPtr);
+    auto protocolErrors = Inspector::Protocol::Array<String>::create();
+    RefPtr<InspectorObject> paramsContainer;
+    message.getObject(ASCIILiteral("params"), paramsContainer);
+    int in_databaseId = InspectorBackendDispatcher::getInteger(paramsContainer.get(), ASCIILiteral("databaseId"), nullptr, protocolErrors.get());
+    String in_query = InspectorBackendDispatcher::getString(paramsContainer.get(), ASCIILiteral("query"), nullptr, protocolErrors.get());
     if (protocolErrors->length()) {
         String errorMessage = String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLSync");
-        m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::InvalidParams, errorMessage, protocolErrors.release());
+        m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::InvalidParams, errorMessage, WTF::move(protocolErrors));
         return;
     }
 
@@ -431,7 +427,7 @@ void InspectorDatabaseBackendDispatcher::executeSQLSync(long callId, const Inspe
 #endif
 
     ErrorString error;
-    RefPtr<InspectorObject> result = InspectorObject::create();
+    Ref<InspectorObject> result = InspectorObject::create();
     RefPtr<Inspector::Protocol::Array<String>> out_columnNames;
     String out_notes;
     double out_timestamp;
@@ -454,14 +450,14 @@ void InspectorDatabaseBackendDispatcher::executeSQLSync(long callId, const Inspe
         result->setString(ASCIILiteral("screenColor"), Inspector::Protocol::getEnumConstantValue(out_screenColor));
         result->setString(ASCIILiteral("printColor"), Inspector::Protocol::getEnumConstantValue(out_printColor));
     }
-    m_backendDispatcher->sendResponse(callId, result.release(), error);
+    m_backendDispatcher->sendResponse(callId, WTF::move(result), error);
 }
 
-InspectorDatabaseBackendDispatcherHandler::ExecuteSQLAsyncCallback::ExecuteSQLAsyncCallback(PassRefPtr<InspectorBackendDispatcher> backendDispatcher, int id) : Inspector::InspectorBackendDispatcher::CallbackBase(backendDispatcher, id) { }
+InspectorDatabaseBackendDispatcherHandler::ExecuteSQLAsyncCallback::ExecuteSQLAsyncCallback(Ref<InspectorBackendDispatcher>&& backendDispatcher, int id) : Inspector::InspectorBackendDispatcher::CallbackBase(WTF::move(backendDispatcher), id) { }
 
-void InspectorDatabaseBackendDispatcherHandler::ExecuteSQLAsyncCallback::sendSuccess(PassRefPtr<Inspector::Protocol::Array<String>> columnNames, const String& notes, double timestamp, Inspector::InspectorObject values, Inspector::InspectorValue payload, int databaseId, PassRefPtr<Inspector::Protocol::Database::Error> sqlError, const String& screenColor, const String& printColor)
+void InspectorDatabaseBackendDispatcherHandler::ExecuteSQLAsyncCallback::sendSuccess(RefPtr<Inspector::Protocol::Array<String>>&& columnNames, const String& notes, double timestamp, Inspector::InspectorObject values, Inspector::InspectorValue payload, int databaseId, RefPtr<Inspector::Protocol::Database::Error>&& sqlError, const String& screenColor, const String& printColor)
 {
-    RefPtr<InspectorObject> jsonMessage = InspectorObject::create();
+    Ref<InspectorObject> jsonMessage = InspectorObject::create();
     jsonMessage->setArray(ASCIILiteral("columnNames"), columnNames);
     jsonMessage->setString(ASCIILiteral("notes"), notes);
     jsonMessage->setDouble(ASCIILiteral("timestamp"), timestamp);
@@ -471,20 +467,19 @@ void InspectorDatabaseBackendDispatcherHandler::ExecuteSQLAsyncCallback::sendSuc
     jsonMessage->setObject(ASCIILiteral("sqlError"), sqlError);
     jsonMessage->setString(ASCIILiteral("screenColor"), Inspector::Protocol::getEnumConstantValue(screenColor));
     jsonMessage->setString(ASCIILiteral("printColor"), Inspector::Protocol::getEnumConstantValue(printColor));
-    sendIfActive(jsonMessage, ErrorString());
+    sendIfActive(WTF::move(jsonMessage), ErrorString());
 }
 
 void InspectorDatabaseBackendDispatcher::executeSQLAsync(long callId, const InspectorObject& message)
 {
-    RefPtr<InspectorArray> protocolErrors = InspectorArray::create();
-    RefPtr<InspectorObject> paramsContainer = message.getObject(ASCIILiteral("params"));
-    InspectorObject* paramsContainerPtr = paramsContainer.get();
-    InspectorArray* protocolErrorsPtr = protocolErrors.get();
-    int in_databaseId = InspectorBackendDispatcher::getInteger(paramsContainerPtr, ASCIILiteral("databaseId"), nullptr, protocolErrorsPtr);
-    String in_query = InspectorBackendDispatcher::getString(paramsContainerPtr, ASCIILiteral("query"), nullptr, protocolErrorsPtr);
+    auto protocolErrors = Inspector::Protocol::Array<String>::create();
+    RefPtr<InspectorObject> paramsContainer;
+    message.getObject(ASCIILiteral("params"), paramsContainer);
+    int in_databaseId = InspectorBackendDispatcher::getInteger(paramsContainer.get(), ASCIILiteral("databaseId"), nullptr, protocolErrors.get());
+    String in_query = InspectorBackendDispatcher::getString(paramsContainer.get(), ASCIILiteral("query"), nullptr, protocolErrors.get());
     if (protocolErrors->length()) {
         String errorMessage = String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLAsync");
-        m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::InvalidParams, errorMessage, protocolErrors.release());
+        m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::InvalidParams, errorMessage, WTF::move(protocolErrors));
         return;
     }
 
@@ -496,9 +491,9 @@ void InspectorDatabaseBackendDispatcher::executeSQLAsync(long callId, const Insp
 #endif
 
     ErrorString error;
-    RefPtr<InspectorObject> result = InspectorObject::create();
-    RefPtr<InspectorDatabaseBackendDispatcherHandler::ExecuteSQLAsyncCallback> callback = adoptRef(new InspectorDatabaseBackendDispatcherHandler::ExecuteSQLAsyncCallback(m_backendDispatcher,callId));
-    m_agent->executeSQLAsync(error, in_databaseId, in_query, callback);
+    Ref<InspectorObject> result = InspectorObject::create();
+    Ref<InspectorDatabaseBackendDispatcherHandler::ExecuteSQLAsyncCallback> callback = adoptRef(*new InspectorDatabaseBackendDispatcherHandler::ExecuteSQLAsyncCallback(m_backendDispatcher.copyRef(), callId));
+    m_agent->executeSQLAsync(error, in_databaseId, in_query, callback.copyRef());
 
     if (error.length()) {
         callback->disable();
@@ -552,7 +547,6 @@ void InspectorDatabaseBackendDispatcher::executeSQLAsync(long callId, const Insp
 #include "InspectorProtocolObjects.h"
 #include <inspector/InspectorFrontendChannel.h>
 #include <inspector/InspectorValues.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -650,7 +644,6 @@ namespace Inspector {
 
 #include <inspector/InspectorProtocolTypes.h>
 #include <wtf/Assertions.h>
-#include <wtf/PassRefPtr.h>
 
 namespace Inspector {
 
@@ -707,10 +700,10 @@ public:
             return *reinterpret_cast<Builder<STATE | STEP>*>(this);
         }
 
-        Builder(PassRefPtr</*Error*/Inspector::InspectorObject> ptr)
+        Builder(Ref</*Error*/Inspector::InspectorObject>&& object)
+            : m_result(WTF::move(object))
         {
             COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
-            m_result = ptr;
         }
         friend class Error;
     public:
@@ -729,30 +722,27 @@ public:
             return castState<CodeSet>();
         }
 
-        operator RefPtr<Error>& ()
+        Ref<Error> release()
         {
             COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
             COMPILE_ASSERT(sizeof(Error) == sizeof(Inspector::InspectorObject), cannot_cast);
-            return *reinterpret_cast<RefPtr<Error>*>(&m_result);
-        }
 
-        PassRefPtr<Error> release()
-        {
-            return RefPtr<Error>(*this).release();
+            Ref<Inspector::InspectorObject> result = m_result.releaseNonNull();
+            return WTF::move(*reinterpret_cast<Ref<Error>*>(&result));
         }
     };
 
     /*
      * Synthetic constructor:
-     * RefPtr<Error> result = Error::create()
+     * Ref<Error> result = Error::create()
      *     .setMessage(...)
-     *     .setCode(...);
+     *     .setCode(...)
+     *     .release();
      */
     static Builder<NoFieldsSet> create()
     {
         return Builder<NoFieldsSet>(Inspector::InspectorObject::create());
     }
-    typedef Inspector::Protocol::StructItemTraits ItemTraits;
 };
 
 } // Database
@@ -1065,7 +1055,7 @@ void ObjCInspectorDatabaseBackendDispatcher::executeSQLSyncOptionalReturnValues(
     };
 
     id successCallback = ^(NSArray/*<NSString>*/ **columnNames, NSString **notes, double *timestamp, RWIProtocolJSONObject **values, RWIProtocolJSONObject **payload, int *databaseId, RWIProtocolDatabaseError **sqlError, RWIProtocolDatabasePrimaryColors *screenColor, RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColor *printColor) {
-        RefPtr<InspectorObject> resultObject = InspectorObject::create();
+        Ref<InspectorObject> resultObject = InspectorObject::create();
         THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(columnNames, @"columnNames");
         THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(notes, @"notes");
         THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(values, @"values");
@@ -1089,7 +1079,7 @@ void ObjCInspectorDatabaseBackendDispatcher::executeSQLSyncOptionalReturnValues(
             resultObject->setString(ASCIILiteral("screenColor"), toProtocolString(*screenColor));
         if (printColor)
             resultObject->setString(ASCIILiteral("printColor"), toProtocolString(*printColor));
-        backendDispatcher()->sendResponse(callId, resultObject.release(), String());
+        backendDispatcher()->sendResponse(callId, WTF::move(resultObject), String());
     };
 
     int o_in_databaseId = in_databaseId;
@@ -1105,7 +1095,7 @@ void ObjCInspectorDatabaseBackendDispatcher::executeSQLAsyncOptionalReturnValues
     };
 
     id successCallback = ^(NSArray/*<NSString>*/ **columnNames, NSString **notes, double *timestamp, RWIProtocolJSONObject **values, RWIProtocolJSONObject **payload, int *databaseId, RWIProtocolDatabaseError **sqlError, RWIProtocolDatabasePrimaryColors *screenColor, RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColor *printColor) {
-        RefPtr<InspectorObject> resultObject = InspectorObject::create();
+        Ref<InspectorObject> resultObject = InspectorObject::create();
         THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(columnNames, @"columnNames");
         THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(notes, @"notes");
         THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(values, @"values");
@@ -1129,7 +1119,7 @@ void ObjCInspectorDatabaseBackendDispatcher::executeSQLAsyncOptionalReturnValues
             resultObject->setString(ASCIILiteral("screenColor"), toProtocolString(*screenColor));
         if (printColor)
             resultObject->setString(ASCIILiteral("printColor"), toProtocolString(*printColor));
-        backendDispatcher()->sendResponse(callId, resultObject.release(), String());
+        backendDispatcher()->sendResponse(callId, WTF::move(resultObject), String());
     };
 
     int o_in_databaseId = in_databaseId;
@@ -1145,7 +1135,7 @@ void ObjCInspectorDatabaseBackendDispatcher::executeSQLSync(long callId, int in_
     };
 
     id successCallback = ^(NSArray/*<NSString>*/ *columnNames, NSString *notes, double timestamp, RWIProtocolJSONObject *values, RWIProtocolJSONObject *payload, int databaseId, RWIProtocolDatabaseError *sqlError, RWIProtocolDatabasePrimaryColors screenColor, RWIProtocolDatabaseExecuteSQLSyncPrintColor printColor) {
-        RefPtr<InspectorObject> resultObject = InspectorObject::create();
+        Ref<InspectorObject> resultObject = InspectorObject::create();
         THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(columnNames, @"columnNames");
         THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(notes, @"notes");
         THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(values, @"values");
@@ -1160,7 +1150,7 @@ void ObjCInspectorDatabaseBackendDispatcher::executeSQLSync(long callId, int in_
         resultObject->setObject(ASCIILiteral("sqlError"), [sqlError toInspectorObject]);
         resultObject->setString(ASCIILiteral("screenColor"), toProtocolString(screenColor));
         resultObject->setString(ASCIILiteral("printColor"), toProtocolString(printColor));
-        backendDispatcher()->sendResponse(callId, resultObject.release(), String());
+        backendDispatcher()->sendResponse(callId, WTF::move(resultObject), String());
     };
 
     int o_in_databaseId = in_databaseId;
@@ -1176,7 +1166,7 @@ void ObjCInspectorDatabaseBackendDispatcher::executeSQLAsync(long callId, int in
     };
 
     id successCallback = ^(NSArray/*<NSString>*/ *columnNames, NSString *notes, double timestamp, RWIProtocolJSONObject *values, RWIProtocolJSONObject *payload, int databaseId, RWIProtocolDatabaseError *sqlError, RWIProtocolDatabasePrimaryColors screenColor, RWIProtocolDatabaseExecuteSQLAsyncPrintColor printColor) {
-        RefPtr<InspectorObject> resultObject = InspectorObject::create();
+        Ref<InspectorObject> resultObject = InspectorObject::create();
         THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(columnNames, @"columnNames");
         THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(notes, @"notes");
         THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(values, @"values");
@@ -1191,7 +1181,7 @@ void ObjCInspectorDatabaseBackendDispatcher::executeSQLAsync(long callId, int in
         resultObject->setObject(ASCIILiteral("sqlError"), [sqlError toInspectorObject]);
         resultObject->setString(ASCIILiteral("screenColor"), toProtocolString(screenColor));
         resultObject->setString(ASCIILiteral("printColor"), toProtocolString(printColor));
-        backendDispatcher()->sendResponse(callId, resultObject.release(), String());
+        backendDispatcher()->sendResponse(callId, WTF::move(resultObject), String());
     };
 
     int o_in_databaseId = in_databaseId;
@@ -1565,7 +1555,6 @@ __attribute__((visibility ("default")))
 #import "RWIProtocolEnumConversionHelpers.h"
 #import <JavaScriptCore/InspectorValues.h>
 #import <wtf/Assertions.h>
-#import <wtf/PassRefPtr.h>
 
 using namespace Inspector;
 
index 7b5ef57..20c102c 100644 (file)
@@ -41,7 +41,7 @@ namespace Inspector {
 
 class AlternateInspectorBackendDispatcher {
 public:
-    void setBackendDispatcher(PassRefPtr<InspectorBackendDispatcher> dispatcher) { m_backendDispatcher = dispatcher; }
+    void setBackendDispatcher(RefPtr<InspectorBackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(dispatcher); }
     InspectorBackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
 private:
     RefPtr<InspectorBackendDispatcher> m_backendDispatcher;
@@ -51,8 +51,8 @@ private:
 class AlternateInspectorDatabaseBackendDispatcher : public AlternateInspectorBackendDispatcher {
 public:
     virtual ~AlternateInspectorDatabaseBackendDispatcher() { }
-    virtual void executeAllOptionalParameters(long callId, const RefPtr<Inspector::InspectorArray>* in_columnNames, const String* in_notes, const double* in_timestamp, const RefPtr<Inspector::InspectorObject>* in_values, const Inspector::InspectorValue* in_payload, const int* in_databaseId, const RefPtr<Inspector::InspectorObject>* in_sqlError, const String* in_screenColor, const String* in_printColor) = 0;
-    virtual void executeNoOptionalParameters(long callId, const RefPtr<Inspector::InspectorArray>& in_columnNames, const String& in_notes, double in_timestamp, const RefPtr<Inspector::InspectorObject>& in_values, Inspector::InspectorValue in_payload, int in_databaseId, const RefPtr<Inspector::InspectorObject>& in_sqlError, const String& in_screenColor, const String& in_printColor) = 0;
+    virtual void executeAllOptionalParameters(long callId, const RefPtr<Inspector::InspectorArray>&& in_columnNames, const String* in_notes, const double* in_timestamp, const RefPtr<Inspector::InspectorObject>&& in_values, const Inspector::InspectorValue* in_payload, const int* in_databaseId, const RefPtr<Inspector::InspectorObject>&& in_sqlError, const String* in_screenColor, const String* in_printColor) = 0;
+    virtual void executeNoOptionalParameters(long callId, const RefPtr<Inspector::InspectorArray>&& in_columnNames, const String& in_notes, double in_timestamp, const RefPtr<Inspector::InspectorObject>&& in_values, Inspector::InspectorValue in_payload, int in_databaseId, const RefPtr<Inspector::InspectorObject>&& in_sqlError, const String& in_screenColor, const String& in_printColor) = 0;
 };
 
 } // namespace Inspector
@@ -138,7 +138,6 @@ InspectorBackend.activateDomain("Database");
 
 #include "InspectorProtocolObjects.h"
 #include <inspector/InspectorBackendDispatcher.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -164,21 +163,21 @@ public:
         Yellow = 5,
         Black = 6,
     }; // enum class PrintColor
-    virtual void executeAllOptionalParameters(ErrorString&, const RefPtr<Inspector::InspectorArray>* in_columnNames, const String* in_notes, const double* in_timestamp, const RefPtr<Inspector::InspectorObject>* in_values, const Inspector::InspectorValue* in_payload, const int* in_databaseId, const RefPtr<Inspector::InspectorObject>* in_sqlError, const String* in_screenColor, const String* in_printColor, RefPtr<Inspector::Protocol::Array<String>>& opt_out_columnNames, Inspector::Protocol::OptOutput<String>* opt_out_notes, Inspector::Protocol::OptOutput<double>* opt_out_timestamp, Inspector::Protocol::OptOutput<Inspector::InspectorObject>* opt_out_values, Inspector::Protocol::OptOutput<Inspector::InspectorValue>* opt_out_payload, Inspector::Protocol::OptOutput<int>* opt_out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& opt_out_sqlError, Inspector::Protocol::Database::PrimaryColors* opt_out_screenColor, InspectorDatabaseBackendDispatcherHandler::PrintColor* opt_out_printColor) = 0;
-    virtual void executeNoOptionalParameters(ErrorString&, const RefPtr<Inspector::InspectorArray>& in_columnNames, const String& in_notes, double in_timestamp, const RefPtr<Inspector::InspectorObject>& in_values, Inspector::InspectorValue in_payload, int in_databaseId, const RefPtr<Inspector::InspectorObject>& in_sqlError, const String& in_screenColor, const String& in_printColor, RefPtr<Inspector::Protocol::Array<String>>& out_columnNames, String* out_notes, double* out_timestamp, Inspector::InspectorObject* out_values, Inspector::InspectorValue* out_payload, int* out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& out_sqlError, Inspector::Protocol::Database::PrimaryColors* out_screenColor, InspectorDatabaseBackendDispatcherHandler::PrintColor* out_printColor) = 0;
+    virtual void executeAllOptionalParameters(ErrorString&, const RefPtr<Inspector::InspectorArray>&& in_columnNames, const String* in_notes, const double* in_timestamp, const RefPtr<Inspector::InspectorObject>&& in_values, const Inspector::InspectorValue* in_payload, const int* in_databaseId, const RefPtr<Inspector::InspectorObject>&& in_sqlError, const String* in_screenColor, const String* in_printColor, RefPtr<Inspector::Protocol::Array<String>>& opt_out_columnNames, Inspector::Protocol::OptOutput<String>* opt_out_notes, Inspector::Protocol::OptOutput<double>* opt_out_timestamp, Inspector::Protocol::OptOutput<Inspector::InspectorObject>* opt_out_values, Inspector::Protocol::OptOutput<Inspector::InspectorValue>* opt_out_payload, Inspector::Protocol::OptOutput<int>* opt_out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& opt_out_sqlError, Inspector::Protocol::Database::PrimaryColors* opt_out_screenColor, InspectorDatabaseBackendDispatcherHandler::PrintColor* opt_out_printColor) = 0;
+    virtual void executeNoOptionalParameters(ErrorString&, const RefPtr<Inspector::InspectorArray>&& in_columnNames, const String& in_notes, double in_timestamp, const RefPtr<Inspector::InspectorObject>&& in_values, Inspector::InspectorValue in_payload, int in_databaseId, const RefPtr<Inspector::InspectorObject>&& in_sqlError, const String& in_screenColor, const String& in_printColor, RefPtr<Inspector::Protocol::Array<String>>& out_columnNames, String* out_notes, double* out_timestamp, Inspector::InspectorObject* out_values, Inspector::InspectorValue* out_payload, int* out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& out_sqlError, Inspector::Protocol::Database::PrimaryColors* out_screenColor, InspectorDatabaseBackendDispatcherHandler::PrintColor* out_printColor) = 0;
 protected:
     virtual ~InspectorDatabaseBackendDispatcherHandler();
 };
 
 class InspectorDatabaseBackendDispatcher final : public Inspector::InspectorSupplementalBackendDispatcher {
 public:
-    static PassRefPtr<InspectorDatabaseBackendDispatcher> create(Inspector::InspectorBackendDispatcher*, InspectorDatabaseBackendDispatcherHandler*);
-    virtual void dispatch(long callId, const String& method, PassRefPtr<Inspector::InspectorObject> message) override;
+    static Ref<InspectorDatabaseBackendDispatcher> create(Inspector::InspectorBackendDispatcher*, InspectorDatabaseBackendDispatcherHandler*);
+    virtual void dispatch(long callId, const String& method, Ref<Inspector::InspectorObject>&& message) override;
 private:
     void executeAllOptionalParameters(long callId, const Inspector::InspectorObject& message);
     void executeNoOptionalParameters(long callId, const Inspector::InspectorObject& message);
 private:
-    InspectorDatabaseBackendDispatcher(Inspector::InspectorBackendDispatcher*, InspectorDatabaseBackendDispatcherHandler*);
+    InspectorDatabaseBackendDispatcher(Inspector::InspectorBackendDispatcher&, InspectorDatabaseBackendDispatcherHandler*);
     InspectorDatabaseBackendDispatcherHandler* m_agent;
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 public:
@@ -243,12 +242,12 @@ namespace Inspector {
 
 InspectorDatabaseBackendDispatcherHandler::~InspectorDatabaseBackendDispatcherHandler() { }
 
-PassRefPtr<InspectorDatabaseBackendDispatcher> InspectorDatabaseBackendDispatcher::create(InspectorBackendDispatcher* backendDispatcher, InspectorDatabaseBackendDispatcherHandler* agent)
+Ref<InspectorDatabaseBackendDispatcher> InspectorDatabaseBackendDispatcher::create(InspectorBackendDispatcher* backendDispatcher, InspectorDatabaseBackendDispatcherHandler* agent)
 {
-    return adoptRef(new InspectorDatabaseBackendDispatcher(backendDispatcher, agent));
+    return adoptRef(*new InspectorDatabaseBackendDispatcher(*backendDispatcher, agent));
 }
 
-InspectorDatabaseBackendDispatcher::InspectorDatabaseBackendDispatcher(InspectorBackendDispatcher* backendDispatcher, InspectorDatabaseBackendDispatcherHandler* agent)
+InspectorDatabaseBackendDispatcher::InspectorDatabaseBackendDispatcher(InspectorBackendDispatcher& backendDispatcher, InspectorDatabaseBackendDispatcherHandler* agent)
     : InspectorSupplementalBackendDispatcher(backendDispatcher)
     , m_agent(agent)
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
@@ -258,57 +257,56 @@ InspectorDatabaseBackendDispatcher::InspectorDatabaseBackendDispatcher(Inspector
     m_backendDispatcher->registerDispatcherForDomain(ASCIILiteral("Database"), this);
 }
 
-void InspectorDatabaseBackendDispatcher::dispatch(long callId, const String& method, PassRefPtr<InspectorObject> message)
+void InspectorDatabaseBackendDispatcher::dispatch(long callId, const String& method, Ref<InspectorObject>&& message)
 {
     Ref<InspectorDatabaseBackendDispatcher> protect(*this);
 
     if (method == "executeAllOptionalParameters")
-        executeAllOptionalParameters(callId, *message.get());
+        executeAllOptionalParameters(callId, message);
     else if (method == "executeNoOptionalParameters")
-        executeNoOptionalParameters(callId, *message.get());
+        executeNoOptionalParameters(callId, message);
     else
         m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::MethodNotFound, makeString('\'', "Database", '.', method, "' was not found"));
 }
 
 void InspectorDatabaseBackendDispatcher::executeAllOptionalParameters(long callId, const InspectorObject& message)
 {
-    RefPtr<InspectorArray> protocolErrors = InspectorArray::create();
-    RefPtr<InspectorObject> paramsContainer = message.getObject(ASCIILiteral("params"));
-    InspectorObject* paramsContainerPtr = paramsContainer.get();
-    InspectorArray* protocolErrorsPtr = protocolErrors.get();
+    auto protocolErrors = Inspector::Protocol::Array<String>::create();
+    RefPtr<InspectorObject> paramsContainer;
+    message.getObject(ASCIILiteral("params"), paramsContainer);
     bool columnNames_valueFound = false;
-    RefPtr<Inspector::InspectorArray> in_columnNames = InspectorBackendDispatcher::getArray(paramsContainerPtr, ASCIILiteral("columnNames"), &columnNames_valueFound, protocolErrorsPtr);
+    RefPtr<Inspector::InspectorArray> in_columnNames = InspectorBackendDispatcher::getArray(paramsContainer.get(), ASCIILiteral("columnNames"), &columnNames_valueFound, protocolErrors.get());
     bool notes_valueFound = false;
-    String in_notes = InspectorBackendDispatcher::getString(paramsContainerPtr, ASCIILiteral("notes"), &notes_valueFound, protocolErrorsPtr);
+    String in_notes = InspectorBackendDispatcher::getString(paramsContainer.get(), ASCIILiteral("notes"), &notes_valueFound, protocolErrors.get());
     bool timestamp_valueFound = false;
-    Inspector::Protocol::OptOutput<double> in_timestamp = InspectorBackendDispatcher::getDouble(paramsContainerPtr, ASCIILiteral("timestamp"), &timestamp_valueFound, protocolErrorsPtr);
+    Inspector::Protocol::OptOutput<double> in_timestamp = InspectorBackendDispatcher::getDouble(paramsContainer.get(), ASCIILiteral("timestamp"), &timestamp_valueFound, protocolErrors.get());
     bool values_valueFound = false;
-    RefPtr<Inspector::InspectorObject> in_values = InspectorBackendDispatcher::getObject(paramsContainerPtr, ASCIILiteral("values"), &values_valueFound, protocolErrorsPtr);
+    RefPtr<Inspector::InspectorObject> in_values = InspectorBackendDispatcher::getObject(paramsContainer.get(), ASCIILiteral("values"), &values_valueFound, protocolErrors.get());
     bool payload_valueFound = false;
-    RefPtr<Inspector::InspectorValue> in_payload = InspectorBackendDispatcher::getValue(paramsContainerPtr, ASCIILiteral("payload"), &payload_valueFound, protocolErrorsPtr);
+    RefPtr<Inspector::InspectorValue> in_payload = InspectorBackendDispatcher::getValue(paramsContainer.get(), ASCIILiteral("payload"), &payload_valueFound, protocolErrors.get());
     bool databaseId_valueFound = false;
-    int in_databaseId = InspectorBackendDispatcher::getInteger(paramsContainerPtr, ASCIILiteral("databaseId"), &databaseId_valueFound, protocolErrorsPtr);
+    int in_databaseId = InspectorBackendDispatcher::getInteger(paramsContainer.get(), ASCIILiteral("databaseId"), &databaseId_valueFound, protocolErrors.get());
     bool sqlError_valueFound = false;
-    RefPtr<Inspector::InspectorObject> in_sqlError = InspectorBackendDispatcher::getObject(paramsContainerPtr, ASCIILiteral("sqlError"), &sqlError_valueFound, protocolErrorsPtr);
+    RefPtr<Inspector::InspectorObject> in_sqlError = InspectorBackendDispatcher::getObject(paramsContainer.get(), ASCIILiteral("sqlError"), &sqlError_valueFound, protocolErrors.get());
     bool screenColor_valueFound = false;
-    String in_screenColor = InspectorBackendDispatcher::getString(paramsContainerPtr, ASCIILiteral("screenColor"), &screenColor_valueFound, protocolErrorsPtr);
+    String in_screenColor = InspectorBackendDispatcher::getString(paramsContainer.get(), ASCIILiteral("screenColor"), &screenColor_valueFound, protocolErrors.get());
     bool printColor_valueFound = false;
-    String in_printColor = InspectorBackendDispatcher::getString(paramsContainerPtr, ASCIILiteral("printColor"), &printColor_valueFound, protocolErrorsPtr);
+    String in_printColor = InspectorBackendDispatcher::getString(paramsContainer.get(), ASCIILiteral("printColor"), &printColor_valueFound, protocolErrors.get());
     if (protocolErrors->length()) {
         String errorMessage = String::format("Some arguments of method '%s' can't be processed", "Database.executeAllOptionalParameters");
-        m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::InvalidParams, errorMessage, protocolErrors.release());
+        m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::InvalidParams, errorMessage, WTF::move(protocolErrors));
         return;
     }
 
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
     if (m_alternateDispatcher) {
-        m_alternateDispatcher->executeAllOptionalParameters(callId, columnNames_valueFound ? &in_columnNames : nullptr, notes_valueFound ? &in_notes : nullptr, timestamp_valueFound ? &in_timestamp : nullptr, values_valueFound ? &in_values : nullptr, payload_valueFound ? &in_payload : nullptr, databaseId_valueFound ? &in_databaseId : nullptr, sqlError_valueFound ? &in_sqlError : nullptr, screenColor_valueFound ? &in_screenColor : nullptr, printColor_valueFound ? &in_printColor : nullptr);
+        m_alternateDispatcher->executeAllOptionalParameters(callId, columnNames_valueFound ? in_columnNames.copyRef() : nullptr, notes_valueFound ? &in_notes : nullptr, timestamp_valueFound ? &in_timestamp : nullptr, values_valueFound ? in_values.copyRef() : nullptr, payload_valueFound ? in_payload.copyRef() : nullptr, databaseId_valueFound ? &in_databaseId : nullptr, sqlError_valueFound ? in_sqlError.copyRef() : nullptr, screenColor_valueFound ? &in_screenColor : nullptr, printColor_valueFound ? &in_printColor : nullptr);
         return;
     }
 #endif
 
     ErrorString error;
-    RefPtr<InspectorObject> result = InspectorObject::create();
+    Ref<InspectorObject> result = InspectorObject::create();
     RefPtr<Inspector::Protocol::Array<String>> out_columnNames;
     Inspector::Protocol::OptOutput<String> out_notes;
     Inspector::Protocol::OptOutput<double> out_timestamp;
@@ -318,7 +316,7 @@ void InspectorDatabaseBackendDispatcher::executeAllOptionalParameters(long callI
     RefPtr<Inspector::Protocol::Database::Error> out_sqlError;
     Inspector::Protocol::Database::PrimaryColors out_screenColor;
     InspectorDatabaseBackendDispatcherHandler::PrintColor out_printColor;
-    m_agent->executeAllOptionalParameters(error, columnNames_valueFound ? &in_columnNames : nullptr, notes_valueFound ? &in_notes : nullptr, timestamp_valueFound ? &in_timestamp : nullptr, values_valueFound ? &in_values : nullptr, payload_valueFound ? &in_payload : nullptr, databaseId_valueFound ? &in_databaseId : nullptr, sqlError_valueFound ? &in_sqlError : nullptr, screenColor_valueFound ? &in_screenColor : nullptr, printColor_valueFound ? &in_printColor : nullptr, out_columnNames, &out_notes, &out_timestamp, out_values, &out_payload, &out_databaseId, out_sqlError, &out_screenColor, &out_printColor);
+    m_agent->executeAllOptionalParameters(error, columnNames_valueFound ? in_columnNames.copyRef() : nullptr, notes_valueFound ? &in_notes : nullptr, timestamp_valueFound ? &in_timestamp : nullptr, values_valueFound ? in_values.copyRef() : nullptr, payload_valueFound ? in_payload.copyRef() : nullptr, databaseId_valueFound ? &in_databaseId : nullptr, sqlError_valueFound ? in_sqlError.copyRef() : nullptr, screenColor_valueFound ? &in_screenColor : nullptr, printColor_valueFound ? &in_printColor : nullptr, out_columnNames, &out_notes, &out_timestamp, out_values, &out_payload, &out_databaseId, out_sqlError, &out_screenColor, &out_printColor);
 
     if (!error.length()) {
         if (out_columnNames)
@@ -340,39 +338,38 @@ void InspectorDatabaseBackendDispatcher::executeAllOptionalParameters(long callI
         if (out_printColor.isAssigned())
             result->setString(ASCIILiteral("printColor"), out_printColor.getValue());
     }
-    m_backendDispatcher->sendResponse(callId, result.release(), error);
+    m_backendDispatcher->sendResponse(callId, WTF::move(result), error);
 }
 
 void InspectorDatabaseBackendDispatcher::executeNoOptionalParameters(long callId, const InspectorObject& message)
 {
-    RefPtr<InspectorArray> protocolErrors = InspectorArray::create();
-    RefPtr<InspectorObject> paramsContainer = message.getObject(ASCIILiteral("params"));
-    InspectorObject* paramsContainerPtr = paramsContainer.get();
-    InspectorArray* protocolErrorsPtr = protocolErrors.get();
-    RefPtr<Inspector::InspectorArray> in_columnNames = InspectorBackendDispatcher::getArray(paramsContainerPtr, ASCIILiteral("columnNames"), nullptr, protocolErrorsPtr);
-    String in_notes = InspectorBackendDispatcher::getString(paramsContainerPtr, ASCIILiteral("notes"), nullptr, protocolErrorsPtr);
-    double in_timestamp = InspectorBackendDispatcher::getDouble(paramsContainerPtr, ASCIILiteral("timestamp"), nullptr, protocolErrorsPtr);
-    RefPtr<Inspector::InspectorObject> in_values = InspectorBackendDispatcher::getObject(paramsContainerPtr, ASCIILiteral("values"), nullptr, protocolErrorsPtr);
-    RefPtr<Inspector::InspectorValue> in_payload = InspectorBackendDispatcher::getValue(paramsContainerPtr, ASCIILiteral("payload"), nullptr, protocolErrorsPtr);
-    int in_databaseId = InspectorBackendDispatcher::getInteger(paramsContainerPtr, ASCIILiteral("databaseId"), nullptr, protocolErrorsPtr);
-    RefPtr<Inspector::InspectorObject> in_sqlError = InspectorBackendDispatcher::getObject(paramsContainerPtr, ASCIILiteral("sqlError"), nullptr, protocolErrorsPtr);
-    String in_screenColor = InspectorBackendDispatcher::getString(paramsContainerPtr, ASCIILiteral("screenColor"), nullptr, protocolErrorsPtr);
-    String in_printColor = InspectorBackendDispatcher::getString(paramsContainerPtr, ASCIILiteral("printColor"), nullptr, protocolErrorsPtr);
+    auto protocolErrors = Inspector::Protocol::Array<String>::create();
+    RefPtr<InspectorObject> paramsContainer;
+    message.getObject(ASCIILiteral("params"), paramsContainer);
+    RefPtr<Inspector::InspectorArray> in_columnNames = InspectorBackendDispatcher::getArray(paramsContainer.get(), ASCIILiteral("columnNames"), nullptr, protocolErrors.get());
+    String in_notes = InspectorBackendDispatcher::getString(paramsContainer.get(), ASCIILiteral("notes"), nullptr, protocolErrors.get());
+    double in_timestamp = InspectorBackendDispatcher::getDouble(paramsContainer.get(), ASCIILiteral("timestamp"), nullptr, protocolErrors.get());
+    RefPtr<Inspector::InspectorObject> in_values = InspectorBackendDispatcher::getObject(paramsContainer.get(), ASCIILiteral("values"), nullptr, protocolErrors.get());
+    RefPtr<Inspector::InspectorValue> in_payload = InspectorBackendDispatcher::getValue(paramsContainer.get(), ASCIILiteral("payload"), nullptr, protocolErrors.get());
+    int in_databaseId = InspectorBackendDispatcher::getInteger(paramsContainer.get(), ASCIILiteral("databaseId"), nullptr, protocolErrors.get());
+    RefPtr<Inspector::InspectorObject> in_sqlError = InspectorBackendDispatcher::getObject(paramsContainer.get(), ASCIILiteral("sqlError"), nullptr, protocolErrors.get());
+    String in_screenColor = InspectorBackendDispatcher::getString(paramsContainer.get(), ASCIILiteral("screenColor"), nullptr, protocolErrors.get());
+    String in_printColor = InspectorBackendDispatcher::getString(paramsContainer.get(), ASCIILiteral("printColor"), nullptr, protocolErrors.get());
     if (protocolErrors->length()) {
         String errorMessage = String::format("Some arguments of method '%s' can't be processed", "Database.executeNoOptionalParameters");
-        m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::InvalidParams, errorMessage, protocolErrors.release());
+        m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::InvalidParams, errorMessage, WTF::move(protocolErrors));
         return;
     }
 
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
     if (m_alternateDispatcher) {
-        m_alternateDispatcher->executeNoOptionalParameters(callId, in_columnNames, in_notes, in_timestamp, in_values, in_payload, in_databaseId, in_sqlError, in_screenColor, in_printColor);
+        m_alternateDispatcher->executeNoOptionalParameters(callId, in_columnNames.copyRef(), in_notes, in_timestamp, in_values.copyRef(), in_payload.copyRef(), in_databaseId, in_sqlError.copyRef(), in_screenColor, in_printColor);
         return;
     }
 #endif
 
     ErrorString error;
-    RefPtr<InspectorObject> result = InspectorObject::create();
+    Ref<InspectorObject> result = InspectorObject::create();
     RefPtr<Inspector::Protocol::Array<String>> out_columnNames;
     String out_notes;
     double out_timestamp;
@@ -382,7 +379,7 @@ void InspectorDatabaseBackendDispatcher::executeNoOptionalParameters(long callId
     RefPtr<Inspector::Protocol::Database::Error> out_sqlError;
     Inspector::Protocol::Database::PrimaryColors out_screenColor;
     InspectorDatabaseBackendDispatcherHandler::PrintColor out_printColor;
-    m_agent->executeNoOptionalParameters(error, in_columnNames, in_notes, in_timestamp, in_values, in_payload, in_databaseId, in_sqlError, in_screenColor, in_printColor, out_columnNames, &out_notes, &out_timestamp, out_values, &out_payload, &out_databaseId, out_sqlError, &out_screenColor, &out_printColor);
+    m_agent->executeNoOptionalParameters(error, in_columnNames.copyRef(), in_notes, in_timestamp, in_values.copyRef(), in_payload.copyRef(), in_databaseId, in_sqlError.copyRef(), in_screenColor, in_printColor, out_columnNames, &out_notes, &out_timestamp, out_values, &out_payload, &out_databaseId, out_sqlError, &out_screenColor, &out_printColor);
 
     if (!error.length()) {
         result->setArray(ASCIILiteral("columnNames"), out_columnNames);
@@ -395,7 +392,7 @@ void InspectorDatabaseBackendDispatcher::executeNoOptionalParameters(long callId
         result->setString(ASCIILiteral("screenColor"), Inspector::Protocol::getEnumConstantValue(out_screenColor));
         result->setString(ASCIILiteral("printColor"), Inspector::Protocol::getEnumConstantValue(out_printColor));
     }
-    m_backendDispatcher->sendResponse(callId, result.release(), error);
+    m_backendDispatcher->sendResponse(callId, WTF::move(result), error);
 }
 
 } // namespace Inspector
@@ -443,7 +440,6 @@ void InspectorDatabaseBackendDispatcher::executeNoOptionalParameters(long callId
 #include "InspectorProtocolObjects.h"
 #include <inspector/InspectorFrontendChannel.h>
 #include <inspector/InspectorValues.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -541,7 +537,6 @@ namespace Inspector {
 
 #include <inspector/InspectorProtocolTypes.h>
 #include <wtf/Assertions.h>
-#include <wtf/PassRefPtr.h>
 
 namespace Inspector {
 
@@ -598,10 +593,10 @@ public:
             return *reinterpret_cast<Builder<STATE | STEP>*>(this);
         }
 
-        Builder(PassRefPtr</*Error*/Inspector::InspectorObject> ptr)
+        Builder(Ref</*Error*/Inspector::InspectorObject>&& object)
+            : m_result(WTF::move(object))
         {
             COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
-            m_result = ptr;
         }
         friend class Error;
     public:
@@ -620,30 +615,27 @@ public:
             return castState<CodeSet>();
         }
 
-        operator RefPtr<Error>& ()
+        Ref<Error> release()
         {
             COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
             COMPILE_ASSERT(sizeof(Error) == sizeof(Inspector::InspectorObject), cannot_cast);
-            return *reinterpret_cast<RefPtr<Error>*>(&m_result);
-        }
 
-        PassRefPtr<Error> release()
-        {
-            return RefPtr<Error>(*this).release();
+            Ref<Inspector::InspectorObject> result = m_result.releaseNonNull();
+            return WTF::move(*reinterpret_cast<Ref<Error>*>(&result));
         }
     };
 
     /*
      * Synthetic constructor:
-     * RefPtr<Error> result = Error::create()
+     * Ref<Error> result = Error::create()
      *     .setMessage(...)
-     *     .setCode(...);
+     *     .setCode(...)
+     *     .release();
      */
     static Builder<NoFieldsSet> create()
     {
         return Builder<NoFieldsSet>(Inspector::InspectorObject::create());
     }
-    typedef Inspector::Protocol::StructItemTraits ItemTraits;
 };
 
 } // Database
@@ -767,8 +759,8 @@ namespace Inspector {
 class ObjCInspectorDatabaseBackendDispatcher final : public AlternateInspectorDatabaseBackendDispatcher {
 public:
     ObjCInspectorDatabaseBackendDispatcher(id<RWIProtocolDatabaseDomainHandler> handler) { m_delegate = handler; }
-    virtual void executeAllOptionalParameters(long callId, const RefPtr<Inspector::InspectorArray>* in_columnNames, const String* in_notes, const double* in_timestamp, const RefPtr<Inspector::InspectorObject>* in_values, const Inspector::InspectorValue* in_payload, const int* in_databaseId, const RefPtr<Inspector::InspectorObject>* in_sqlError, const String* in_screenColor, const String* in_printColor) override;
-    virtual void executeNoOptionalParameters(long callId, const RefPtr<Inspector::InspectorArray>& in_columnNames, const String& in_notes, double in_timestamp, const RefPtr<Inspector::InspectorObject>& in_values, Inspector::InspectorValue in_payload, int in_databaseId, const RefPtr<Inspector::InspectorObject>& in_sqlError, const String& in_screenColor, const String& in_printColor) override;
+    virtual void executeAllOptionalParameters(long callId, const RefPtr<Inspector::InspectorArray>&& in_columnNames, const String* in_notes, const double* in_timestamp, const RefPtr<Inspector::InspectorObject>&& in_values, const Inspector::InspectorValue* in_payload, const int* in_databaseId, const RefPtr<Inspector::InspectorObject>&& in_sqlError, const String* in_screenColor, const String* in_printColor) override;
+    virtual void executeNoOptionalParameters(long callId, const RefPtr<Inspector::InspectorArray>&& in_columnNames, const String& in_notes, double in_timestamp, const RefPtr<Inspector::InspectorObject>&& in_values, Inspector::InspectorValue in_payload, int in_databaseId, const RefPtr<Inspector::InspectorObject>&& in_sqlError, const String& in_screenColor, const String& in_printColor) override;
 private:
     RetainPtr<id<RWIProtocolDatabaseDomainHandler>> m_delegate;
 };
@@ -947,14 +939,14 @@ __attribute__((visibility ("default")))
 
 namespace Inspector {
 
-void ObjCInspectorDatabaseBackendDispatcher::executeAllOptionalParameters(long callId, const RefPtr<Inspector::InspectorArray>* in_columnNames, const String* in_notes, const double* in_timestamp, const RefPtr<Inspector::InspectorObject>* in_values, const Inspector::InspectorValue* in_payload, const int* in_databaseId, const RefPtr<Inspector::InspectorObject>* in_sqlError, const String* in_screenColor, const String* in_printColor)
+void ObjCInspectorDatabaseBackendDispatcher::executeAllOptionalParameters(long callId, const RefPtr<Inspector::InspectorArray>&& in_columnNames, const String* in_notes, const double* in_timestamp, const RefPtr<Inspector::InspectorObject>&& in_values, const Inspector::InspectorValue* in_payload, const int* in_databaseId, const RefPtr<Inspector::InspectorObject>&& in_sqlError, const String* in_screenColor, const String* in_printColor)
 {
     id errorCallback = ^(NSString *error) {
         backendDispatcher()->sendResponse(callId, InspectorObject::create(), error);
     };
 
     id successCallback = ^(NSArray/*<NSString>*/ **columnNames, NSString **notes, double *timestamp, RWIProtocolJSONObject **values, RWIProtocolJSONObject **payload, int *databaseId, RWIProtocolDatabaseError **sqlError, RWIProtocolDatabasePrimaryColors *screenColor, RWIProtocolDatabaseExecuteAllOptionalParametersPrintColor *printColor) {
-        RefPtr<InspectorObject> resultObject = InspectorObject::create();
+        Ref<InspectorObject> resultObject = InspectorObject::create();
         THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(columnNames, @"columnNames");
         THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(notes, @"notes");
         THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(values, @"values");
@@ -978,12 +970,12 @@ void ObjCInspectorDatabaseBackendDispatcher::executeAllOptionalParameters(long c
             resultObject->setString(ASCIILiteral("screenColor"), toProtocolString(*screenColor));
         if (printColor)
             resultObject->setString(ASCIILiteral("printColor"), toProtocolString(*printColor));
-        backendDispatcher()->sendResponse(callId, resultObject.release(), String());
+        backendDispatcher()->sendResponse(callId, WTF::move(resultObject), String());
     };
 
     NSArray/*<NSString>*/ *o_in_columnNames;
     if (in_columnNames)
-        o_in_columnNames = objcStringArray(*in_columnNames);
+        o_in_columnNames = objcStringArray(in_columnNames.copyRef());
     NSString *o_in_notes;
     if (in_notes)
         o_in_notes = *in_notes;
@@ -1001,7 +993,7 @@ void ObjCInspectorDatabaseBackendDispatcher::executeAllOptionalParameters(long c
         o_in_databaseId = *in_databaseId;
     RWIProtocolDatabaseError *o_in_sqlError;
     if (in_sqlError)
-        o_in_sqlError = [[[RWIProtocolDatabaseError alloc] initWithInspectorObject:*in_sqlError] autorelease];
+        o_in_sqlError = [[[RWIProtocolDatabaseError alloc] initWithInspectorObject:in_sqlError.copyRef()] autorelease];
     RWIProtocolDatabasePrimaryColors o_in_screenColor;
     if (in_screenColor)
         o_in_screenColor = fromProtocolString<RWIProtocolDatabasePrimaryColors>(*in_screenColor);
@@ -1012,14 +1004,14 @@ void ObjCInspectorDatabaseBackendDispatcher::executeAllOptionalParameters(long c
     [m_delegate executeAllOptionalParametersWithErrorCallback:errorCallback successCallback:successCallback columnNames:(in_columnNames ? &o_in_columnNames : nil) notes:(in_notes ? &o_in_notes : nil) timestamp:(in_timestamp ? &o_in_timestamp : nil) values:(in_values ? &o_in_values : nil) payload:(in_payload ? &o_in_payload : nil) databaseId:(in_databaseId ? &o_in_databaseId : nil) sqlError:(in_sqlError ? &o_in_sqlError : nil) screenColor:(in_screenColor ? &o_in_screenColor : nil) printColor:(in_printColor ? &o_in_printColor : nil)];
 }
 
-void ObjCInspectorDatabaseBackendDispatcher::executeNoOptionalParameters(long callId, const RefPtr<Inspector::InspectorArray>& in_columnNames, const String& in_notes, double in_timestamp, const RefPtr<Inspector::InspectorObject>& in_values, Inspector::InspectorValue in_payload, int in_databaseId, const RefPtr<Inspector::InspectorObject>& in_sqlError, const String& in_screenColor, const String& in_printColor)
+void ObjCInspectorDatabaseBackendDispatcher::executeNoOptionalParameters(long callId, const RefPtr<Inspector::InspectorArray>&& in_columnNames, const String& in_notes, double in_timestamp, const RefPtr<Inspector::InspectorObject>&& in_values, Inspector::InspectorValue in_payload, int in_databaseId, const RefPtr<Inspector::InspectorObject>&& in_sqlError, const String& in_screenColor, const String& in_printColor)
 {
     id errorCallback = ^(NSString *error) {
         backendDispatcher()->sendResponse(callId, InspectorObject::create(), error);
     };
 
     id successCallback = ^(NSArray/*<NSString>*/ *columnNames, NSString *notes, double timestamp, RWIProtocolJSONObject *values, RWIProtocolJSONObject *payload, int databaseId, RWIProtocolDatabaseError *sqlError, RWIProtocolDatabasePrimaryColors screenColor, RWIProtocolDatabaseExecuteNoOptionalParametersPrintColor printColor) {
-        RefPtr<InspectorObject> resultObject = InspectorObject::create();
+        Ref<InspectorObject> resultObject = InspectorObject::create();
         THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(columnNames, @"columnNames");
         THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(notes, @"notes");
         THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(values, @"values");
@@ -1034,16 +1026,16 @@ void ObjCInspectorDatabaseBackendDispatcher::executeNoOptionalParameters(long ca
         resultObject->setObject(ASCIILiteral("sqlError"), [sqlError toInspectorObject]);
         resultObject->setString(ASCIILiteral("screenColor"), toProtocolString(screenColor));
         resultObject->setString(ASCIILiteral("printColor"), toProtocolString(printColor));
-        backendDispatcher()->sendResponse(callId, resultObject.release(), String());
+        backendDispatcher()->sendResponse(callId, WTF::move(resultObject), String());
     };
 
-    NSArray/*<NSString>*/ *o_in_columnNames = objcStringArray(in_columnNames);
+    NSArray/*<NSString>*/ *o_in_columnNames = objcStringArray(in_columnNames.copyRef());
     NSString *o_in_notes = in_notes;
     double o_in_timestamp = in_timestamp;
     RWIProtocolJSONObject *o_in_values = [[[RWIProtocolJSONObject alloc] initWithInspectorObject:in_values] autorelease];
     RWIProtocolJSONObject *o_in_payload = [[[RWIProtocolJSONObject alloc] initWithInspectorObject:in_payload] autorelease];
     int o_in_databaseId = in_databaseId;
-    RWIProtocolDatabaseError *o_in_sqlError = [[[RWIProtocolDatabaseError alloc] initWithInspectorObject:in_sqlError] autorelease];
+    RWIProtocolDatabaseError *o_in_sqlError = [[[RWIProtocolDatabaseError alloc] initWithInspectorObject:in_sqlError.copyRef()] autorelease];
     RWIProtocolDatabasePrimaryColors o_in_screenColor = fromProtocolString<RWIProtocolDatabasePrimaryColors>(in_screenColor);
     RWIProtocolDatabaseExecuteNoOptionalParametersPrintColor o_in_printColor = fromProtocolString<RWIProtocolDatabaseExecuteNoOptionalParametersPrintColor>(in_printColor);
 
@@ -1413,7 +1405,6 @@ __attribute__((visibility ("default")))
 #import "RWIProtocolEnumConversionHelpers.h"
 #import <JavaScriptCore/InspectorValues.h>
 #import <wtf/Assertions.h>
-#import <wtf/PassRefPtr.h>
 
 using namespace Inspector;
 
index 3822fa9..3d2d8b4 100644 (file)
@@ -41,7 +41,7 @@ namespace Inspector {
 
 class AlternateInspectorBackendDispatcher {
 public:
-    void setBackendDispatcher(PassRefPtr<InspectorBackendDispatcher> dispatcher) { m_backendDispatcher = dispatcher; }
+    void setBackendDispatcher(RefPtr<InspectorBackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(dispatcher); }
     InspectorBackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
 private:
     RefPtr<InspectorBackendDispatcher> m_backendDispatcher;
@@ -156,7 +156,6 @@ InspectorBackend.activateDomain("Network3");
 
 #include "InspectorProtocolObjects.h"
 #include <inspector/InspectorBackendDispatcher.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -190,12 +189,12 @@ protected:
 
 class InspectorNetwork1BackendDispatcher final : public Inspector::InspectorSupplementalBackendDispatcher {
 public:
-    static PassRefPtr<InspectorNetwork1BackendDispatcher> create(Inspector::InspectorBackendDispatcher*, InspectorNetwork1BackendDispatcherHandler*);
-    virtual void dispatch(long callId, const String& method, PassRefPtr<Inspector::InspectorObject> message) override;
+    static Ref<InspectorNetwork1BackendDispatcher> create(Inspector::InspectorBackendDispatcher*, InspectorNetwork1BackendDispatcherHandler*);
+    virtual void dispatch(long callId, const String& method, Ref<Inspector::InspectorObject>&& message) override;
 private:
     void loadResource1(long callId, const Inspector::InspectorObject& message);
 private:
-    InspectorNetwork1BackendDispatcher(Inspector::InspectorBackendDispatcher*, InspectorNetwork1BackendDispatcherHandler*);
+    InspectorNetwork1BackendDispatcher(Inspector::InspectorBackendDispatcher&, InspectorNetwork1BackendDispatcherHandler*);
     InspectorNetwork1BackendDispatcherHandler* m_agent;
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 public:
@@ -207,8 +206,8 @@ private:
 
 class InspectorNetwork3BackendDispatcher final : public Inspector::InspectorSupplementalBackendDispatcher {
 public:
-    static PassRefPtr<InspectorNetwork3BackendDispatcher> create(Inspector::InspectorBackendDispatcher*, InspectorNetwork3BackendDispatcherHandler*);
-    virtual void dispatch(long callId, const String& method, PassRefPtr<Inspector::InspectorObject> message) override;
+    static Ref<InspectorNetwork3BackendDispatcher> create(Inspector::InspectorBackendDispatcher*, InspectorNetwork3BackendDispatcherHandler*);
+    virtual void dispatch(long callId, const String& method, Ref<Inspector::InspectorObject>&& message) override;
 private:
     void loadResource1(long callId, const Inspector::InspectorObject& message);
     void loadResource2(long callId, const Inspector::InspectorObject& message);
@@ -218,7 +217,7 @@ private:
     void loadResource6(long callId, const Inspector::InspectorObject& message);
     void loadResource7(long callId, const Inspector::InspectorObject& message);
 private:
-    InspectorNetwork3BackendDispatcher(Inspector::InspectorBackendDispatcher*, InspectorNetwork3BackendDispatcherHandler*);
+    InspectorNetwork3BackendDispatcher(Inspector::InspectorBackendDispatcher&, InspectorNetwork3BackendDispatcherHandler*);
     InspectorNetwork3BackendDispatcherHandler* m_agent;
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 public:
@@ -284,12 +283,12 @@ namespace Inspector {
 InspectorNetwork1BackendDispatcherHandler::~InspectorNetwork1BackendDispatcherHandler() { }
 InspectorNetwork3BackendDispatcherHandler::~InspectorNetwork3BackendDispatcherHandler() { }
 
-PassRefPtr<InspectorNetwork1BackendDispatcher> InspectorNetwork1BackendDispatcher::create(InspectorBackendDispatcher* backendDispatcher, InspectorNetwork1BackendDispatcherHandler* agent)
+Ref<InspectorNetwork1BackendDispatcher> InspectorNetwork1BackendDispatcher::create(InspectorBackendDispatcher* backendDispatcher, InspectorNetwork1BackendDispatcherHandler* agent)
 {
-    return adoptRef(new InspectorNetwork1BackendDispatcher(backendDispatcher, agent));
+    return adoptRef(*new InspectorNetwork1BackendDispatcher(*backendDispatcher, agent));
 }
 
-InspectorNetwork1BackendDispatcher::InspectorNetwork1BackendDispatcher(InspectorBackendDispatcher* backendDispatcher, InspectorNetwork1BackendDispatcherHandler* agent)
+InspectorNetwork1BackendDispatcher::InspectorNetwork1BackendDispatcher(InspectorBackendDispatcher& backendDispatcher, InspectorNetwork1BackendDispatcherHandler* agent)
     : InspectorSupplementalBackendDispatcher(backendDispatcher)
     , m_agent(agent)
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
@@ -299,12 +298,12 @@ InspectorNetwork1BackendDispatcher::InspectorNetwork1BackendDispatcher(Inspector
     m_backendDispatcher->registerDispatcherForDomain(ASCIILiteral("Network1"), this);
 }
 
-void InspectorNetwork1BackendDispatcher::dispatch(long callId, const String& method, PassRefPtr<InspectorObject> message)
+void InspectorNetwork1BackendDispatcher::dispatch(long callId, const String& method, Ref<InspectorObject>&& message)
 {
     Ref<InspectorNetwork1BackendDispatcher> protect(*this);
 
     if (method == "loadResource1")
-        loadResource1(callId, *message.get());
+        loadResource1(callId, message);
     else
         m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::MethodNotFound, makeString('\'', "Network1", '.', method, "' was not found"));
 }
@@ -319,18 +318,18 @@ void InspectorNetwork1BackendDispatcher::loadResource1(long callId, const Inspec
 #endif
 
     ErrorString error;
-    RefPtr<InspectorObject> result = InspectorObject::create();
+    Ref<InspectorObject> result = InspectorObject::create();
     m_agent->loadResource1(error);
 
-    m_backendDispatcher->sendResponse(callId, result.release(), error);
+    m_backendDispatcher->sendResponse(callId, WTF::move(result), error);
 }
 
-PassRefPtr<InspectorNetwork3BackendDispatcher> InspectorNetwork3BackendDispatcher::create(InspectorBackendDispatcher* backendDispatcher, InspectorNetwork3BackendDispatcherHandler* agent)
+Ref<InspectorNetwork3BackendDispatcher> InspectorNetwork3BackendDispatcher::create(InspectorBackendDispatcher* backendDispatcher, InspectorNetwork3BackendDispatcherHandler* agent)
 {
-    return adoptRef(new InspectorNetwork3BackendDispatcher(backendDispatcher, agent));
+    return adoptRef(*new InspectorNetwork3BackendDispatcher(*backendDispatcher, agent));
 }
 
-InspectorNetwork3BackendDispatcher::InspectorNetwork3BackendDispatcher(InspectorBackendDispatcher* backendDispatcher, InspectorNetwork3BackendDispatcherHandler* agent)
+InspectorNetwork3BackendDispatcher::InspectorNetwork3BackendDispatcher(InspectorBackendDispatcher& backendDispatcher, InspectorNetwork3BackendDispatcherHandler* agent)
     : InspectorSupplementalBackendDispatcher(backendDispatcher)
     , m_agent(agent)
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
@@ -340,7 +339,7 @@ InspectorNetwork3BackendDispatcher::InspectorNetwork3BackendDispatcher(Inspector
     m_backendDispatcher->registerDispatcherForDomain(ASCIILiteral("Network3"), this);
 }
 
-void InspectorNetwork3BackendDispatcher::dispatch(long callId, const String& method, PassRefPtr<InspectorObject> message)
+void InspectorNetwork3BackendDispatcher::dispatch(long callId, const String& method, Ref<InspectorObject>&& message)
 {
     Ref<InspectorNetwork3BackendDispatcher> protect(*this);
 
@@ -371,7 +370,7 @@ void InspectorNetwork3BackendDispatcher::dispatch(long callId, const String& met
         return;
     }
 
-    ((*this).*it->value)(callId, *message.get());
+    ((*this).*it->value)(callId, message.get());
 }
 
 void InspectorNetwork3BackendDispatcher::loadResource1(long callId, const InspectorObject&)
@@ -384,10 +383,10 @@ void InspectorNetwork3BackendDispatcher::loadResource1(long callId, const Inspec
 #endif
 
     ErrorString error;
-    RefPtr<InspectorObject> result = InspectorObject::create();
+    Ref<InspectorObject> result = InspectorObject::create();
     m_agent->loadResource1(error);
 
-    m_backendDispatcher->sendResponse(callId, result.release(), error);
+    m_backendDispatcher->sendResponse(callId, WTF::move(result), error);
 }
 
 void InspectorNetwork3BackendDispatcher::loadResource2(long callId, const InspectorObject&)
@@ -400,10 +399,10 @@ void InspectorNetwork3BackendDispatcher::loadResource2(long callId, const Inspec
 #endif
 
     ErrorString error;
-    RefPtr<InspectorObject> result = InspectorObject::create();
+    Ref<InspectorObject> result = InspectorObject::create();
     m_agent->loadResource2(error);
 
-    m_backendDispatcher->sendResponse(callId, result.release(), error);
+    m_backendDispatcher->sendResponse(callId, WTF::move(result), error);
 }
 
 void InspectorNetwork3BackendDispatcher::loadResource3(long callId, const InspectorObject&)
@@ -416,10 +415,10 @@ void InspectorNetwork3BackendDispatcher::loadResource3(long callId, const Inspec
 #endif
 
     ErrorString error;
-    RefPtr<InspectorObject> result = InspectorObject::create();
+    Ref<InspectorObject> result = InspectorObject::create();
     m_agent->loadResource3(error);
 
-    m_backendDispatcher->sendResponse(callId, result.release(), error);
+    m_backendDispatcher->sendResponse(callId, WTF::move(result), error);
 }
 
 void InspectorNetwork3BackendDispatcher::loadResource4(long callId, const InspectorObject&)
@@ -432,10 +431,10 @@ void InspectorNetwork3BackendDispatcher::loadResource4(long callId, const Inspec
 #endif
 
     ErrorString error;
-    RefPtr<InspectorObject> result = InspectorObject::create();
+    Ref<InspectorObject> result = InspectorObject::create();
     m_agent->loadResource4(error);
 
-    m_backendDispatcher->sendResponse(callId, result.release(), error);
+    m_backendDispatcher->sendResponse(callId, WTF::move(result), error);
 }
 
 void InspectorNetwork3BackendDispatcher::loadResource5(long callId, const InspectorObject&)
@@ -448,10 +447,10 @@ void InspectorNetwork3BackendDispatcher::loadResource5(long callId, const Inspec
 #endif
 
     ErrorString error;
-    RefPtr<InspectorObject> result = InspectorObject::create();
+    Ref<InspectorObject> result = InspectorObject::create();
     m_agent->loadResource5(error);
 
-    m_backendDispatcher->sendResponse(callId, result.release(), error);
+    m_backendDispatcher->sendResponse(callId, WTF::move(result), error);
 }
 
 void InspectorNetwork3BackendDispatcher::loadResource6(long callId, const InspectorObject&)
@@ -464,10 +463,10 @@ void InspectorNetwork3BackendDispatcher::loadResource6(long callId, const Inspec
 #endif
 
     ErrorString error;
-    RefPtr<InspectorObject> result = InspectorObject::create();
+    Ref<InspectorObject> result = InspectorObject::create();
     m_agent->loadResource6(error);
 
-    m_backendDispatcher->sendResponse(callId, result.release(), error);
+    m_backendDispatcher->sendResponse(callId, WTF::move(result), error);
 }
 
 void InspectorNetwork3BackendDispatcher::loadResource7(long callId, const InspectorObject&)
@@ -480,10 +479,10 @@ void InspectorNetwork3BackendDispatcher::loadResource7(long callId, const Inspec
 #endif
 
     ErrorString error;
-    RefPtr<InspectorObject> result = InspectorObject::create();
+    Ref<InspectorObject> result = InspectorObject::create();
     m_agent->loadResource7(error);
 
-    m_backendDispatcher->sendResponse(callId, result.release(), error);
+    m_backendDispatcher->sendResponse(callId, WTF::move(result), error);
 }
 
 } // namespace Inspector
@@ -531,7 +530,6 @@ void InspectorNetwork3BackendDispatcher::loadResource7(long callId, const Inspec
 #include "InspectorProtocolObjects.h"
 #include <inspector/InspectorFrontendChannel.h>
 #include <inspector/InspectorValues.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -629,7 +627,6 @@ namespace Inspector {
 
 #include <inspector/InspectorProtocolTypes.h>
 #include <wtf/Assertions.h>
-#include <wtf/PassRefPtr.h>
 
 namespace Inspector {
 
@@ -1292,7 +1289,6 @@ using namespace Inspector;
 #import "RWIProtocolEnumConversionHelpers.h"
 #import <JavaScriptCore/InspectorValues.h>
 #import <wtf/Assertions.h>
-#import <wtf/PassRefPtr.h>
 
 using namespace Inspector;
 
index 8dc9c1f..fae9186 100644 (file)
@@ -41,7 +41,7 @@ namespace Inspector {
 
 class AlternateInspectorBackendDispatcher {
 public:
-    void setBackendDispatcher(PassRefPtr<InspectorBackendDispatcher> dispatcher) { m_backendDispatcher = dispatcher; }
+    void setBackendDispatcher(RefPtr<InspectorBackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(dispatcher); }
     InspectorBackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
 private:
     RefPtr<InspectorBackendDispatcher> m_backendDispatcher;
@@ -144,7 +144,6 @@ InspectorBackend.activateDomain("EventDomain");
 
 #include "InspectorProtocolObjects.h"
 #include <inspector/InspectorBackendDispatcher.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -171,12 +170,12 @@ protected:
 
 class InspectorCommandDomainBackendDispatcher final : public Inspector::InspectorSupplementalBackendDispatcher {
 public:
-    static PassRefPtr<InspectorCommandDomainBackendDispatcher> create(Inspector::InspectorBackendDispatcher*, InspectorCommandDomainBackendDispatcherHandler*);
-    virtual void dispatch(long callId, const String& method, PassRefPtr<Inspector::InspectorObject> message) override;
+    static Ref<InspectorCommandDomainBackendDispatcher> create(Inspector::InspectorBackendDispatcher*, InspectorCommandDomainBackendDispatcherHandler*);
+    virtual void dispatch(long callId, const String& method, Ref<Inspector::InspectorObject>&& message) override;
 private:
     void commandWithEnumReturnValue(long callId, const Inspector::InspectorObject& message);
 private:
-    InspectorCommandDomainBackendDispatcher(Inspector::InspectorBackendDispatcher*, InspectorCommandDomainBackendDispatcherHandler*);
+    InspectorCommandDomainBackendDispatcher(Inspector::InspectorBackendDispatcher&, InspectorCommandDomainBackendDispatcherHandler*);
     InspectorCommandDomainBackendDispatcherHandler* m_agent;
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 public:
@@ -241,12 +240,12 @@ namespace Inspector {
 
 InspectorCommandDomainBackendDispatcherHandler::~InspectorCommandDomainBackendDispatcherHandler() { }
 
-PassRefPtr<InspectorCommandDomainBackendDispatcher> InspectorCommandDomainBackendDispatcher::create(InspectorBackendDispatcher* backendDispatcher, InspectorCommandDomainBackendDispatcherHandler* agent)
+Ref<InspectorCommandDomainBackendDispatcher> InspectorCommandDomainBackendDispatcher::create(InspectorBackendDispatcher* backendDispatcher, InspectorCommandDomainBackendDispatcherHandler* agent)
 {
-    return adoptRef(new InspectorCommandDomainBackendDispatcher(backendDispatcher, agent));
+    return adoptRef(*new InspectorCommandDomainBackendDispatcher(*backendDispatcher, agent));
 }
 
-InspectorCommandDomainBackendDispatcher::InspectorCommandDomainBackendDispatcher(InspectorBackendDispatcher* backendDispatcher, InspectorCommandDomainBackendDispatcherHandler* agent)
+InspectorCommandDomainBackendDispatcher::InspectorCommandDomainBackendDispatcher(InspectorBackendDispatcher& backendDispatcher, InspectorCommandDomainBackendDispatcherHandler* agent)
     : InspectorSupplementalBackendDispatcher(backendDispatcher)
     , m_agent(agent)
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
@@ -256,12 +255,12 @@ InspectorCommandDomainBackendDispatcher::InspectorCommandDomainBackendDispatcher
     m_backendDispatcher->registerDispatcherForDomain(ASCIILiteral("CommandDomain"), this);
 }
 
-void InspectorCommandDomainBackendDispatcher::dispatch(long callId, const String& method, PassRefPtr<InspectorObject> message)
+void InspectorCommandDomainBackendDispatcher::dispatch(long callId, const String& method, Ref<InspectorObject>&& message)
 {
     Ref<InspectorCommandDomainBackendDispatcher> protect(*this);
 
     if (method == "commandWithEnumReturnValue")
-        commandWithEnumReturnValue(callId, *message.get());
+        commandWithEnumReturnValue(callId, message);
     else
         m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::MethodNotFound, makeString('\'', "CommandDomain", '.', method, "' was not found"));
 }
@@ -276,14 +275,14 @@ void InspectorCommandDomainBackendDispatcher::commandWithEnumReturnValue(long ca
 #endif
 
     ErrorString error;
-    RefPtr<InspectorObject> result = InspectorObject::create();
+    Ref<InspectorObject> result = InspectorObject::create();
     InspectorCommandDomainBackendDispatcherHandler::ReturnValue out_returnValue;
     m_agent->commandWithEnumReturnValue(error, &out_returnValue);
 
     if (!error.length())
         result->setString(ASCIILiteral("returnValue"), Inspector::Protocol::getEnumConstantValue(out_returnValue));
 
-    m_backendDispatcher->sendResponse(callId, result.release(), error);
+    m_backendDispatcher->sendResponse(callId, WTF::move(result), error);
 }
 
 } // namespace Inspector
@@ -331,7 +330,6 @@ void InspectorCommandDomainBackendDispatcher::commandWithEnumReturnValue(long ca
 #include "InspectorProtocolObjects.h"
 #include <inspector/InspectorFrontendChannel.h>
 #include <inspector/InspectorValues.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -401,11 +399,11 @@ namespace Inspector {
 
 void InspectorEventDomainFrontendDispatcher::eventWithEnumParameter(Parameter parameter)
 {
-    RefPtr<InspectorObject> jsonMessage = InspectorObject::create();
+    Ref<InspectorObject> jsonMessage = InspectorObject::create();
     jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("EventDomain.eventWithEnumParameter"));
-    RefPtr<InspectorObject> paramsObject = InspectorObject::create();
+    Ref<InspectorObject> paramsObject = InspectorObject::create();
     paramsObject->setString(ASCIILiteral("parameter"), Inspector::Protocol::getEnumConstantValue(parameter));
-    jsonMessage->setObject(ASCIILiteral("params"), paramsObject);
+    jsonMessage->setObject(ASCIILiteral("params"), paramsObject.copyRef());
 
     m_inspectorFrontendChannel->sendMessageToFrontend(jsonMessage->toJSONString());
 }
@@ -454,7 +452,6 @@ void InspectorEventDomainFrontendDispatcher::eventWithEnumParameter(Parameter pa
 
 #include <inspector/InspectorProtocolTypes.h>
 #include <wtf/Assertions.h>
-#include <wtf/PassRefPtr.h>
 
 namespace Inspector {
 
@@ -813,9 +810,9 @@ void ObjCInspectorCommandDomainBackendDispatcher::commandWithEnumReturnValue(lon
     };
 
     id successCallback = ^(RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValue returnValue) {
-        RefPtr<InspectorObject> resultObject = InspectorObject::create();
+        Ref<InspectorObject> resultObject = InspectorObject::create();
         resultObject->setString(ASCIILiteral("returnValue"), toProtocolString(returnValue));
-        backendDispatcher()->sendResponse(callId, resultObject.release(), String());
+        backendDispatcher()->sendResponse(callId, WTF::move(resultObject), String());
     };
 
     [m_delegate commandWithEnumReturnValueWithErrorCallback:errorCallback successCallback:successCallback];
@@ -1021,11 +1018,11 @@ using namespace Inspector;
     if (!frontendChannel)
         return;
 
-    RefPtr<InspectorObject> jsonMessage = InspectorObject::create();
+    Ref<InspectorObject> jsonMessage = InspectorObject::create();
     jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("EventDomain.eventWithEnumParameter"));
-    RefPtr<InspectorObject> paramsObject = InspectorObject::create();
+    Ref<InspectorObject> paramsObject = InspectorObject::create();
     paramsObject->setString(ASCIILiteral("parameter"), toProtocolString(parameter));
-    jsonMessage->setObject(ASCIILiteral("params"), paramsObject);
+    jsonMessage->setObject(ASCIILiteral("params"), paramsObject.copyRef());
     frontendChannel->sendMessageToFrontend(jsonMessage->toJSONString());
 }
 
@@ -1145,7 +1142,6 @@ __attribute__((visibility ("default")))
 #import "RWIProtocolEnumConversionHelpers.h"
 #import <JavaScriptCore/InspectorValues.h>
 #import <wtf/Assertions.h>
-#import <wtf/PassRefPtr.h>
 
 using namespace Inspector;
 
index d92ec52..686b2b4 100644 (file)
@@ -41,7 +41,7 @@ namespace Inspector {
 
 class AlternateInspectorBackendDispatcher {
 public:
-    void setBackendDispatcher(PassRefPtr<InspectorBackendDispatcher> dispatcher) { m_backendDispatcher = dispatcher; }
+    void setBackendDispatcher(RefPtr<InspectorBackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(dispatcher); }
     InspectorBackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
 private:
     RefPtr<InspectorBackendDispatcher> m_backendDispatcher;
@@ -133,7 +133,6 @@ InspectorBackend.activateDomain("Database");
 
 #include "InspectorProtocolObjects.h"
 #include <inspector/InspectorBackendDispatcher.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -242,7 +241,6 @@ namespace Inspector {
 #include "InspectorProtocolObjects.h"
 #include <inspector/InspectorFrontendChannel.h>
 #include <inspector/InspectorValues.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -252,8 +250,8 @@ namespace Inspector {
 class InspectorDatabaseFrontendDispatcher {
 public:
     InspectorDatabaseFrontendDispatcher(InspectorFrontendChannel* inspectorFrontendChannel) : m_inspectorFrontendChannel(inspectorFrontendChannel) { }
-    void didExecuteOptionalParameters(PassRefPtr<Inspector::Protocol::Array<String>> columnNames, const String* const notes, const double* const timestamp, PassRefPtr<Inspector::InspectorObject> values, PassRefPtr<Inspector::InspectorValue> payload, PassRefPtr<Inspector::Protocol::Database::Error> sqlError, const Inspector::Protocol::Database::PrimaryColors* const screenColor, const String* const printColor);
-    void didExecuteNoOptionalParameters(PassRefPtr<Inspector::Protocol::Array<String>> columnNames, const String& notes, double timestamp, PassRefPtr<Inspector::InspectorObject> values, PassRefPtr<Inspector::InspectorValue> payload, PassRefPtr<Inspector::Protocol::Database::Error> sqlError, const Inspector::Protocol::Database::PrimaryColors& screenColor, const String& printColor);
+    void didExecuteOptionalParameters(RefPtr<Inspector::Protocol::Array<String>> columnNames, const String* const notes, const double* const timestamp, RefPtr<Inspector::InspectorObject> values, RefPtr<Inspector::InspectorValue> payload, RefPtr<Inspector::Protocol::Database::Error> sqlError, const Inspector::Protocol::Database::PrimaryColors* const screenColor, const String* const printColor);
+    void didExecuteNoOptionalParameters(RefPtr<Inspector::Protocol::Array<String>> columnNames, const String& notes, double timestamp, RefPtr<Inspector::InspectorObject> values, RefPtr<Inspector::InspectorValue> payload, RefPtr<Inspector::Protocol::Database::Error> sqlError, const Inspector::Protocol::Database::PrimaryColors& screenColor, const String& printColor);
 private:
     InspectorFrontendChannel* m_inspectorFrontendChannel;
 };
@@ -305,11 +303,11 @@ private:
 
 namespace Inspector {
 
-void InspectorDatabaseFrontendDispatcher::didExecuteOptionalParameters(PassRefPtr<Inspector::Protocol::Array<String>> columnNames, const String* const notes, const double* const timestamp, PassRefPtr<Inspector::InspectorObject> values, PassRefPtr<Inspector::InspectorValue> payload, PassRefPtr<Inspector::Protocol::Database::Error> sqlError, const Inspector::Protocol::Database::PrimaryColors* const screenColor, const String* const printColor)
+void InspectorDatabaseFrontendDispatcher::didExecuteOptionalParameters(RefPtr<Inspector::Protocol::Array<String>> columnNames, const String* const notes, const double* const timestamp, RefPtr<Inspector::InspectorObject> values, RefPtr<Inspector::InspectorValue> payload, RefPtr<Inspector::Protocol::Database::Error> sqlError, const Inspector::Protocol::Database::PrimaryColors* const screenColor, const String* const printColor)
 {
-    RefPtr<InspectorObject> jsonMessage = InspectorObject::create();
+    Ref<InspectorObject> jsonMessage = InspectorObject::create();
     jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("Database.didExecuteOptionalParameters"));
-    RefPtr<InspectorObject> paramsObject = InspectorObject::create();
+    Ref<InspectorObject> paramsObject = InspectorObject::create();
     if (columnNames)
         paramsObject->setArray(ASCIILiteral("columnNames"), columnNames);
     if (notes)
@@ -326,16 +324,16 @@ void InspectorDatabaseFrontendDispatcher::didExecuteOptionalParameters(PassRefPt
         paramsObject->setString(ASCIILiteral("screenColor"), *screenColor);
     if (printColor)
         paramsObject->setString(ASCIILiteral("printColor"), *printColor);
-    jsonMessage->setObject(ASCIILiteral("params"), paramsObject);
+    jsonMessage->setObject(ASCIILiteral("params"), paramsObject.copyRef());
 
     m_inspectorFrontendChannel->sendMessageToFrontend(jsonMessage->toJSONString());
 }
 
-void InspectorDatabaseFrontendDispatcher::didExecuteNoOptionalParameters(PassRefPtr<Inspector::Protocol::Array<String>> columnNames, const String& notes, double timestamp, PassRefPtr<Inspector::InspectorObject> values, PassRefPtr<Inspector::InspectorValue> payload, PassRefPtr<Inspector::Protocol::Database::Error> sqlError, const Inspector::Protocol::Database::PrimaryColors& screenColor, const String& printColor)
+void InspectorDatabaseFrontendDispatcher::didExecuteNoOptionalParameters(RefPtr<Inspector::Protocol::Array<String>> columnNames, const String& notes, double timestamp, RefPtr<Inspector::InspectorObject> values, RefPtr<Inspector::InspectorValue> payload, RefPtr<Inspector::Protocol::Database::Error> sqlError, const Inspector::Protocol::Database::PrimaryColors& screenColor, const String& printColor)
 {
-    RefPtr<InspectorObject> jsonMessage = InspectorObject::create();
+    Ref<InspectorObject> jsonMessage = InspectorObject::create();
     jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("Database.didExecuteNoOptionalParameters"));
-    RefPtr<InspectorObject> paramsObject = InspectorObject::create();
+    Ref<InspectorObject> paramsObject = InspectorObject::create();
     paramsObject->setArray(ASCIILiteral("columnNames"), columnNames);
     paramsObject->setString(ASCIILiteral("notes"), notes);
     paramsObject->setDouble(ASCIILiteral("timestamp"), timestamp);
@@ -344,7 +342,7 @@ void InspectorDatabaseFrontendDispatcher::didExecuteNoOptionalParameters(PassRef
     paramsObject->setObject(ASCIILiteral("sqlError"), sqlError);
     paramsObject->setString(ASCIILiteral("screenColor"), screenColor);
     paramsObject->setString(ASCIILiteral("printColor"), printColor);
-    jsonMessage->setObject(ASCIILiteral("params"), paramsObject);
+    jsonMessage->setObject(ASCIILiteral("params"), paramsObject.copyRef());
 
     m_inspectorFrontendChannel->sendMessageToFrontend(jsonMessage->toJSONString());
 }
@@ -393,7 +391,6 @@ void InspectorDatabaseFrontendDispatcher::didExecuteNoOptionalParameters(PassRef
 
 #include <inspector/InspectorProtocolTypes.h>
 #include <wtf/Assertions.h>
-#include <wtf/PassRefPtr.h>
 
 namespace Inspector {
 
@@ -445,10 +442,10 @@ public:
             return *reinterpret_cast<Builder<STATE | STEP>*>(this);
         }
 
-        Builder(PassRefPtr</*Error*/Inspector::InspectorObject> ptr)
+        Builder(Ref</*Error*/Inspector::InspectorObject>&& object)
+            : m_result(WTF::move(object))
         {
             COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
-            m_result = ptr;
         }
         friend class Error;
     public:
@@ -467,30 +464,27 @@ public:
             return castState<CodeSet>();
         }
 
-        operator RefPtr<Error>& ()
+        Ref<Error> release()
         {
             COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
             COMPILE_ASSERT(sizeof(Error) == sizeof(Inspector::InspectorObject), cannot_cast);
-            return *reinterpret_cast<RefPtr<Error>*>(&m_result);
-        }
 
-        PassRefPtr<Error> release()
-        {
-            return RefPtr<Error>(*this).release();
+            Ref<Inspector::InspectorObject> result = m_result.releaseNonNull();
+            return WTF::move(*reinterpret_cast<Ref<Error>*>(&result));
         }
     };
 
     /*
      * Synthetic constructor:
-     * RefPtr<Error> result = Error::create()
+     * Ref<Error> result = Error::create()
      *     .setMessage(...)
-     *     .setCode(...);
+     *     .setCode(...)
+     *     .release();
      */
     static Builder<NoFieldsSet> create()
     {
         return Builder<NoFieldsSet>(Inspector::InspectorObject::create());
     }
-    typedef Inspector::Protocol::StructItemTraits ItemTraits;
 };
 
 } // Database
@@ -888,9 +882,9 @@ using namespace Inspector;
     THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(screenColor, @"screenColor");
     THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(printColor, @"printColor");
 
-    RefPtr<InspectorObject> jsonMessage = InspectorObject::create();
+    Ref<InspectorObject> jsonMessage = InspectorObject::create();
     jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("Database.didExecuteOptionalParameters"));
-    RefPtr<InspectorObject> paramsObject = InspectorObject::create();
+    Ref<InspectorObject> paramsObject = InspectorObject::create();
     if (columnNames)
         paramsObject->setArray(ASCIILiteral("columnNames"), inspectorStringArray((*columnNames)));
     if (notes)
@@ -907,7 +901,7 @@ using namespace Inspector;
         paramsObject->setString(ASCIILiteral("screenColor"), (*screenColor));
     if (printColor)
         paramsObject->setString(ASCIILiteral("printColor"), (*printColor));
-    jsonMessage->setObject(ASCIILiteral("params"), paramsObject);
+    jsonMessage->setObject(ASCIILiteral("params"), paramsObject.copyRef());
     frontendChannel->sendMessageToFrontend(jsonMessage->toJSONString());
 }
 
@@ -925,9 +919,9 @@ using namespace Inspector;
     THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(screenColor, @"screenColor");
     THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(printColor, @"printColor");
 
-    RefPtr<InspectorObject> jsonMessage = InspectorObject::create();
+    Ref<InspectorObject> jsonMessage = InspectorObject::create();
     jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("Database.didExecuteNoOptionalParameters"));
-    RefPtr<InspectorObject> paramsObject = InspectorObject::create();
+    Ref<InspectorObject> paramsObject = InspectorObject::create();
     paramsObject->setArray(ASCIILiteral("columnNames"), inspectorStringArray(columnNames));
     paramsObject->setString(ASCIILiteral("notes"), notes);
     paramsObject->setDouble(ASCIILiteral("timestamp"), timestamp);
@@ -936,7 +930,7 @@ using namespace Inspector;
     paramsObject->setObject(ASCIILiteral("sqlError"), [sqlError toInspectorObject]);
     paramsObject->setString(ASCIILiteral("screenColor"), screenColor);
     paramsObject->setString(ASCIILiteral("printColor"), printColor);
-    jsonMessage->setObject(ASCIILiteral("params"), paramsObject);
+    jsonMessage->setObject(ASCIILiteral("params"), paramsObject.copyRef());
     frontendChannel->sendMessageToFrontend(jsonMessage->toJSONString());
 }
 
@@ -1041,7 +1035,6 @@ __attribute__((visibility ("default")))
 #import "RWIProtocolEnumConversionHelpers.h"
 #import <JavaScriptCore/InspectorValues.h>
 #import <wtf/Assertions.h>
-#import <wtf/PassRefPtr.h>
 
 using namespace Inspector;
 
index f7b449d..dce6c95 100644 (file)
@@ -41,7 +41,7 @@ namespace Inspector {
 
 class AlternateInspectorBackendDispatcher {
 public:
-    void setBackendDispatcher(PassRefPtr<InspectorBackendDispatcher> dispatcher) { m_backendDispatcher = dispatcher; }
+    void setBackendDispatcher(RefPtr<InspectorBackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(dispatcher); }
     InspectorBackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
 private:
     RefPtr<InspectorBackendDispatcher> m_backendDispatcher;
@@ -142,7 +142,6 @@ InspectorBackend.activateDomain("Network3");
 
 #include "InspectorProtocolObjects.h"
 #include <inspector/InspectorBackendDispatcher.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -167,12 +166,12 @@ protected:
 #if PLATFORM(WEB_COMMANDS)
 class InspectorNetwork1BackendDispatcher final : public Inspector::InspectorSupplementalBackendDispatcher {
 public:
-    static PassRefPtr<InspectorNetwork1BackendDispatcher> create(Inspector::InspectorBackendDispatcher*, InspectorNetwork1BackendDispatcherHandler*);
-    virtual void dispatch(long callId, const String& method, PassRefPtr<Inspector::InspectorObject> message) override;
+    static Ref<InspectorNetwork1BackendDispatcher> create(Inspector::InspectorBackendDispatcher*, InspectorNetwork1BackendDispatcherHandler*);
+    virtual void dispatch(long callId, const String& method, Ref<Inspector::InspectorObject>&& message) override;
 private:
     void loadResource(long callId, const Inspector::InspectorObject& message);
 private:
-    InspectorNetwork1BackendDispatcher(Inspector::InspectorBackendDispatcher*, InspectorNetwork1BackendDispatcherHandler*);
+    InspectorNetwork1BackendDispatcher(Inspector::InspectorBackendDispatcher&, InspectorNetwork1BackendDispatcherHandler*);
     InspectorNetwork1BackendDispatcherHandler* m_agent;
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 public:
@@ -241,12 +240,12 @@ InspectorNetwork1BackendDispatcherHandler::~InspectorNetwork1BackendDispatcherHa
 #endif // PLATFORM(WEB_COMMANDS)
 
 #if PLATFORM(WEB_COMMANDS)
-PassRefPtr<InspectorNetwork1BackendDispatcher> InspectorNetwork1BackendDispatcher::create(InspectorBackendDispatcher* backendDispatcher, InspectorNetwork1BackendDispatcherHandler* agent)
+Ref<InspectorNetwork1BackendDispatcher> InspectorNetwork1BackendDispatcher::create(InspectorBackendDispatcher* backendDispatcher, InspectorNetwork1BackendDispatcherHandler* agent)
 {
-    return adoptRef(new InspectorNetwork1BackendDispatcher(backendDispatcher, agent));
+    return adoptRef(*new InspectorNetwork1BackendDispatcher(*backendDispatcher, agent));
 }
 
-InspectorNetwork1BackendDispatcher::InspectorNetwork1BackendDispatcher(InspectorBackendDispatcher* backendDispatcher, InspectorNetwork1BackendDispatcherHandler* agent)
+InspectorNetwork1BackendDispatcher::InspectorNetwork1BackendDispatcher(InspectorBackendDispatcher& backendDispatcher, InspectorNetwork1BackendDispatcherHandler* agent)
     : InspectorSupplementalBackendDispatcher(backendDispatcher)
     , m_agent(agent)
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
@@ -256,12 +255,12 @@ InspectorNetwork1BackendDispatcher::InspectorNetwork1BackendDispatcher(Inspector
     m_backendDispatcher->registerDispatcherForDomain(ASCIILiteral("Network1"), this);
 }
 
-void InspectorNetwork1BackendDispatcher::dispatch(long callId, const String& method, PassRefPtr<InspectorObject> message)
+void InspectorNetwork1BackendDispatcher::dispatch(long callId, const String& method, Ref<InspectorObject>&& message)
 {
     Ref<InspectorNetwork1BackendDispatcher> protect(*this);
 
     if (method == "loadResource")
-        loadResource(callId, *message.get());
+        loadResource(callId, message);
     else
         m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::MethodNotFound, makeString('\'', "Network1", '.', method, "' was not found"));
 }
@@ -276,10 +275,10 @@ void InspectorNetwork1BackendDispatcher::loadResource(long callId, const Inspect
 #endif
 
     ErrorString error;
-    RefPtr<InspectorObject> result = InspectorObject::create();
+    Ref<InspectorObject> result = InspectorObject::create();
     m_agent->loadResource(error);
 
-    m_backendDispatcher->sendResponse(callId, result.release(), error);
+    m_backendDispatcher->sendResponse(callId, WTF::move(result), error);
 }
 #endif // PLATFORM(WEB_COMMANDS)
 
@@ -328,7 +327,6 @@ void InspectorNetwork1BackendDispatcher::loadResource(long callId, const Inspect
 #include "InspectorProtocolObjects.h"
 #include <inspector/InspectorFrontendChannel.h>
 #include <inspector/InspectorValues.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -395,7 +393,7 @@ namespace Inspector {
 #if PLATFORM(WEB_EVENTS)
 void InspectorNetwork3FrontendDispatcher::resourceLoaded()
 {
-    RefPtr<InspectorObject> jsonMessage = InspectorObject::create();
+    Ref<InspectorObject> jsonMessage = InspectorObject::create();
     jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("Network3.resourceLoaded"));
 
     m_inspectorFrontendChannel->sendMessageToFrontend(jsonMessage->toJSONString());
@@ -446,7 +444,6 @@ void InspectorNetwork3FrontendDispatcher::resourceLoaded()
 
 #include <inspector/InspectorProtocolTypes.h>
 #include <wtf/Assertions.h>
-#include <wtf/PassRefPtr.h>
 
 namespace Inspector {
 
@@ -493,10 +490,10 @@ public:
             return *reinterpret_cast<Builder<STATE | STEP>*>(this);
         }
 
-        Builder(PassRefPtr</*NetworkError*/Inspector::InspectorObject> ptr)
+        Builder(Ref</*NetworkError*/Inspector::InspectorObject>&& object)
+            : m_result(WTF::move(object))
         {
             COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
-            m_result = ptr;
         }
         friend class NetworkError;
     public:
@@ -515,30 +512,27 @@ public:
             return castState<CodeSet>();
         }
 
-        operator RefPtr<NetworkError>& ()
+        Ref<NetworkError> release()
         {
             COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
             COMPILE_ASSERT(sizeof(NetworkError) == sizeof(Inspector::InspectorObject), cannot_cast);
-            return *reinterpret_cast<RefPtr<NetworkError>*>(&m_result);
-        }
 
-        PassRefPtr<NetworkError> release()
-        {
-            return RefPtr<NetworkError>(*this).release();
+            Ref<Inspector::InspectorObject> result = m_result.releaseNonNull();
+            return WTF::move(*reinterpret_cast<Ref<NetworkError>*>(&result));
         }
     };
 
     /*
      * Synthetic constructor:
-     * RefPtr<NetworkError> result = NetworkError::create()
+     * Ref<NetworkError> result = NetworkError::create()
      *     .setMessage(...)
-     *     .setCode(...);
+     *     .setCode(...)
+     *     .release();
      */
     static Builder<NoFieldsSet> create()
     {
         return Builder<NoFieldsSet>(Inspector::InspectorObject::create());
     }
-    typedef Inspector::Protocol::StructItemTraits ItemTraits;
 };
 
 } // Network2
@@ -990,7 +984,7 @@ using namespace Inspector;
     if (!frontendChannel)
         return;
 
-    RefPtr<InspectorObject> jsonMessage = InspectorObject::create();
+    Ref<InspectorObject> jsonMessage = InspectorObject::create();
     jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("Network3.resourceLoaded"));
     frontendChannel->sendMessageToFrontend(jsonMessage->toJSONString());
 }
@@ -1098,7 +1092,6 @@ __attribute__((visibility ("default")))
 #import "RWIProtocolEnumConversionHelpers.h"
 #import <JavaScriptCore/InspectorValues.h>
 #import <wtf/Assertions.h>
-#import <wtf/PassRefPtr.h>
 
 using namespace Inspector;
 
index 2dcf133..5a241f6 100644 (file)
@@ -41,7 +41,7 @@ namespace Inspector {
 
 class AlternateInspectorBackendDispatcher {
 public:
-    void setBackendDispatcher(PassRefPtr<InspectorBackendDispatcher> dispatcher) { m_backendDispatcher = dispatcher; }
+    void setBackendDispatcher(RefPtr<InspectorBackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(dispatcher); }
     InspectorBackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
 private:
     RefPtr<InspectorBackendDispatcher> m_backendDispatcher;
@@ -127,7 +127,6 @@ private:
 
 #include "InspectorProtocolObjects.h"
 #include <inspector/InspectorBackendDispatcher.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -236,7 +235,6 @@ namespace Inspector {
 #include "InspectorProtocolObjects.h"
 #include <inspector/InspectorFrontendChannel.h>
 #include <inspector/InspectorValues.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -334,7 +332,6 @@ namespace Inspector {
 
 #include <inspector/InspectorProtocolTypes.h>
 #include <wtf/Assertions.h>
-#include <wtf/PassRefPtr.h>
 
 namespace Inspector {
 
@@ -817,7 +814,6 @@ using namespace Inspector;
 #import "RWIProtocolEnumConversionHelpers.h"
 #import <JavaScriptCore/InspectorValues.h>
 #import <wtf/Assertions.h>
-#import <wtf/PassRefPtr.h>
 
 using namespace Inspector;
 
index 93993a3..e690062 100644 (file)
@@ -41,7 +41,7 @@ namespace Inspector {
 
 class AlternateInspectorBackendDispatcher {
 public:
-    void setBackendDispatcher(PassRefPtr<InspectorBackendDispatcher> dispatcher) { m_backendDispatcher = dispatcher; }
+    void setBackendDispatcher(RefPtr<InspectorBackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(dispatcher); }
     InspectorBackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
 private:
     RefPtr<InspectorBackendDispatcher> m_backendDispatcher;
@@ -127,7 +127,6 @@ private:
 
 #include "InspectorProtocolObjects.h"
 #include <inspector/InspectorBackendDispatcher.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -236,7 +235,6 @@ namespace Inspector {
 #include "InspectorProtocolObjects.h"
 #include <inspector/InspectorFrontendChannel.h>
 #include <inspector/InspectorValues.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -334,7 +332,6 @@ namespace Inspector {
 
 #include <inspector/InspectorProtocolTypes.h>
 #include <wtf/Assertions.h>
-#include <wtf/PassRefPtr.h>
 
 namespace Inspector {
 
@@ -384,10 +381,10 @@ public:
             return *reinterpret_cast<Builder<STATE | STEP>*>(this);
         }
 
-        Builder(PassRefPtr</*KeyPath*/Inspector::InspectorObject> ptr)
+        Builder(Ref</*KeyPath*/Inspector::InspectorObject>&& object)
+            : m_result(WTF::move(object))
         {
             COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
-            m_result = ptr;
         }
         friend class KeyPath;
     public:
@@ -399,38 +396,35 @@ public:
             return castState<TypeSet>();
         }
 
-        operator RefPtr<KeyPath>& ()
+        Ref<KeyPath> release()
         {
             COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
             COMPILE_ASSERT(sizeof(KeyPath) == sizeof(Inspector::InspectorObject), cannot_cast);
-            return *reinterpret_cast<RefPtr<KeyPath>*>(&m_result);
-        }
 
-        PassRefPtr<KeyPath> release()
-        {
-            return RefPtr<KeyPath>(*this).release();
+            Ref<Inspector::InspectorObject> result = m_result.releaseNonNull();
+            return WTF::move(*reinterpret_cast<Ref<KeyPath>*>(&result));
         }
     };
 
     /*
      * Synthetic constructor:
-     * RefPtr<KeyPath> result = KeyPath::create()
-     *     .setType(...);
+     * Ref<KeyPath> result = KeyPath::create()
+     *     .setType(...)
+     *     .release();
      */
     static Builder<NoFieldsSet> create()
     {
         return Builder<NoFieldsSet>(Inspector::InspectorObject::create());
     }
-    typedef Inspector::Protocol::StructItemTraits ItemTraits;
 
     void setString(const String& value)
     {
         InspectorObjectBase::setString(ASCIILiteral("string"), value);
     }
 
-    void setArray(PassRefPtr<Inspector::Protocol::Array<String>> value)
+    void setArray(RefPtr<Inspector::Protocol::Array<String>> value)
     {
-        InspectorObjectBase::setArray(ASCIILiteral("array"), value);
+        InspectorObjectBase::setArray(ASCIILiteral("array"), WTF::move(value));
     }
 };
 
@@ -920,7 +914,6 @@ __attribute__((visibility ("default")))
 #import "RWIProtocolEnumConversionHelpers.h"
 #import <JavaScriptCore/InspectorValues.h>
 #import <wtf/Assertions.h>
-#import <wtf/PassRefPtr.h>
 
 using namespace Inspector;
 
index 204a2b8..249bd86 100644 (file)
@@ -41,7 +41,7 @@ namespace Inspector {
 
 class AlternateInspectorBackendDispatcher {
 public:
-    void setBackendDispatcher(PassRefPtr<InspectorBackendDispatcher> dispatcher) { m_backendDispatcher = dispatcher; }
+    void setBackendDispatcher(RefPtr<InspectorBackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(dispatcher); }
     InspectorBackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
 private:
     RefPtr<InspectorBackendDispatcher> m_backendDispatcher;
@@ -127,7 +127,6 @@ private:
 
 #include "InspectorProtocolObjects.h"
 #include <inspector/InspectorBackendDispatcher.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -236,7 +235,6 @@ namespace Inspector {
 #include "InspectorProtocolObjects.h"
 #include <inspector/InspectorFrontendChannel.h>
 #include <inspector/InspectorValues.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -334,7 +332,6 @@ namespace Inspector {
 
 #include <inspector/InspectorProtocolTypes.h>
 #include <wtf/Assertions.h>
-#include <wtf/PassRefPtr.h>
 
 namespace Inspector {
 
@@ -803,7 +800,6 @@ using namespace Inspector;
 #import "RWIProtocolEnumConversionHelpers.h"
 #import <JavaScriptCore/InspectorValues.h>
 #import <wtf/Assertions.h>
-#import <wtf/PassRefPtr.h>
 
 using namespace Inspector;
 
index 36546c2..9b40a40 100644 (file)
@@ -41,7 +41,7 @@ namespace Inspector {
 
 class AlternateInspectorBackendDispatcher {
 public:
-    void setBackendDispatcher(PassRefPtr<InspectorBackendDispatcher> dispatcher) { m_backendDispatcher = dispatcher; }
+    void setBackendDispatcher(RefPtr<InspectorBackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(dispatcher); }
     InspectorBackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
 private:
     RefPtr<InspectorBackendDispatcher> m_backendDispatcher;
@@ -130,7 +130,6 @@ InspectorBackend.registerEnum("Debugger.Reason", {Died: "Died", Fainted: "Fainte
 
 #include "InspectorProtocolObjects.h"
 #include <inspector/InspectorBackendDispatcher.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -239,7 +238,6 @@ namespace Inspector {
 #include "InspectorProtocolObjects.h"
 #include <inspector/InspectorFrontendChannel.h>
 #include <inspector/InspectorValues.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -337,7 +335,6 @@ namespace Inspector {
 
 #include <inspector/InspectorProtocolTypes.h>
 #include <wtf/Assertions.h>
-#include <wtf/PassRefPtr.h>
 
 namespace Inspector {
 
@@ -864,7 +861,6 @@ typedef NS_ENUM(NSInteger, RWIProtocolDebuggerReason) {
 #import "RWIProtocolEnumConversionHelpers.h"
 #import <JavaScriptCore/InspectorValues.h>
 #import <wtf/Assertions.h>
-#import <wtf/PassRefPtr.h>
 
 using namespace Inspector;
 
index da75646..1b2823d 100644 (file)
@@ -41,7 +41,7 @@ namespace Inspector {
 
 class AlternateInspectorBackendDispatcher {
 public:
-    void setBackendDispatcher(PassRefPtr<InspectorBackendDispatcher> dispatcher) { m_backendDispatcher = dispatcher; }
+    void setBackendDispatcher(RefPtr<InspectorBackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(dispatcher); }
     InspectorBackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
 private:
     RefPtr<InspectorBackendDispatcher> m_backendDispatcher;
@@ -131,7 +131,6 @@ InspectorBackend.registerEnum("Runtime.TwoLeggedAnimals", {Ducks: "Ducks", Hens:
 
 #include "InspectorProtocolObjects.h"
 #include <inspector/InspectorBackendDispatcher.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -240,7 +239,6 @@ namespace Inspector {
 #include "InspectorProtocolObjects.h"
 #include <inspector/InspectorFrontendChannel.h>
 #include <inspector/InspectorValues.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -338,7 +336,6 @@ namespace Inspector {
 
 #include <inspector/InspectorProtocolTypes.h>
 #include <wtf/Assertions.h>
-#include <wtf/PassRefPtr.h>
 
 namespace Inspector {
 
@@ -902,7 +899,6 @@ typedef NS_ENUM(NSInteger, RWIProtocolRuntimeTwoLeggedAnimals) {
 #import "RWIProtocolEnumConversionHelpers.h"
 #import <JavaScriptCore/InspectorValues.h>
 #import <wtf/Assertions.h>
-#import <wtf/PassRefPtr.h>
 
 using namespace Inspector;
 
index cc42fd2..fae834b 100644 (file)
@@ -41,7 +41,7 @@ namespace Inspector {
 
 class AlternateInspectorBackendDispatcher {
 public:
-    void setBackendDispatcher(PassRefPtr<InspectorBackendDispatcher> dispatcher) { m_backendDispatcher = dispatcher; }
+    void setBackendDispatcher(RefPtr<InspectorBackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(dispatcher); }
     InspectorBackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
 private:
     RefPtr<InspectorBackendDispatcher> m_backendDispatcher;
@@ -127,7 +127,6 @@ private:
 
 #include "InspectorProtocolObjects.h"
 #include <inspector/InspectorBackendDispatcher.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -236,7 +235,6 @@ namespace Inspector {
 #include "InspectorProtocolObjects.h"
 #include <inspector/InspectorFrontendChannel.h>
 #include <inspector/InspectorValues.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -334,7 +332,6 @@ namespace Inspector {
 
 #include <inspector/InspectorProtocolTypes.h>
 #include <wtf/Assertions.h>
-#include <wtf/PassRefPtr.h>
 
 namespace Inspector {
 
@@ -387,10 +384,10 @@ public:
             return *reinterpret_cast<Builder<STATE | STEP>*>(this);
         }
 
-        Builder(PassRefPtr</*Error*/Inspector::InspectorObject> ptr)
+        Builder(Ref</*Error*/Inspector::InspectorObject>&& object)
+            : m_result(WTF::move(object))
         {
             COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
-            m_result = ptr;
         }
         friend class Error;
     public:
@@ -409,30 +406,27 @@ public:
             return castState<CodeSet>();
         }
 
-        operator RefPtr<Error>& ()
+        Ref<Error> release()
         {
             COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
             COMPILE_ASSERT(sizeof(Error) == sizeof(Inspector::InspectorObject), cannot_cast);
-            return *reinterpret_cast<RefPtr<Error>*>(&m_result);
-        }
 
-        PassRefPtr<Error> release()
-        {
-            return RefPtr<Error>(*this).release();
+            Ref<Inspector::InspectorObject> result = m_result.releaseNonNull();
+            return WTF::move(*reinterpret_cast<Ref<Error>*>(&result));
         }
     };
 
     /*
      * Synthetic constructor:
-     * RefPtr<Error> result = Error::create()
+     * Ref<Error> result = Error::create()
      *     .setMessage(...)
-     *     .setCode(...);
+     *     .setCode(...)
+     *     .release();
      */
     static Builder<NoFieldsSet> create()
     {
         return Builder<NoFieldsSet>(Inspector::InspectorObject::create());
     }
-    typedef Inspector::Protocol::StructItemTraits ItemTraits;
 };
 
 class OptionalParameterBundle : public Inspector::InspectorObjectBase {
@@ -452,40 +446,37 @@ public:
             return *reinterpret_cast<Builder<STATE | STEP>*>(this);
         }
 
-        Builder(PassRefPtr</*OptionalParameterBundle*/Inspector::InspectorObject> ptr)
+        Builder(Ref</*OptionalParameterBundle*/Inspector::InspectorObject>&& object)
+            : m_result(WTF::move(object))
         {
             COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
-            m_result = ptr;
         }
         friend class OptionalParameterBundle;
     public:
 
-        operator RefPtr<OptionalParameterBundle>& ()
+        Ref<OptionalParameterBundle> release()
         {
             COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
             COMPILE_ASSERT(sizeof(OptionalParameterBundle) == sizeof(Inspector::InspectorObject), cannot_cast);
-            return *reinterpret_cast<RefPtr<OptionalParameterBundle>*>(&m_result);
-        }
 
-        PassRefPtr<OptionalParameterBundle> release()
-        {
-            return RefPtr<OptionalParameterBundle>(*this).release();
+            Ref<Inspector::InspectorObject> result = m_result.releaseNonNull();
+            return WTF::move(*reinterpret_cast<Ref<OptionalParameterBundle>*>(&result));
         }
     };
 
     /*
      * Synthetic constructor:
-     * RefPtr<OptionalParameterBundle> result = OptionalParameterBundle::create();
+     * Ref<OptionalParameterBundle> result = OptionalParameterBundle::create()
+     *     .release();
      */
     static Builder<NoFieldsSet> create()
     {
         return Builder<NoFieldsSet>(Inspector::InspectorObject::create());
     }
-    typedef Inspector::Protocol::StructItemTraits ItemTraits;
 
-    void setColumnNames(PassRefPtr<Inspector::Protocol::Array<String>> value)
+    void setColumnNames(RefPtr<Inspector::Protocol::Array<String>> value)
     {
-        InspectorObjectBase::setArray(ASCIILiteral("columnNames"), value);
+        InspectorObjectBase::setArray(ASCIILiteral("columnNames"), WTF::move(value));
     }
 
     void setNotes(const String& value)
@@ -498,19 +489,19 @@ public:
         InspectorObjectBase::setDouble(ASCIILiteral("timestamp"), value);
     }
 
-    void setValues(PassRefPtr<Inspector::InspectorObject> value)
+    void setValues(RefPtr<Inspector::InspectorObject> value)
     {
-        InspectorObjectBase::setObject(ASCIILiteral("values"), value);
+        InspectorObjectBase::setObject(ASCIILiteral("values"), WTF::move(value));
     }
 
-    void setPayload(PassRefPtr<Inspector::InspectorValue> value)
+    void setPayload(RefPtr<Inspector::InspectorValue> value)
     {
-        InspectorObjectBase::setValue(ASCIILiteral("payload"), value);
+        InspectorObjectBase::setValue(ASCIILiteral("payload"), WTF::move(value));
     }
 
-    void setError(PassRefPtr<Inspector::Protocol::Database::Error> value)
+    void setError(RefPtr<Inspector::Protocol::Database::Error> value)
     {
-        InspectorObjectBase::setObject(ASCIILiteral("error"), value);
+        InspectorObjectBase::setObject(ASCIILiteral("error"), WTF::move(value));
     }
 };
 
@@ -537,15 +528,15 @@ public:
             return *reinterpret_cast<Builder<STATE | STEP>*>(this);
         }
 
-        Builder(PassRefPtr</*ParameterBundle*/Inspector::InspectorObject> ptr)
+        Builder(Ref</*ParameterBundle*/Inspector::InspectorObject>&& object)
+            : m_result(WTF::move(object))
         {
             COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
-            m_result = ptr;
         }
         friend class ParameterBundle;
     public:
 
-        Builder<STATE | ColumnNamesSet>& setColumnNames(PassRefPtr<Inspector::Protocol::Array<String>> value)
+        Builder<STATE | ColumnNamesSet>& setColumnNames(RefPtr<Inspector::Protocol::Array<String>> value)
         {
             COMPILE_ASSERT(!(STATE & ColumnNamesSet), property_columnNames_already_set);
             m_result->setArray(ASCIILiteral("columnNames"), value);
@@ -566,55 +557,52 @@ public:
             return castState<TimestampSet>();
         }
 
-        Builder<STATE | ValuesSet>& setValues(PassRefPtr<Inspector::InspectorObject> value)
+        Builder<STATE | ValuesSet>& setValues(RefPtr<Inspector::InspectorObject> value)
         {
             COMPILE_ASSERT(!(STATE & ValuesSet), property_values_already_set);
             m_result->setObject(ASCIILiteral("values"), value);
             return castState<ValuesSet>();
         }
 
-        Builder<STATE | PayloadSet>& setPayload(PassRefPtr<Inspector::InspectorValue> value)
+        Builder<STATE | PayloadSet>& setPayload(RefPtr<Inspector::InspectorValue> value)
         {
             COMPILE_ASSERT(!(STATE & PayloadSet), property_payload_already_set);
             m_result->setValue(ASCIILiteral("payload"), value);
             return castState<PayloadSet>();
         }
 
-        Builder<STATE | ErrorSet>& setError(PassRefPtr<Inspector::Protocol::Database::Error> value)
+        Builder<STATE | ErrorSet>& setError(RefPtr<Inspector::Protocol::Database::Error> value)
         {
             COMPILE_ASSERT(!(STATE & ErrorSet), property_error_already_set);
             m_result->setObject(ASCIILiteral("error"), value);
             return castState<ErrorSet>();
         }
 
-        operator RefPtr<ParameterBundle>& ()
+        Ref<ParameterBundle> release()
         {
             COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
             COMPILE_ASSERT(sizeof(ParameterBundle) == sizeof(Inspector::InspectorObject), cannot_cast);
-            return *reinterpret_cast<RefPtr<ParameterBundle>*>(&m_result);
-        }
 
-        PassRefPtr<ParameterBundle> release()
-        {
-            return RefPtr<ParameterBundle>(*this).release();
+            Ref<Inspector::InspectorObject> result = m_result.releaseNonNull();
+            return WTF::move(*reinterpret_cast<Ref<ParameterBundle>*>(&result));
         }
     };
 
     /*
      * Synthetic constructor:
-     * RefPtr<ParameterBundle> result = ParameterBundle::create()
+     * Ref<ParameterBundle> result = ParameterBundle::create()
      *     .setColumnNames(...)
      *     .setNotes(...)
      *     .setTimestamp(...)
      *     .setValues(...)
      *     .setPayload(...)
-     *     .setError(...);
+     *     .setError(...)
+     *     .release();
      */
     static Builder<NoFieldsSet> create()
     {
         return Builder<NoFieldsSet>(Inspector::InspectorObject::create());
     }
-    typedef Inspector::Protocol::StructItemTraits ItemTraits;
 };
 
 /* Conflicted names may cause generated getters/setters to clash with built-in InspectorObject methods. */
@@ -640,10 +628,10 @@ public:
             return *reinterpret_cast<Builder<STATE | STEP>*>(this);
         }
 
-        Builder(PassRefPtr</*ObjectWithPropertyNameConflicts*/Inspector::InspectorObject> ptr)
+        Builder(Ref</*ObjectWithPropertyNameConflicts*/Inspector::InspectorObject>&& object)
+            : m_result(WTF::move(object))
         {
             COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
-            m_result = ptr;
         }
         friend class ObjectWithPropertyNameConflicts;
     public:
@@ -683,33 +671,30 @@ public:
             return castState<ObjectSet>();
         }
 
-        operator RefPtr<ObjectWithPropertyNameConflicts>& ()
+        Ref<ObjectWithPropertyNameConflicts> release()
         {
             COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
             COMPILE_ASSERT(sizeof(ObjectWithPropertyNameConflicts) == sizeof(Inspector::InspectorObject), cannot_cast);
-            return *reinterpret_cast<RefPtr<ObjectWithPropertyNameConflicts>*>(&m_result);
-        }
 
-        PassRefPtr<ObjectWithPropertyNameConflicts> release()
-        {
-            return RefPtr<ObjectWithPropertyNameConflicts>(*this).release();
+            Ref<Inspector::InspectorObject> result = m_result.releaseNonNull();
+            return WTF::move(*reinterpret_cast<Ref<ObjectWithPropertyNameConflicts>*>(&result));
         }
     };
 
     /*
      * Synthetic constructor:
-     * RefPtr<ObjectWithPropertyNameConflicts> result = ObjectWithPropertyNameConflicts::create()
+     * Ref<ObjectWithPropertyNameConflicts> result = ObjectWithPropertyNameConflicts::create()
      *     .setInteger(...)
      *     .setArray(...)
      *     .setString(...)
      *     .setValue(...)
-     *     .setObject(...);
+     *     .setObject(...)
+     *     .release();
      */
     static Builder<NoFieldsSet> create()
     {
         return Builder<NoFieldsSet>(Inspector::InspectorObject::create());
     }
-    typedef Inspector::Protocol::StructItemTraits ItemTraits;
 };
 
 } // Database
@@ -738,15 +723,15 @@ public:
             return *reinterpret_cast<Builder<STATE | STEP>*>(this);
         }
 
-        Builder(PassRefPtr</*ParameterBundle*/Inspector::InspectorObject> ptr)
+        Builder(Ref</*ParameterBundle*/Inspector::InspectorObject>&& object)
+            : m_result(WTF::move(object))
         {
             COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
-            m_result = ptr;
         }
         friend class ParameterBundle;
     public:
 
-        Builder<STATE | ColumnNamesSet>& setColumnNames(PassRefPtr<Inspector::Protocol::Array<String>> value)
+        Builder<STATE | ColumnNamesSet>& setColumnNames(RefPtr<Inspector::Protocol::Array<String>> value)
         {
             COMPILE_ASSERT(!(STATE & ColumnNamesSet), property_columnNames_already_set);
             m_result->setArray(ASCIILiteral("columnNames"), value);
@@ -767,55 +752,52 @@ public:
             return castState<TimestampSet>();
         }
 
-        Builder<STATE | ValuesSet>& setValues(PassRefPtr<Inspector::InspectorObject> value)
+        Builder<STATE | ValuesSet>& setValues(RefPtr<Inspector::InspectorObject> value)
         {
             COMPILE_ASSERT(!(STATE & ValuesSet), property_values_already_set);
             m_result->setObject(ASCIILiteral("values"), value);
             return castState<ValuesSet>();
         }
 
-        Builder<STATE | PayloadSet>& setPayload(PassRefPtr<Inspector::InspectorValue> value)
+        Builder<STATE | PayloadSet>& setPayload(RefPtr<Inspector::InspectorValue> value)
         {
             COMPILE_ASSERT(!(STATE & PayloadSet), property_payload_already_set);
             m_result->setValue(ASCIILiteral("payload"), value);
             return castState<PayloadSet>();
         }
 
-        Builder<STATE | ErrorSet>& setError(PassRefPtr<Inspector::Protocol::Database::Error> value)
+        Builder<STATE | ErrorSet>& setError(RefPtr<Inspector::Protocol::Database::Error> value)
         {
             COMPILE_ASSERT(!(STATE & ErrorSet), property_error_already_set);
             m_result->setObject(ASCIILiteral("error"), value);
             return castState<ErrorSet>();
         }
 
-        operator RefPtr<ParameterBundle>& ()
+        Ref<ParameterBundle> release()
         {
             COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
             COMPILE_ASSERT(sizeof(ParameterBundle) == sizeof(Inspector::InspectorObject), cannot_cast);
-            return *reinterpret_cast<RefPtr<ParameterBundle>*>(&m_result);
-        }
 
-        PassRefPtr<ParameterBundle> release()
-        {
-            return RefPtr<ParameterBundle>(*this).release();
+            Ref<Inspector::InspectorObject> result = m_result.releaseNonNull();
+            return WTF::move(*reinterpret_cast<Ref<ParameterBundle>*>(&result));
         }
     };
 
     /*
      * Synthetic constructor:
-     * RefPtr<ParameterBundle> result = ParameterBundle::create()
+     * Ref<ParameterBundle> result = ParameterBundle::create()
      *     .setColumnNames(...)
      *     .setNotes(...)
      *     .setTimestamp(...)
      *     .setValues(...)
      *     .setPayload(...)
-     *     .setError(...);
+     *     .setError(...)
+     *     .release();
      */
     static Builder<NoFieldsSet> create()
     {
         return Builder<NoFieldsSet>(Inspector::InspectorObject::create());
     }
-    typedef Inspector::Protocol::StructItemTraits ItemTraits;
 };
 
 } // Test
@@ -1331,7 +1313,6 @@ __attribute__((visibility ("default")))
 #import "RWIProtocolEnumConversionHelpers.h"
 #import <JavaScriptCore/InspectorValues.h>
 #import <wtf/Assertions.h>
-#import <wtf/PassRefPtr.h>
 
 using namespace Inspector;
 
index 76d01ed..73bc733 100644 (file)
@@ -41,7 +41,7 @@ namespace Inspector {
 
 class AlternateInspectorBackendDispatcher {
 public:
-    void setBackendDispatcher(PassRefPtr<InspectorBackendDispatcher> dispatcher) { m_backendDispatcher = dispatcher; }
+    void setBackendDispatcher(RefPtr<InspectorBackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(dispatcher); }
     InspectorBackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
 private:
     RefPtr<InspectorBackendDispatcher> m_backendDispatcher;
@@ -131,7 +131,6 @@ InspectorBackend.registerEnum("Test.CastedAnimals", {Ducks: "Ducks", Hens: "Hens
 
 #include "InspectorProtocolObjects.h"
 #include <inspector/InspectorBackendDispatcher.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -240,7 +239,6 @@ namespace Inspector {
 #include "InspectorProtocolObjects.h"
 #include <inspector/InspectorFrontendChannel.h>
 #include <inspector/InspectorValues.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace Inspector {
@@ -338,7 +336,6 @@ namespace Inspector {
 
 #include <inspector/InspectorProtocolTypes.h>
 #include <wtf/Assertions.h>
-#include <wtf/PassRefPtr.h>
 
 namespace Inspector {
 
@@ -396,10 +393,10 @@ public:
             return *reinterpret_cast<Builder<STATE | STEP>*>(this);
         }
 
-        Builder(PassRefPtr</*TypeNeedingCast*/Inspector::InspectorObject> ptr)
+        Builder(Ref</*TypeNeedingCast*/Inspector::InspectorObject>&& object)
+            : m_result(WTF::move(object))
         {
             COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
-            m_result = ptr;
         }
         friend class TypeNeedingCast;
     public:
@@ -432,40 +429,37 @@ public:
             return castState<IdSet>();
         }
 
-        Builder<STATE | TreeSet>& setTree(PassRefPtr<Inspector::Protocol::Test::RecursiveObject1> value)
+        Builder<STATE | TreeSet>& setTree(RefPtr<Inspector::Protocol::Test::RecursiveObject1> value)
         {
             COMPILE_ASSERT(!(STATE & TreeSet), property_tree_already_set);
             m_result->setObject(ASCIILiteral("tree"), value);
             return castState<TreeSet>();
         }
 
-        operator RefPtr<TypeNeedingCast>& ()
+        Ref<TypeNeedingCast> release()
         {
             COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
             COMPILE_ASSERT(sizeof(TypeNeedingCast) == sizeof(Inspector::InspectorObject), cannot_cast);
-            return *reinterpret_cast<RefPtr<TypeNeedingCast>*>(&m_result);
-        }
 
-        PassRefPtr<TypeNeedingCast> release()
-        {
-            return RefPtr<TypeNeedingCast>(*this).release();
+            Ref<Inspector::InspectorObject> result = m_result.releaseNonNull();
+            return WTF::move(*reinterpret_cast<Ref<TypeNeedingCast>*>(&result));
         }
     };
 
     /*
      * Synthetic constructor:
-     * RefPtr<TypeNeedingCast> result = TypeNeedingCast::create()
+     * Ref<TypeNeedingCast> result = TypeNeedingCast::create()
      *     .setString(...)
      *     .setNumber(...)
      *     .setAnimals(...)
      *     .setId(...)
-     *     .setTree(...);
+     *     .setTree(...)
+     *     .release();
      */
     static Builder<NoFieldsSet> create()
     {
         return Builder<NoFieldsSet>(Inspector::InspectorObject::create());
     }
-    typedef Inspector::Protocol::StructItemTraits ItemTraits;
 };
 
 /*  */
@@ -499,40 +493,37 @@ public:
             return *reinterpret_cast<Builder<STATE | STEP>*>(this);
         }
 
-        Builder(PassRefPtr</*RecursiveObject1*/Inspector::InspectorObject> ptr)
+        Builder(Ref</*RecursiveObject1*/Inspector::InspectorObject>&& object)
+            : m_result(WTF::move(object))
         {
             COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
-            m_result = ptr;
         }
         friend class RecursiveObject1;
     public:
 
-        operator RefPtr<RecursiveObject1>& ()
+        Ref<RecursiveObject1> release()
         {
             COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
             COMPILE_ASSERT(sizeof(RecursiveObject1) == sizeof(Inspector::InspectorObject), cannot_cast);
-            return *reinterpret_cast<RefPtr<RecursiveObject1>*>(&m_result);
-        }
 
-        PassRefPtr<RecursiveObject1> release()
-        {
-            return RefPtr<RecursiveObject1>(*this).release();
+            Ref<Inspector::InspectorObject> result = m_result.releaseNonNull();
+            return WTF::move(*reinterpret_cast<Ref<RecursiveObject1>*>(&result));
         }
     };
 
     /*
      * Synthetic constructor:
-     * RefPtr<RecursiveObject1> result = RecursiveObject1::create();
+     * Ref<RecursiveObject1> result = RecursiveObject1::create()
+     *     .release();
      */
     static Builder<NoFieldsSet> create()
     {
         return Builder<NoFieldsSet>(Inspector::InspectorObject::create());
     }
-    typedef Inspector::Protocol::StructItemTraits ItemTraits;
 
-    void setObj(PassRefPtr<Inspector::Protocol::Test::RecursiveObject2> value)
+    void setObj(RefPtr<Inspector::Protocol::Test::RecursiveObject2> value)
     {
-        InspectorObjectBase::setObject(ASCIILiteral("obj"), value);
+        InspectorObjectBase::setObject(ASCIILiteral("obj"), WTF::move(value));
     }
 };
 
@@ -553,40 +544,37 @@ public:
             return *reinterpret_cast<Builder<STATE | STEP>*>(this);
         }
 
-        Builder(PassRefPtr</*RecursiveObject2*/Inspector::InspectorObject> ptr)
+        Builder(Ref</*RecursiveObject2*/Inspector::InspectorObject>&& object)
+            : m_result(WTF::move(object))
         {
             COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
-            m_result = ptr;
         }
         friend class RecursiveObject2;
     public:
 
-        operator RefPtr<RecursiveObject2>& ()
+        Ref<RecursiveObject2> release()
         {
             COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
             COMPILE_ASSERT(sizeof(RecursiveObject2) == sizeof(Inspector::InspectorObject), cannot_cast);
-            return *reinterpret_cast<RefPtr<RecursiveObject2>*>(&m_result);
-        }
 
-        PassRefPtr<RecursiveObject2> release()
-        {
-            return RefPtr<RecursiveObject2>(*this).release();
+            Ref<Inspector::InspectorObject> result = m_result.releaseNonNull();
+            return WTF::move(*reinterpret_cast<Ref<RecursiveObject2>*>(&result));
         }
     };
 
     /*
      * Synthetic constructor:
-     * RefPtr<RecursiveObject2> result = RecursiveObject2::create();
+     * Ref<RecursiveObject2> result = RecursiveObject2::create()
+     *     .release();
      */
     static Builder<NoFieldsSet> create()
     {
         return Builder<NoFieldsSet>(Inspector::InspectorObject::create());
     }
-    typedef Inspector::Protocol::StructItemTraits ItemTraits;
 
-    void setObj(PassRefPtr<Inspector::Protocol::Test::RecursiveObject1> value)
+    void setObj(RefPtr<Inspector::Protocol::Test::RecursiveObject1> value)
     {
-        InspectorObjectBase::setObject(ASCIILiteral("obj"), value);
+        InspectorObjectBase::setObject(ASCIILiteral("obj"), WTF::move(value));
     }
 };
 
@@ -598,7 +586,7 @@ static void assertValueHasExpectedType(Inspector::InspectorValue*);
 #endif // !ASSERT_DISABLED
 };
 template<> struct BindingTraits<Inspector::Protocol::Test::TypeNeedingCast> {
-static PassRefPtr<Inspector::Protocol::Test::TypeNeedingCast> runtimeCast(PassRefPtr<Inspector::InspectorValue> value);
+static RefPtr<Inspector::Protocol::Test::TypeNeedingCast> runtimeCast(RefPtr<Inspector::InspectorValue>&& value);
 #if !ASSERT_DISABLED
 static void assertValueHasExpectedType(Inspector::InspectorValue*);
 #endif // !ASSERT_DISABLED
@@ -684,6 +672,7 @@ String getEnumConstantValue(int code) {
 #if !ASSERT_DISABLED
 void BindingTraits<Inspector::Protocol::Test::CastedAnimals>::assertValueHasExpectedType(Inspector::InspectorValue* value)
 {
+    ASSERT_ARG(value, value);
     String result;
     bool castSucceeded = value->asString(result);
     ASSERT(castSucceeded);
@@ -694,6 +683,7 @@ void BindingTraits<Inspector::Protocol::Test::CastedAnimals>::assertValueHasExpe
 #if !ASSERT_DISABLED
 void BindingTraits<Inspector::Protocol::Test::TypeNeedingCast>::assertValueHasExpectedType(Inspector::InspectorValue* value)
 {
+    ASSERT_ARG(value, value);
     RefPtr<InspectorObject> object;
     bool castSucceeded = value->asObject(object);
     ASSERT_UNUSED(castSucceeded, castSucceeded);
@@ -729,7 +719,7 @@ void BindingTraits<Inspector::Protocol::Test::TypeNeedingCast>::assertValueHasEx
 }
 #endif // !ASSERT_DISABLED
 
-PassRefPtr<Inspector::Protocol::Test::TypeNeedingCast> BindingTraits<Inspector::Protocol::Test::TypeNeedingCast>::runtimeCast(PassRefPtr<Inspector::InspectorValue> value)
+RefPtr<Inspector::Protocol::Test::TypeNeedingCast> BindingTraits<Inspector::Protocol::Test::TypeNeedingCast>::runtimeCast(RefPtr<Inspector::InspectorValue>&& value)
 {
     RefPtr<Inspector::InspectorObject> result;
     bool castSucceeded = value->asObject(result);
@@ -745,6 +735,7 @@ PassRefPtr<Inspector::Protocol::Test::TypeNeedingCast> BindingTraits<Inspector::
 #if !ASSERT_DISABLED
 void BindingTraits<Inspector::Protocol::Test::RecursiveObject1>::assertValueHasExpectedType(Inspector::InspectorValue* value)
 {
+    ASSERT_ARG(value, value);
     RefPtr<InspectorObject> object;
     bool castSucceeded = value->asObject(object);
     ASSERT_UNUSED(castSucceeded, castSucceeded);
@@ -765,6 +756,7 @@ void BindingTraits<Inspector::Protocol::Test::RecursiveObject1>::assertValueHasE
 #if !ASSERT_DISABLED
 void BindingTraits<Inspector::Protocol::Test::RecursiveObject2>::assertValueHasExpectedType(Inspector::InspectorValue* value)
 {
+    ASSERT_ARG(value, value);
     RefPtr<InspectorObject> object;
     bool castSucceeded = value->asObject(object);
     ASSERT_UNUSED(castSucceeded, castSucceeded);
@@ -1256,7 +1248,6 @@ __attribute__((visibility ("default")))
 #import "RWIProtocolEnumConversionHelpers.h"
 #import <JavaScriptCore/InspectorValues.h>
 #import <wtf/Assertions.h>
-#import <wtf/PassRefPtr.h>
 
 using namespace Inspector;
 
index c71dbc6..727eba1 100644 (file)
@@ -37,22 +37,22 @@ using namespace Inspector;
 
 namespace JSC {
 
-PassRefPtr<InspectorObject> EncodedValue::asObject()
+RefPtr<InspectorObject> EncodedValue::asObject()
 {
     RefPtr<InspectorObject> result;
     bool castSucceeded = m_value->asObject(result);
     ASSERT_UNUSED(castSucceeded, castSucceeded);
 
-    return result.release();
+    return result;
 }
 
-PassRefPtr<InspectorArray> EncodedValue::asArray()
+RefPtr<InspectorArray> EncodedValue::asArray()
 {
     RefPtr<InspectorArray> result;
     bool castSucceeded = m_value->asArray(result);
     ASSERT_UNUSED(castSucceeded, castSucceeded);
 
-    return result.release();
+    return result;
 }
 
 EncodedValue EncodingTraits<Vector<char>>::encodeValue(const Vector<char>& buffer)
@@ -175,23 +175,23 @@ template<> String EncodedValue::convertTo<String>()
 template<>
 void EncodedValue::put<EncodedValue>(const String& key, const typename EncodingTraits<EncodedValue>::DecodedType& value)
 {
-    asObject()->setValue(key, value.m_value);
+    asObject()->setValue(key, value.m_value.copyRef());
 }
 
 template<>
 void EncodedValue::append<EncodedValue>(const typename EncodingTraits<EncodedValue>::DecodedType& value)
 {
-    asArray()->pushValue(value.m_value);
+    asArray()->pushValue(value.m_value.copyRef());
 }
 
 template<>
 bool EncodedValue::get<EncodedValue>(const String& key, typename EncodingTraits<EncodedValue>::DecodedType& decodedValue)
 {
-    RefPtr<Inspector::InspectorValue> inspectorValue(asObject()->get(key));
-    if (!inspectorValue)
+    RefPtr<Inspector::InspectorValue> value;
+    if (!asObject()->getValue(key, value))
         return false;
 
-    decodedValue = EncodedValue(inspectorValue);
+    decodedValue = EncodedValue(WTF::move(value));
     return true;
 }
 
index c0010e8..8659b4f 100644 (file)
@@ -41,7 +41,7 @@ template<typename T> struct EncodingTraits;
 
 class EncodedValue final {
 public:
-    explicit EncodedValue(PassRefPtr<Inspector::InspectorValue> value)
+    explicit EncodedValue(RefPtr<Inspector::InspectorValue>&& value)
         : m_value(value) { }
 
     EncodedValue()
@@ -78,8 +78,8 @@ public:
 
     template<typename T> T convertTo();
 
-    JS_EXPORT_PRIVATE PassRefPtr<Inspector::InspectorObject> asObject();
-    JS_EXPORT_PRIVATE PassRefPtr<Inspector::InspectorArray> asArray();
+    JS_EXPORT_PRIVATE RefPtr<Inspector::InspectorObject> asObject();
+    JS_EXPORT_PRIVATE RefPtr<Inspector::InspectorArray> asArray();
 
 private:
     RefPtr<Inspector::InspectorValue> m_value;
index df9b967..65f549a 100644 (file)
@@ -341,13 +341,13 @@ class Type:
         if self.mode == TypeModes.SCALAR:
             return self.type_name(qualified)
         elif self.mode == TypeModes.SHARED:
-            return "PassRefPtr<%s>" % self.type_name(qualified)
+            return "RefPtr<%s>" % self.type_name(qualified)
         else:
             return "const %s&" % self.type_name(qualified)
 
     def argument_type(self, qualified=False):
         if self.mode == TypeModes.SHARED:
-            return "PassRefPtr<%s>" % self.type_name(qualified)
+            return "RefPtr<%s>&&" % self.type_name(qualified)
         else:
             return self.storage_type()
 
@@ -939,7 +939,7 @@ class Generator:
 
     def generate_member_move_expression(self, _member):
         _type = self._model.get_type_for_member(_member)
-        if _type.mode == TypeModes.OWNED:
+        if _type.mode in [TypeModes.OWNED, TypeModes.SHARED]:
             return "WTF::move(%s)" % _member.memberName
         else:
             return _member.memberName
index c1b9f11..b766368 100644 (file)
@@ -141,7 +141,7 @@ void ConsoleClient::printConsoleMessage(MessageSource source, MessageType type,
     WTFLogAlways("%s", builder.toString().utf8().data());
 }
 
-void ConsoleClient::printConsoleMessageWithArguments(MessageSource source, MessageType type, MessageLevel level, JSC::ExecState* exec, PassRefPtr<ScriptArguments> prpArguments)
+void ConsoleClient::printConsoleMessageWithArguments(MessageSource source, MessageType type, MessageLevel level, JSC::ExecState* exec, RefPtr<ScriptArguments>&& prpArguments)
 {
     RefPtr<ScriptArguments> arguments = prpArguments;
 
@@ -186,7 +186,7 @@ void ConsoleClient::printConsoleMessageWithArguments(MessageSource source, Messa
     }
 }
 
-void ConsoleClient::internalMessageWithTypeAndLevel(MessageType type, MessageLevel level, JSC::ExecState* exec, PassRefPtr<ScriptArguments> prpArguments, ArgumentRequirement argumentRequirement)
+void ConsoleClient::internalMessageWithTypeAndLevel(MessageType type, MessageLevel level, JSC::ExecState* exec, RefPtr<ScriptArguments>&& prpArguments, ArgumentRequirement argumentRequirement)
 {
     RefPtr<ScriptArguments> arguments = prpArguments;
     if (argumentRequirement == ArgumentRequired && !arguments->argumentCount())
@@ -195,57 +195,57 @@ void ConsoleClient::internalMessageWithTypeAndLevel(MessageType type, MessageLev
     messageWithTypeAndLevel(type, level, exec, arguments.release());
 }
 
-void ConsoleClient::logWithLevel(ExecState* exec, PassRefPtr<ScriptArguments> arguments, MessageLevel level)
+void ConsoleClient::logWithLevel(ExecState* exec, RefPtr<ScriptArguments>&& arguments, MessageLevel level)
 {
-    internalMessageWithTypeAndLevel(MessageType::Log, level, exec, arguments, ArgumentRequired);
+    internalMessageWithTypeAndLevel(MessageType::Log, level, exec, WTF::move(arguments), ArgumentRequired);
 }
 
-void ConsoleClient::clear(ExecState* exec, PassRefPtr<ScriptArguments> arguments)
+void ConsoleClient::clear(ExecState* exec, RefPtr<ScriptArguments>&& arguments)
 {
-    internalMessageWithTypeAndLevel(MessageType::Clear, MessageLevel::Log, exec, arguments, ArgumentNotRequired);
+    internalMessageWithTypeAndLevel(MessageType::Clear, MessageLevel::Log, exec, WTF::move(arguments), ArgumentNotRequired);
 }
 
-void ConsoleClient::dir(ExecState* exec, PassRefPtr<ScriptArguments> arguments)
+void ConsoleClient::dir(ExecState* exec, RefPtr<ScriptArguments>&& arguments)
 {
-    internalMessageWithTypeAndLevel(MessageType::Dir, MessageLevel::Log, exec, arguments, ArgumentRequired);
+    internalMessageWithTypeAndLevel(MessageType::Dir, MessageLevel::Log, exec, WTF::move(arguments), ArgumentRequired);
 }
 
-void ConsoleClient::dirXML(ExecState* exec, PassRefPtr<ScriptArguments> arguments)
+void ConsoleClient::dirXML(ExecState* exec, RefPtr<ScriptArguments>&& arguments)
 {
-    internalMessageWithTypeAndLevel(MessageType::DirXML, MessageLevel::Log, exec, arguments, ArgumentRequired);
+    internalMessageWithTypeAndLevel(MessageType::DirXML, MessageLevel::Log, exec, WTF::move(arguments), ArgumentRequired);
 }
 
-void ConsoleClient::table(ExecState* exec, PassRefPtr<ScriptArguments> arguments)
+void ConsoleClient::table(ExecState* exec, RefPtr<ScriptArguments>&& arguments)
 {
-    internalMessageWithTypeAndLevel(MessageType::Table, MessageLevel::Log, exec, arguments, ArgumentRequired);
+    internalMessageWithTypeAndLevel(MessageType::Table, MessageLevel::Log, exec, WTF::move(arguments), ArgumentRequired);
 }
 
-void ConsoleClient::trace(ExecState* exec, PassRefPtr<ScriptArguments> arguments)
+void ConsoleClient::trace(ExecState* exec, RefPtr<ScriptArguments>&& arguments)
 {
-    internalMessageWithTypeAndLevel(MessageType::Trace, MessageLevel::Log, exec, arguments, ArgumentNotRequired);
+    internalMessageWithTypeAndLevel(MessageType::Trace, MessageLevel::Log, exec, WTF::move(arguments), ArgumentNotRequired);
 }
 
-void ConsoleClient::assertCondition(ExecState* exec, PassRefPtr<ScriptArguments> arguments, bool condition)
+void ConsoleClient::assertCondition(ExecState* exec, RefPtr<ScriptArguments>&& arguments, bool condition)
 {
     if (condition)
         return;
 
-    internalMessageWithTypeAndLevel(MessageType::Assert, MessageLevel::Error, exec, arguments, ArgumentNotRequired);
+    internalMessageWithTypeAndLevel(MessageType::Assert, MessageLevel::Error, exec, WTF::move(arguments), ArgumentNotRequired);
 }
 
-void ConsoleClient::group(ExecState* exec, PassRefPtr<ScriptArguments> arguments)
+void ConsoleClient::group(ExecState* exec, RefPtr<ScriptArguments>&& arguments)
 {
-    internalMessageWithTypeAndLevel(MessageType::StartGroup, MessageLevel::Log, exec, arguments, ArgumentNotRequired);
+    internalMessageWithTypeAndLevel(MessageType::StartGroup, MessageLevel::Log, exec, WTF::move(arguments), ArgumentNotRequired);
 }
 
-void ConsoleClient::groupCollapsed(ExecState* exec, PassRefPtr<ScriptArguments> arguments)
+void ConsoleClient::groupCollapsed(ExecState* exec, RefPtr<ScriptArguments>&& arguments)
 {
-    internalMessageWithTypeAndLevel(MessageType::StartGroupCollapsed, MessageLevel::Log, exec, arguments, ArgumentNotRequired);
+    internalMessageWithTypeAndLevel(MessageType::StartGroupCollapsed, MessageLevel::Log, exec, WTF::move(arguments), ArgumentNotRequired);
 }
 
-void ConsoleClient::groupEnd(ExecState* exec, PassRefPtr<ScriptArguments> arguments)
+void ConsoleClient::groupEnd(ExecState* exec, RefPtr<ScriptArguments>&& arguments)
 {
-    internalMessageWithTypeAndLevel(MessageType::EndGroup, MessageLevel::Log, exec, arguments, ArgumentNotRequired);
+    internalMessageWithTypeAndLevel(MessageType::EndGroup, MessageLevel::Log, exec, WTF::move(arguments), ArgumentNotRequired);
 }
 
 } // namespace JSC
index 8f4f193..a16b85b 100644 (file)
@@ -42,30 +42,30 @@ public:
     virtual ~ConsoleClient() { }
 
     JS_EXPORT_PRIVATE static void printConsoleMessage(MessageSource, MessageType, MessageLevel, const String& message, const String& url, unsigned lineNumber, unsigned columnNumber);
-    JS_EXPORT_PRIVATE static void printConsoleMessageWithArguments(MessageSource, MessageType, MessageLevel, JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>);
+    JS_EXPORT_PRIVATE static void printConsoleMessageWithArguments(MessageSource, MessageType, MessageLevel, JSC::ExecState*, RefPtr<Inspector::ScriptArguments>&&);
 
-    void logWithLevel(ExecState*, PassRefPtr<Inspector::ScriptArguments>, MessageLevel);
-    void clear(ExecState*, PassRefPtr<Inspector::ScriptArguments>);
-    void dir(ExecState*, PassRefPtr<Inspector::ScriptArguments>);
-    void dirXML(ExecState*, PassRefPtr<Inspector::ScriptArguments>);
-    void table(ExecState*, PassRefPtr<Inspector::ScriptArguments>);
-    void trace(ExecState*, PassRefPtr<Inspector::ScriptArguments>);
-    void assertCondition(ExecState*, PassRefPtr<Inspector::ScriptArguments>, bool condition);
-    void group(ExecState*, PassRefPtr<Inspector::ScriptArguments>);
-    void groupCollapsed(ExecState*, PassRefPtr<Inspector::ScriptArguments>);
-    void groupEnd(ExecState*, PassRefPtr<Inspector::ScriptArguments>);
+    void logWithLevel(ExecState*, RefPtr<Inspector::ScriptArguments>&&, MessageLevel);
+    void clear(ExecState*, RefPtr<Inspector::ScriptArguments>&&);
+    void dir(ExecState*, RefPtr<Inspector::ScriptArguments>&&);
+    void dirXML(ExecState*, RefPtr<Inspector::ScriptArguments>&&);
+    void table(ExecState*, RefPtr<Inspector::ScriptArguments>&&);
+    void trace(ExecState*, RefPtr<Inspector::ScriptArguments>&&);
+    void assertCondition(ExecState*, RefPtr<Inspector::ScriptArguments>&&, bool condition);
+    void group(ExecState*, RefPtr<Inspector::ScriptArguments>&&);
+    void groupCollapsed(ExecState*, RefPtr<Inspector::ScriptArguments>&&);
+    void groupEnd(ExecState*, RefPtr<Inspector::ScriptArguments>&&);
 
-    virtual void messageWithTypeAndLevel(MessageType, MessageLevel, JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>) = 0;
-    virtual void count(ExecState*, PassRefPtr<Inspector::ScriptArguments>) = 0;
+    virtual void messageWithTypeAndLevel(MessageType, MessageLevel, JSC::ExecState*, RefPtr<Inspector::ScriptArguments>&&) = 0;
+    virtual void count(ExecState*, RefPtr<Inspector::ScriptArguments>&&) = 0;
     virtual void profile(ExecState*, const String& title) = 0;
     virtual void profileEnd(ExecState*, const String& title) = 0;
     virtual void time(ExecState*, const String& title) = 0;
     virtual void timeEnd(ExecState*, const String& title) = 0;
-    virtual void timeStamp(ExecState*, PassRefPtr<Inspector::ScriptArguments>) = 0;
+    virtual void timeStamp(ExecState*, RefPtr<Inspector::ScriptArguments>&&) = 0;
 
 private:
     enum ArgumentRequirement { ArgumentRequired, ArgumentNotRequired };
-    void internalMessageWithTypeAndLevel(MessageType, MessageLevel, JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>, ArgumentRequirement);
+    void internalMessageWithTypeAndLevel(MessageType, MessageLevel, JSC::ExecState*, RefPtr<Inspector::ScriptArguments>&&, ArgumentRequirement);
 };
 
 } // namespace JSC
index 310f64d..2a552f8 100644 (file)
@@ -237,17 +237,17 @@ String TypeSet::leastCommonAncestor() const
 }
 
 #if ENABLE(INSPECTOR)
-PassRefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::StructureDescription>> TypeSet::allStructureRepresentations() const
+Ref<Inspector::Protocol::Array<Inspector::Protocol::Runtime::StructureDescription>> TypeSet::allStructureRepresentations() const
 {
-    RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::StructureDescription>> description = Inspector::Protocol::Array<Inspector::Protocol::Runtime::StructureDescription>::create();
+    auto description = Inspector::Protocol::Array<Inspector::Protocol::Runtime::StructureDescription>::create();
 
     for (size_t i = 0; i < m_structureHistory.size(); i++)
         description->addItem(m_structureHistory.at(i)->inspectorRepresentation());
 
-    return description.release();
+    return WTF::move(description);
 }
 
-PassRefPtr<Inspector::Protocol::Runtime::TypeSet> TypeSet::inspectorTypeSet() const
+Ref<Inspector::Protocol::Runtime::TypeSet> TypeSet::inspectorTypeSet() const
 {
     return Inspector::Protocol::Runtime::TypeSet::create()
         .setIsFunction((m_seenTypes & TypeFunction) != TypeNothing)
@@ -511,11 +511,11 @@ String StructureShape::toJSONString() const
 }
 
 #if ENABLE(INSPECTOR)
-PassRefPtr<Inspector::Protocol::Runtime::StructureDescription> StructureShape::inspectorRepresentation()
+Ref<Inspector::Protocol::Runtime::StructureDescription> StructureShape::inspectorRepresentation()
 {
-    RefPtr<Inspector::Protocol::Runtime::StructureDescription> base = Inspector::Protocol::Runtime::StructureDescription::create();
-    RefPtr<Inspector::Protocol::Runtime::StructureDescription> currentObject = base;
-    RefPtr<StructureShape> currentShape = this;
+    auto base = Inspector::Protocol::Runtime::StructureDescription::create().release();
+    Ref<Inspector::Protocol::Runtime::StructureDescription> currentObject = base.copyRef();
+    RefPtr<StructureShape> currentShape(this);
 
     while (currentShape) {
         auto fields = Inspector::Protocol::Array<String>::create();
@@ -525,21 +525,21 @@ PassRefPtr<Inspector::Protocol::Runtime::StructureDescription> StructureShape::i
         for (auto field : currentShape->m_optionalFields)
             optionalFields->addItem(field.get());
 
-        currentObject->setFields(fields);
-        currentObject->setOptionalFields(optionalFields);
+        currentObject->setFields(&fields.get());
+        currentObject->setOptionalFields(&optionalFields.get());
         currentObject->setConstructorName(currentShape->m_constructorName);
         currentObject->setIsImprecise(currentShape->m_isInDictionaryMode);
 
         if (currentShape->m_proto) {
-            RefPtr<Inspector::Protocol::Runtime::StructureDescription> nextObject = Inspector::Protocol::Runtime::StructureDescription::create();
-            currentObject->setPrototypeStructure(nextObject);
-            currentObject = nextObject;
+            auto nextObject = Inspector::Protocol::Runtime::StructureDescription::create().release();
+            currentObject->setPrototypeStructure(&nextObject.get());
+            currentObject = WTF::move(nextObject);
         }
 
         currentShape = currentShape->m_proto;
     }
 
-    return base.release();
+    return WTF::move(base);
 }
 #endif
 
index b2c8107..1ca3918 100644 (file)
@@ -72,7 +72,7 @@ public:
     void addProperty(RefPtr<StringImpl>);
     String stringRepresentation();
     String toJSONString() const;
-    PassRefPtr<Inspector::Protocol::Runtime::StructureDescription> inspectorRepresentation();
+    Ref<Inspector::Protocol::Runtime::StructureDescription> inspectorRepresentation();
     void setConstructorName(String name) { m_constructorName = (name.isEmpty() ? "Object" : name); }
     String constructorName() { return m_constructorName; }
     void setProto(PassRefPtr<StructureShape> shape) { m_proto = shape; }
@@ -102,11 +102,11 @@ public:
     void invalidateCache();
     String dumpTypes() const;
     String displayName() const;
-    PassRefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::StructureDescription>> allStructureRepresentations() const;
+    Ref<Inspector::Protocol::Array<Inspector::Protocol::Runtime::StructureDescription>> allStructureRepresentations() const;
     String toJSONString() const;
     bool isOverflown() const { return m_isOverflown; }
     String leastCommonAncestor() const;
-    PassRefPtr<Inspector::Protocol::Runtime::TypeSet> inspectorTypeSet() const;
+    Ref<Inspector::Protocol::Runtime::TypeSet> inspectorTypeSet() const;
     bool isEmpty() const { return m_seenTypes == TypeNothing; }
     bool doesTypeConformTo(uint32_t test) const;
     uint32_t seenTypes() const { return m_seenTypes; }