WorkerInspectorController::WorkerInspectorController(WorkerGlobalScope* workerGlobalScope) : m_workerGlobalScope(workerGlobalScope) , m_stateClient(adoptPtr(new WorkerStateClient(workerGlobalScope))) , m_state(adoptPtrWillBeNoop(new InspectorCompositeState(m_stateClient.get()))) , m_instrumentingAgents(InstrumentingAgents::create()) , m_injectedScriptManager(InjectedScriptManager::createForWorker()) , m_workerThreadDebugger(adoptPtr(new WorkerThreadDebugger(workerGlobalScope->thread()))) , m_agents(m_instrumentingAgents.get(), m_state.get()) , m_inspectorTaskRunner(adoptPtr(new InspectorTaskRunner(v8::Isolate::GetCurrent()))) , m_beforeInitlizedScope(adoptPtr(new InspectorTaskRunner::IgnoreInterruptsScope(m_inspectorTaskRunner.get()))) , m_paused(false) { OwnPtrWillBeRawPtr<WorkerRuntimeAgent> workerRuntimeAgent = WorkerRuntimeAgent::create(m_injectedScriptManager.get(), m_workerThreadDebugger->debugger(), workerGlobalScope, this); m_workerRuntimeAgent = workerRuntimeAgent.get(); m_agents.append(workerRuntimeAgent.release()); OwnPtrWillBeRawPtr<WorkerDebuggerAgent> workerDebuggerAgent = WorkerDebuggerAgent::create(m_workerThreadDebugger.get(), workerGlobalScope, m_injectedScriptManager.get()); m_workerDebuggerAgent = workerDebuggerAgent.get(); m_agents.append(workerDebuggerAgent.release()); m_asyncCallTracker = adoptPtrWillBeNoop(new AsyncCallTracker(m_workerDebuggerAgent->v8DebuggerAgent(), m_instrumentingAgents.get())); v8::Isolate* isolate = workerGlobalScope->thread()->isolate(); m_agents.append(InspectorProfilerAgent::create(isolate, m_injectedScriptManager.get(), 0)); m_agents.append(InspectorHeapProfilerAgent::create(isolate, m_injectedScriptManager.get())); OwnPtrWillBeRawPtr<WorkerConsoleAgent> workerConsoleAgent = WorkerConsoleAgent::create(m_injectedScriptManager.get(), workerGlobalScope); WorkerConsoleAgent* workerConsoleAgentPtr = workerConsoleAgent.get(); workerConsoleAgentPtr->setDebuggerAgent(m_workerDebuggerAgent->v8DebuggerAgent()); m_agents.append(workerConsoleAgent.release()); m_agents.append(InspectorTimelineAgent::create()); m_injectedScriptManager->injectedScriptHost()->init(workerConsoleAgentPtr, m_workerDebuggerAgent->v8DebuggerAgent(), nullptr, m_workerThreadDebugger->debugger(), adoptPtr(new WorkerInjectedScriptHostClient())); }
void KeyframeEffect::applyEffects() { ASSERT(isInEffect()); ASSERT(animation()); if (!m_target || !m_model) return; // Cancel composited animation of transform if a motion path has been introduced on the element. if (m_target->computedStyle() && m_target->computedStyle()->hasMotionPath() && animation()->hasActiveAnimationsOnCompositor() && animation()->affects(*m_target, CSSPropertyTransform)) { animation()->cancelAnimationOnCompositor(); } double iteration = currentIteration(); ASSERT(iteration >= 0); OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> interpolations = m_sampledEffect ? m_sampledEffect->mutableInterpolations() : nullptr; // FIXME: Handle iteration values which overflow int. m_model->sample(static_cast<int>(iteration), timeFraction(), iterationDuration(), interpolations); if (m_sampledEffect) { m_sampledEffect->setInterpolations(interpolations.release()); } else if (interpolations && !interpolations->isEmpty()) { OwnPtrWillBeRawPtr<SampledEffect> sampledEffect = SampledEffect::create(this, interpolations.release()); m_sampledEffect = sampledEffect.get(); ensureAnimationStack(m_target).add(sampledEffect.release()); } else { return; } m_target->setNeedsAnimationStyleRecalc(); if (m_target->isSVGElement()) m_sampledEffect->applySVGUpdate(toSVGElement(*m_target)); }
InspectorController::InspectorController(Page* page, InspectorClient* inspectorClient) : m_instrumentingAgents(InstrumentingAgents::create()) , m_injectedScriptManager(InjectedScriptManager::createForPage()) , m_state(adoptPtrWillBeNoop(new InspectorCompositeState(inspectorClient))) , m_overlay(InspectorOverlay::create(page, inspectorClient)) , m_cssAgent(nullptr) , m_resourceAgent(nullptr) , m_layerTreeAgent(nullptr) , m_inspectorFrontendClient(nullptr) , m_page(page) , m_inspectorClient(inspectorClient) , m_agents(m_instrumentingAgents.get(), m_state.get()) , m_isUnderTest(false) , m_deferredAgentsInitialized(false) { InjectedScriptManager* injectedScriptManager = m_injectedScriptManager.get(); InspectorOverlay* overlay = m_overlay.get(); m_agents.append(InspectorInspectorAgent::create(m_page, injectedScriptManager)); OwnPtrWillBeRawPtr<InspectorPageAgent> pageAgentPtr(InspectorPageAgent::create(m_page, injectedScriptManager, inspectorClient, overlay)); m_pageAgent = pageAgentPtr.get(); m_agents.append(pageAgentPtr.release()); OwnPtrWillBeRawPtr<InspectorDOMAgent> domAgentPtr(InspectorDOMAgent::create(m_pageAgent, injectedScriptManager, overlay)); m_domAgent = domAgentPtr.get(); m_agents.append(domAgentPtr.release()); OwnPtrWillBeRawPtr<InspectorLayerTreeAgent> layerTreeAgentPtr(InspectorLayerTreeAgent::create(m_page)); m_layerTreeAgent = layerTreeAgentPtr.get(); m_agents.append(layerTreeAgentPtr.release()); OwnPtrWillBeRawPtr<InspectorWorkerAgent> workerAgentPtr = InspectorWorkerAgent::create(); OwnPtrWillBeRawPtr<InspectorTracingAgent> tracingAgentPtr = InspectorTracingAgent::create(inspectorClient, workerAgentPtr.get()); m_tracingAgent = tracingAgentPtr.get(); m_agents.append(tracingAgentPtr.release()); m_agents.append(workerAgentPtr.release()); OwnPtrWillBeRawPtr<InspectorTimelineAgent> timelineAgentPtr(InspectorTimelineAgent::create(m_pageAgent, m_layerTreeAgent, overlay, InspectorTimelineAgent::PageInspector, inspectorClient)); m_timelineAgent = timelineAgentPtr.get(); m_agents.append(timelineAgentPtr.release()); PageScriptDebugServer* pageScriptDebugServer = &PageScriptDebugServer::shared(); m_agents.append(PageRuntimeAgent::create(injectedScriptManager, inspectorClient, pageScriptDebugServer, m_page, m_pageAgent)); m_agents.append(PageConsoleAgent::create(injectedScriptManager, m_domAgent, m_timelineAgent, m_page)); ASSERT_ARG(inspectorClient, inspectorClient); m_injectedScriptManager->injectedScriptHost()->init(m_instrumentingAgents.get(), pageScriptDebugServer); }
void DatabaseClient::createInspectorAgentFor(Page* page) { ASSERT(!m_inspectorAgent); OwnPtrWillBeRawPtr<InspectorDatabaseAgent> inspectorAgent = InspectorDatabaseAgent::create(); m_inspectorAgent = inspectorAgent.get(); page->inspectorController().registerModuleAgent(inspectorAgent.release()); }
void XSLStyleSheet::loadChildSheet(const String& href) { OwnPtrWillBeRawPtr<XSLImportRule> childRule = XSLImportRule::create(this, href); XSLImportRule* c = childRule.get(); m_children.append(childRule.release()); c->loadSheet(); }
PassOwnPtrWillBeRawPtr<CanvasRenderingContext> WebGL2RenderingContext::Factory::create(HTMLCanvasElement* canvas, const CanvasContextCreationAttributes& attrs, Document&) { if (!RuntimeEnabledFeatures::unsafeES3APIsEnabled()) { canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, "Creation of WebGL2 contexts disabled.")); return nullptr; } WebGLContextAttributes attributes = toWebGLContextAttributes(attrs); OwnPtr<WebGraphicsContext3D> context(createWebGraphicsContext3D(canvas, attributes, 2)); if (!context) return nullptr; OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(context.get()); if (!extensionsUtil) return nullptr; if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) { String contextLabel(String::format("WebGL2RenderingContext-%p", context.get())); context->pushGroupMarkerEXT(contextLabel.ascii().data()); } OwnPtrWillBeRawPtr<WebGL2RenderingContext> renderingContext = adoptPtrWillBeNoop(new WebGL2RenderingContext(canvas, context.release(), attributes)); if (!renderingContext->drawingBuffer()) { canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, "Could not create a WebGL2 context.")); return nullptr; } renderingContext->initializeNewContext(); renderingContext->registerContextExtensions(); return renderingContext.release(); }
void FontFace::initCSSFontFace(Document* document, PassRefPtrWillBeRawPtr<CSSValue> src) { m_cssFontFace = createCSSFontFace(this, m_unicodeRange.get()); if (m_error) return; // Each item in the src property's list is a single CSSFontFaceSource. Put them all into a CSSFontFace. ASSERT(src); ASSERT(src->isValueList()); CSSValueList* srcList = toCSSValueList(src.get()); int srcLength = srcList->length(); for (int i = 0; i < srcLength; i++) { // An item in the list either specifies a string (local font name) or a URL (remote font to download). CSSFontFaceSrcValue* item = toCSSFontFaceSrcValue(srcList->item(i)); OwnPtrWillBeRawPtr<CSSFontFaceSource> source = nullptr; if (!item->isLocal()) { const Settings* settings = document ? document->settings() : nullptr; bool allowDownloading = settings && settings->downloadableBinaryFontsEnabled(); if (allowDownloading && item->isSupportedFormat() && document) { FontResource* fetched = item->fetch(document); if (fetched) { FontLoader* fontLoader = document->styleEngine().fontSelector()->fontLoader(); source = adoptPtrWillBeNoop(new RemoteFontFaceSource(fetched, fontLoader)); } } } else { source = adoptPtrWillBeNoop(new LocalFontFaceSource(item->resource())); } if (source) m_cssFontFace->addSource(source.release()); } }
void FontFace::initCSSFontFace(Document* document, PassRefPtrWillBeRawPtr<CSSValue> src) { m_cssFontFace = createCSSFontFace(this, m_unicodeRange.get()); if (m_error) return; // Each item in the src property's list is a single CSSFontFaceSource. Put them all into a CSSFontFace. ASSERT(src); ASSERT(src->isValueList()); CSSValueList* srcList = toCSSValueList(src.get()); int srcLength = srcList->length(); bool foundSVGFont = false; for (int i = 0; i < srcLength; i++) { // An item in the list either specifies a string (local font name) or a URL (remote font to download). CSSFontFaceSrcValue* item = toCSSFontFaceSrcValue(srcList->item(i)); OwnPtrWillBeRawPtr<CSSFontFaceSource> source = nullptr; #if ENABLE(SVG_FONTS) foundSVGFont = item->isSVGFontFaceSrc() || item->svgFontFaceElement(); #endif if (!item->isLocal()) { Settings* settings = document ? document->frame() ? document->frame()->settings() : 0 : 0; bool allowDownloading = foundSVGFont || (settings && settings->downloadableBinaryFontsEnabled()); if (allowDownloading && item->isSupportedFormat() && document) { FontResource* fetched = item->fetch(document); if (fetched) { FontLoader* fontLoader = document->styleEngine()->fontSelector()->fontLoader(); #if ENABLE(SVG_FONTS) if (foundSVGFont) { source = adoptPtrWillBeNoop(new SVGRemoteFontFaceSource(item->resource(), fetched, fontLoader)); } else #endif { source = adoptPtrWillBeNoop(new RemoteFontFaceSource(fetched, fontLoader)); } } } } else { #if ENABLE(SVG_FONTS) if (item->svgFontFaceElement()) { RefPtrWillBeRawPtr<SVGFontFaceElement> fontfaceElement = item->svgFontFaceElement(); // SVGFontFaceSource assumes that it is the case where <font-face> element resides in the same document. // We put a RELEASE_ASSERT here as it will cause UAF if the assumption is false. RELEASE_ASSERT(fontfaceElement->inDocument()); RELEASE_ASSERT(fontfaceElement->document() == document); source = adoptPtrWillBeNoop(new SVGFontFaceSource(fontfaceElement.get())); } else #endif { source = adoptPtrWillBeNoop(new LocalFontFaceSource(item->resource())); } } if (source) m_cssFontFace->addSource(source.release()); } }
bool MediaQuerySet::add(const String& queryString) { // To "parse a media query" for a given string means to follow "the parse // a media query list" steps and return "null" if more than one media query // is returned, or else the returned media query. RefPtrWillBeRawPtr<MediaQuerySet> result = create(queryString); // Only continue if exactly one media query is found, as described above. if (result->m_queries.size() != 1) return true; OwnPtrWillBeRawPtr<MediaQuery> newQuery = result->m_queries[0].release(); ASSERT(newQuery); // If comparing with any of the media queries in the collection of media // queries returns true terminate these steps. for (size_t i = 0; i < m_queries.size(); ++i) { MediaQuery* query = m_queries[i].get(); if (*query == *newQuery) return true; } m_queries.append(newQuery.release()); return true; }
int setInterval(ScriptState* scriptState, EventTarget& eventTarget, const ScriptValue& handler, int timeout, const Vector<ScriptValue>& arguments) { ExecutionContext* executionContext = eventTarget.executionContext(); if (!isAllowed(scriptState, executionContext, false)) return 0; OwnPtrWillBeRawPtr<ScheduledAction> action = ScheduledAction::create(scriptState, handler, arguments); return DOMTimer::install(executionContext, action.release(), timeout, false); }
virtual void performTask(ExecutionContext* scriptContext) { ASSERT_WITH_SECURITY_IMPLICATION(scriptContext->isWorkerGlobalScope()); DedicatedWorkerGlobalScope* context = static_cast<DedicatedWorkerGlobalScope*>(scriptContext); OwnPtrWillBeRawPtr<MessagePortArray> ports = MessagePort::entanglePorts(*scriptContext, m_channels.release()); context->dispatchEvent(MessageEvent::create(ports.release(), m_message)); context->thread()->workerObjectProxy().confirmMessageFromWorkerObject(context->hasPendingActivity()); }
void WorkerMessagingProxy::postMessageToWorkerObject(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels) { if (!m_workerObject || m_askedToTerminate) return; OwnPtrWillBeRawPtr<MessagePortArray> ports = MessagePort::entanglePorts(*m_executionContext.get(), channels); m_workerObject->dispatchEvent(MessageEvent::create(ports.release(), message)); }
PassOwnPtrWillBeRawPtr<InterpolableValue> IntegerOptionalIntegerSVGInterpolation::toInterpolableValue(SVGPropertyBase* value) { RefPtrWillBeRawPtr<SVGIntegerOptionalInteger> integerOptionalInteger = toSVGIntegerOptionalInteger(value); OwnPtrWillBeRawPtr<InterpolableList> result = InterpolableList::create(2); result->set(0, InterpolableNumber::create(integerOptionalInteger->firstInteger()->value())); result->set(1, InterpolableNumber::create(integerOptionalInteger->secondInteger()->value())); return result.release(); }
PassOwnPtrWillBeRawPtr<NodeSet> NodeSet::create(const NodeSet& other) { OwnPtrWillBeRawPtr<NodeSet> nodeSet = NodeSet::create(); nodeSet->m_isSorted = other.m_isSorted; nodeSet->m_subtreesAreDisjoint = other.m_subtreesAreDisjoint; nodeSet->m_nodes.appendVector(other.m_nodes); return nodeSet.release(); }
BisonCSSParser::RuleList* BisonCSSParser::createRuleList() { OwnPtrWillBeRawPtr<RuleList> list = adoptPtrWillBeNoop(new RuleList); RuleList* listPtr = list.get(); m_parsedRuleLists.append(list.release()); return listPtr; }
bool MediaQueryData::addExpression() { OwnPtrWillBeRawPtr<MediaQueryExp> expression = MediaQueryExp::createIfValid(m_mediaFeature, m_valueList); bool isValid = !!expression; m_expressions.append(expression.release()); m_valueList.clear(); return isValid; }
TEST_F(AnimationInterpolableValueTest, SimpleList) { OwnPtrWillBeRawPtr<InterpolableList> listA = InterpolableList::create(3); listA->set(0, InterpolableNumber::create(0)); listA->set(1, InterpolableNumber::create(42)); listA->set(2, InterpolableNumber::create(20.5)); OwnPtrWillBeRawPtr<InterpolableList> listB = InterpolableList::create(3); listB->set(0, InterpolableNumber::create(100)); listB->set(1, InterpolableNumber::create(-200)); listB->set(2, InterpolableNumber::create(300)); RefPtrWillBeRawPtr<Interpolation> i = interpolateLists(listA.release(), listB.release(), 0.3); InterpolableList* outList = toInterpolableList(interpolationValue(*i.get())); EXPECT_FLOAT_EQ(30, toInterpolableNumber(outList->get(0))->value()); EXPECT_FLOAT_EQ(-30.6f, toInterpolableNumber(outList->get(1))->value()); EXPECT_FLOAT_EQ(104.35f, toInterpolableNumber(outList->get(2))->value()); }
void RejectedPromises::dispose() { if (m_queue.isEmpty()) return; OwnPtrWillBeRawPtr<MessageQueue> queue = createMessageQueue(); queue->swap(m_queue); processQueueNow(queue.release()); }
PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> CSSAnimations::calculateUpdate(const Element* animatingElement, Element& element, const RenderStyle& style, RenderStyle* parentStyle, StyleResolver* resolver) { OwnPtrWillBeRawPtr<CSSAnimationUpdate> update = adoptPtrWillBeNoop(new CSSAnimationUpdate()); calculateAnimationUpdate(update.get(), animatingElement, element, style, parentStyle, resolver); calculateAnimationActiveInterpolations(update.get(), animatingElement, element.document().timeline().currentTimeInternal()); calculateTransitionUpdate(update.get(), animatingElement, style); calculateTransitionActiveInterpolations(update.get(), animatingElement, element.document().timeline().currentTimeInternal()); return update->isEmpty() ? nullptr : update.release(); }
PassOwnPtrWillBeRawPtr<ColorChooser> ChromeClientImpl::createColorChooser(LocalFrame* frame, ColorChooserClient* chooserClient, const Color&) { OwnPtrWillBeRawPtr<ColorChooserUIController> controller = nullptr; if (RuntimeEnabledFeatures::pagePopupEnabled()) controller = ColorChooserPopupUIController::create(frame, this, chooserClient); else controller = ColorChooserUIController::create(frame, chooserClient); controller->openUI(); return controller.release(); }
PassOwnPtrWillBeRawPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElement* canvas, WebGLContextAttributes* attrs) { Document& document = canvas->document(); LocalFrame* frame = document.frame(); if (!frame) { canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, "Web page was not allowed to create a WebGL context.")); return nullptr; } Settings* settings = frame->settings(); // The FrameLoaderClient might block creation of a new WebGL context despite the page settings; in // particular, if WebGL contexts were lost one or more times via the GL_ARB_robustness extension. if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled())) { canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, "Web page was not allowed to create a WebGL context.")); return nullptr; } // The only situation that attrs is null is through Document::getCSSCanvasContext(). RefPtrWillBeRawPtr<WebGLContextAttributes> defaultAttrs = nullptr; if (!attrs) { defaultAttrs = WebGLContextAttributes::create(); attrs = defaultAttrs.get(); } blink::WebGraphicsContext3D::Attributes attributes = attrs->attributes(document.topDocument().url().string(), settings, 1); blink::WebGLInfo glInfo; OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::current()->createOffscreenGraphicsContext3D(attributes, 0, &glInfo)); if (!context) { String statusMessage("Could not create a WebGL context for VendorInfo = "); statusMessage.append(glInfo.vendorInfo); statusMessage.append(", RendererInfo = "); statusMessage.append(glInfo.rendererInfo); statusMessage.append(", DriverInfo = "); statusMessage.append(glInfo.driverVersion); statusMessage.append("."); canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, statusMessage)); return nullptr; } OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(context.get()); if (!extensionsUtil) return nullptr; if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) context->pushGroupMarkerEXT("WebGLRenderingContext"); OwnPtrWillBeRawPtr<WebGLRenderingContext> renderingContext = adoptPtrWillBeNoop(new WebGLRenderingContext(canvas, context.release(), attrs)); renderingContext->registerContextExtensions(); renderingContext->suspendIfNeeded(); if (!renderingContext->drawingBuffer()) { canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, "Could not create a WebGL context.")); return nullptr; } return renderingContext.release(); }
bool HTMLPlugInElement::loadPlugin(const KURL& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallback, bool requireLayoutObject) { LocalFrame* frame = document().frame(); if (!frame->loader().allowPlugins(AboutToInstantiatePlugin)) return false; LayoutEmbeddedObject* layoutObject = layoutEmbeddedObject(); // FIXME: This code should not depend on layoutObject! if ((!layoutObject && requireLayoutObject) || useFallback) return false; WTF_LOG(Plugins, "%p Plugin URL: %s", this, m_url.utf8().data()); WTF_LOG(Plugins, " Loaded URL: %s", url.string().utf8().data()); m_loadedUrl = url; OwnPtrWillBeRawPtr<PluginPlaceholder> placeholder = nullptr; RefPtrWillBeRawPtr<Widget> widget = m_persistedPluginWidget; if (!widget) { bool loadManually = document().isPluginDocument() && !document().containsPlugins(); placeholder = frame->loader().client()->createPluginPlaceholder(document(), url, paramNames, paramValues, mimeType, loadManually); if (!placeholder) { FrameLoaderClient::DetachedPluginPolicy policy = requireLayoutObject ? FrameLoaderClient::FailOnDetachedPlugin : FrameLoaderClient::AllowDetachedPlugin; widget = frame->loader().client()->createPlugin(this, url, paramNames, paramValues, mimeType, loadManually, policy); } } if (!placeholder && !widget) { if (layoutObject && !layoutObject->showsUnavailablePluginIndicator()) layoutObject->setPluginUnavailabilityReason(LayoutEmbeddedObject::PluginMissing); setPlaceholder(nullptr); return false; } if (placeholder) { setPlaceholder(placeholder.release()); return true; } if (layoutObject) { setWidget(widget); setPersistedPluginWidget(nullptr); } else { setPersistedPluginWidget(widget.get()); } setPlaceholder(nullptr); document().setContainsPlugins(); scheduleSVGFilterLayerUpdateHack(); // Make sure any input event handlers introduced by the plugin are taken into account. if (Page* page = document().frame()->page()) { if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator()) scrollingCoordinator->notifyLayoutUpdated(); } return true; }
void CustomElementScheduler::resolveOrScheduleResolution(PassRefPtrWillBeRawPtr<CustomElementRegistrationContext> context, PassRefPtrWillBeRawPtr<Element> element, const CustomElementDescriptor& descriptor) { if (CustomElementProcessingStack::inCallbackDeliveryScope()) { context->resolve(element.get(), descriptor); return; } Document& document = element->document(); OwnPtrWillBeRawPtr<CustomElementMicrotaskResolutionStep> step = CustomElementMicrotaskResolutionStep::create(context, element, descriptor); enqueueMicrotaskStep(document, step.release()); }
void CustomElementScheduler::resolveOrScheduleResolution(PassRefPtrWillBeRawPtr<CustomElementRegistrationContext> context, PassRefPtrWillBeRawPtr<Element> element, const CustomElementDescriptor& descriptor) { if (CustomElementCallbackDispatcher::inCallbackDeliveryScope()) { context->resolve(element.get(), descriptor); return; } HTMLImportLoader* loader = element->document().importLoader(); OwnPtrWillBeRawPtr<CustomElementMicrotaskResolutionStep> step = CustomElementMicrotaskResolutionStep::create(context, element, descriptor); CustomElementMicrotaskDispatcher::instance().enqueue(loader, step.release()); }
// static PassOwnPtrWillBeRawPtr<MessagePortArray> MessagePort::toMessagePortArray(ExecutionContext* context, const blink::WebMessagePortChannelArray& webChannels) { OwnPtrWillBeRawPtr<MessagePortArray> ports = nullptr; if (!webChannels.isEmpty()) { OwnPtr<MessagePortChannelArray> channels = adoptPtr(new MessagePortChannelArray(webChannels.size())); for (size_t i = 0; i < webChannels.size(); ++i) (*channels)[i] = adoptPtr(webChannels[i]); ports = MessagePort::entanglePorts(*context, channels.release()); } return ports.release(); }
InspectorState* InspectorCompositeState::createAgentState(const String& agentName) { ASSERT(m_stateObject->find(agentName) == m_stateObject->end()); ASSERT(m_inspectorStateMap.find(agentName) == m_inspectorStateMap.end()); RefPtr<JSONObject> stateProperties = JSONObject::create(); m_stateObject->setObject(agentName, stateProperties); OwnPtrWillBeRawPtr<InspectorState> statePtr = adoptPtrWillBeNoop(new InspectorState(this, stateProperties)); InspectorState* state = statePtr.get(); m_inspectorStateMap.add(agentName, statePtr.release()); return state; }
V8Inspector::V8Inspector(v8::Isolate* isolate, PassOwnPtr<WorkerThreadDebugger::ClientMessageLoop> messageLoop) : m_stateClient(adoptPtr(new StateClientImpl())) , m_state(adoptPtrWillBeNoop(new InspectorCompositeState(m_stateClient.get()))) , m_injectedScriptManager(InjectedScriptManager::createForWorker()) , m_workerThreadDebugger(WorkerThreadDebugger::create(isolate, messageLoop)) , m_agents(m_state.get()) , m_frontendChannel(nullptr) , m_paused(false) { ScriptState* scriptState = ScriptState::current(isolate); OwnPtrWillBeRawPtr<WorkerRuntimeAgent> workerRuntimeAgent = WorkerRuntimeAgent::create(m_injectedScriptManager.get(), m_workerThreadDebugger->debugger(), scriptState, this); m_workerRuntimeAgent = workerRuntimeAgent.get(); m_agents.append(workerRuntimeAgent.release()); OwnPtrWillBeRawPtr<WorkerDebuggerAgent> workerDebuggerAgent = WorkerDebuggerAgent::create(m_workerThreadDebugger.get(), m_injectedScriptManager.get(), scriptState); m_workerDebuggerAgent = workerDebuggerAgent.get(); m_agents.append(workerDebuggerAgent.release()); m_injectedScriptManager->injectedScriptHost()->init(m_workerDebuggerAgent, nullptr, m_workerThreadDebugger->debugger(), adoptPtr(new InjectedScriptHostClientImpl())); }
ScriptPromise FetchManager::fetch(ScriptState* scriptState, FetchRequestData* request) { RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scriptState); ScriptPromise promise = resolver->promise(); request->setContext(WebURLRequest::RequestContextFetch); OwnPtrWillBeRawPtr<Loader> ownLoader = Loader::create(m_executionContext, this, resolver.release(), request); Loader* loader = m_loaders.add(ownLoader.release()).storedValue->get(); loader->start(); return promise; }
int setInterval(ScriptState* scriptState, EventTarget& eventTarget, const String& handler, int timeout, const Vector<ScriptValue>&) { ExecutionContext* executionContext = eventTarget.executionContext(); if (!isAllowed(scriptState, executionContext, true)) return 0; // Don't allow setting timeouts to run empty functions. Was historically a // perfomance issue. if (handler.isEmpty()) return 0; OwnPtrWillBeRawPtr<ScheduledAction> action = ScheduledAction::create(scriptState, handler); return DOMTimer::install(executionContext, action.release(), timeout, false); }
HTMLImportChild* HTMLImportsController::createChild(const KURL& url, HTMLImportLoader* loader, HTMLImport* parent, HTMLImportChildClient* client) { HTMLImport::SyncMode mode = client->isSync() && !makesCycle(parent, url) ? HTMLImport::Sync : HTMLImport::Async; if (mode == HTMLImport::Async) UseCounter::count(root()->document(), UseCounter::HTMLImportsAsyncAttribute); OwnPtrWillBeRawPtr<HTMLImportChild> child = adoptPtrWillBeNoop(new HTMLImportChild(url, loader, mode)); child->setClient(client); parent->appendImport(child.get()); loader->addImport(child.get()); return root()->add(child.release()); }