void CompositeViewer::update() { mSimulationTime += mFrameTimer.time_s(); mFrameTimer.setStartTick(); frame(mSimulationTime); }
void FrameFetchContext::countClientHintsResourceWidth() { UseCounter::count(frame(), UseCounter::ClientHintsResourceWidth); }
WebTaskRunner* FrameFetchContext::loadingTaskRunner() const { return frame()->frameScheduler()->loadingTaskRunner(); }
bool FrameFetchContext::defersLoading() const { return frame()->page()->defersLoading(); }
void FrameFetchContext::addConsoleMessage(const String& message) const { if (frame()->document()) frame()->document()->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, message)); }
void FrameFetchContext::didLoadResource() { frame()->loader().checkCompleted(); }
ResourceRequestBlockedReason FrameFetchContext::canRequestInternal(Resource::Type type, const ResourceRequest& resourceRequest, const KURL& url, const ResourceLoaderOptions& options, bool forPreload, FetchRequest::OriginRestriction originRestriction) const { InstrumentingAgents* agents = InspectorInstrumentation::instrumentingAgentsFor(frame()); if (agents && agents->inspectorResourceAgent()) { if (agents->inspectorResourceAgent()->shouldBlockRequest(resourceRequest)) return ResourceRequestBlockedReasonInspector; } SecurityOrigin* securityOrigin = options.securityOrigin.get(); if (!securityOrigin && m_document) securityOrigin = m_document->securityOrigin(); if (originRestriction != FetchRequest::NoOriginRestriction && securityOrigin && !securityOrigin->canDisplay(url)) { if (!forPreload) FrameLoader::reportLocalLoadFailed(frame(), url.elidedString()); WTF_LOG(ResourceLoading, "ResourceFetcher::requestResource URL was not allowed by SecurityOrigin::canDisplay"); return ResourceRequestBlockedReasonOther; } // Some types of resources can be loaded only from the same origin. Other // types of resources, like Images, Scripts, and CSS, can be loaded from // any URL. switch (type) { case Resource::MainResource: case Resource::Image: case Resource::CSSStyleSheet: case Resource::Script: case Resource::Font: case Resource::Raw: case Resource::LinkPrefetch: case Resource::LinkSubresource: case Resource::LinkPreload: case Resource::TextTrack: case Resource::ImportResource: case Resource::Media: // By default these types of resources can be loaded from any origin. // FIXME: Are we sure about Resource::Font? if (originRestriction == FetchRequest::RestrictToSameOrigin && !securityOrigin->canRequest(url)) { printAccessDeniedMessage(url); return ResourceRequestBlockedReasonOrigin; } break; case Resource::XSLStyleSheet: ASSERT(RuntimeEnabledFeatures::xsltEnabled()); case Resource::SVGDocument: if (!securityOrigin->canRequest(url)) { printAccessDeniedMessage(url); return ResourceRequestBlockedReasonOrigin; } break; } // FIXME: Convert this to check the isolated world's Content Security Policy once webkit.org/b/104520 is solved. bool shouldBypassMainWorldCSP = frame()->script().shouldBypassMainWorldCSP() || options.contentSecurityPolicyOption == DoNotCheckContentSecurityPolicy; // Don't send CSP messages for preloads, we might never actually display those items. ContentSecurityPolicy::ReportingStatus cspReporting = forPreload ? ContentSecurityPolicy::SuppressReport : ContentSecurityPolicy::SendReport; // As of CSP2, for requests that are the results of redirects, the match // algorithm should ignore the path component of the URL. ContentSecurityPolicy::RedirectStatus redirectStatus = resourceRequest.followedRedirect() ? ContentSecurityPolicy::DidRedirect : ContentSecurityPolicy::DidNotRedirect; // m_document can be null, but not in any of the cases where csp is actually used below. // ImageResourceTest.MultipartImage crashes w/o the m_document null check. // I believe it's the Resource::Raw case. const ContentSecurityPolicy* csp = m_document ? m_document->contentSecurityPolicy() : nullptr; // FIXME: This would be cleaner if moved this switch into an allowFromSource() // helper on this object which took a Resource::Type, then this block would // collapse to about 10 lines for handling Raw and Script special cases. switch (type) { case Resource::XSLStyleSheet: ASSERT(RuntimeEnabledFeatures::xsltEnabled()); ASSERT(ContentSecurityPolicy::isScriptResource(resourceRequest)); if (!shouldBypassMainWorldCSP && !csp->allowScriptFromSource(url, redirectStatus, cspReporting)) return ResourceRequestBlockedReasonCSP; break; case Resource::Script: case Resource::ImportResource: ASSERT(ContentSecurityPolicy::isScriptResource(resourceRequest)); if (!shouldBypassMainWorldCSP && !csp->allowScriptFromSource(url, redirectStatus, cspReporting)) return ResourceRequestBlockedReasonCSP; if (!frame()->loader().client()->allowScriptFromSource(!frame()->settings() || frame()->settings()->scriptEnabled(), url)) { frame()->loader().client()->didNotAllowScript(); return ResourceRequestBlockedReasonCSP; } break; case Resource::CSSStyleSheet: ASSERT(ContentSecurityPolicy::isStyleResource(resourceRequest)); if (!shouldBypassMainWorldCSP && !csp->allowStyleFromSource(url, redirectStatus, cspReporting)) return ResourceRequestBlockedReasonCSP; break; case Resource::SVGDocument: case Resource::Image: ASSERT(ContentSecurityPolicy::isImageResource(resourceRequest)); if (!shouldBypassMainWorldCSP && !csp->allowImageFromSource(url, redirectStatus, cspReporting)) return ResourceRequestBlockedReasonCSP; break; case Resource::Font: { ASSERT(ContentSecurityPolicy::isFontResource(resourceRequest)); if (!shouldBypassMainWorldCSP && !csp->allowFontFromSource(url, redirectStatus, cspReporting)) return ResourceRequestBlockedReasonCSP; break; } case Resource::MainResource: case Resource::Raw: case Resource::LinkPrefetch: case Resource::LinkSubresource: case Resource::LinkPreload: break; case Resource::Media: case Resource::TextTrack: ASSERT(ContentSecurityPolicy::isMediaResource(resourceRequest)); if (!shouldBypassMainWorldCSP && !csp->allowMediaFromSource(url, redirectStatus, cspReporting)) return ResourceRequestBlockedReasonCSP; if (!frame()->loader().client()->allowMedia(url)) return ResourceRequestBlockedReasonOther; break; } // SVG Images have unique security rules that prevent all subresource requests // except for data urls. if (type != Resource::MainResource && frame()->chromeClient().isSVGImageChromeClient() && !url.protocolIsData()) return ResourceRequestBlockedReasonOrigin; // FIXME: Once we use RequestContext for CSP (http://crbug.com/390497), remove this extra check. if (resourceRequest.requestContext() == WebURLRequest::RequestContextManifest) { if (!shouldBypassMainWorldCSP && !csp->allowManifestFromSource(url, redirectStatus, cspReporting)) return ResourceRequestBlockedReasonCSP; } // Measure the number of legacy URL schemes ('ftp://') and the number of embedded-credential // ('http://*****:*****@...') resources embedded as subresources. in the hopes that we can // block them at some point in the future. if (resourceRequest.frameType() != WebURLRequest::FrameTypeTopLevel) { ASSERT(frame()->document()); if (SchemeRegistry::shouldTreatURLSchemeAsLegacy(url.protocol()) && !SchemeRegistry::shouldTreatURLSchemeAsLegacy(frame()->document()->securityOrigin()->protocol())) UseCounter::count(frame()->document(), UseCounter::LegacyProtocolEmbeddedAsSubresource); if (!url.user().isEmpty() || !url.pass().isEmpty()) UseCounter::count(frame()->document(), UseCounter::RequestedSubresourceWithEmbeddedCredentials); } // Measure the number of pages that load resources after a redirect // when a CSP is active, to see if implementing CSP // 'unsafe-redirect' is feasible. if (csp && csp->isActive() && resourceRequest.frameType() != WebURLRequest::FrameTypeTopLevel && resourceRequest.frameType() != WebURLRequest::FrameTypeAuxiliary && redirectStatus == ContentSecurityPolicy::DidRedirect) { ASSERT(frame()->document()); UseCounter::count(frame()->document(), UseCounter::ResourceLoadedAfterRedirectWithCSP); } // Last of all, check for mixed content. We do this last so that when // folks block mixed content with a CSP policy, they don't get a warning. // They'll still get a warning in the console about CSP blocking the load. MixedContentChecker::ReportingStatus mixedContentReporting = forPreload ? MixedContentChecker::SuppressReport : MixedContentChecker::SendReport; if (MixedContentChecker::shouldBlockFetch(MixedContentChecker::effectiveFrameForFrameType(frame(), resourceRequest.frameType()), resourceRequest, url, mixedContentReporting)) return ResourceRequestBlockedReasonMixedContent; return ResourceRequestBlockedReasonNone; }
void ClientPrivate::sendPuback(quint8 type, quint16 mid) { Frame frame(type); frame.writeInt(mid); network->sendFrame(frame); }
void ClientPrivate::sendPing() { Frame frame(PINGREQ); network->sendFrame(frame); }
inline Float sampleSingleLobe(PhaseFunctionSamplingRecord &pRec, Sampler *sampler, int lobeIdx) const { Vector wi = pRec.wi; #ifdef USE_STOC_EVAL Spectrum s1 = pRec.mRec.s1; Spectrum s2 = pRec.mRec.s2; #else Spectrum s1 = pRec.mRec.s1[lobeIdx]; Spectrum s2 = pRec.mRec.s2[lobeIdx]; #endif Float Sxx = s1[0], Syy = s1[1], Szz = s1[2]; Float Sxy = s2[0], Sxz = s2[1], Syz = s2[2]; Float sqrSum = Sxx * Sxx + Syy * Syy + Szz * Szz + Sxy * Sxy + Sxz * Sxz + Syz * Syz; //if (!(Sxx == 0 && Syy == 0 && Szz == 0 && Sxy == 0 && Sxz == 0 && Syz == 0)) if (fabsf(sqrSum) < 1e-6f) return 0; Vector wm = sampleVNormal(wi, sampler, Sxx, Syy, Szz, Sxy, Sxz, Syz); if (m_sampleType == ESpecular) { Vector wo = -wi + 2.f * dot(wm, wi) * wm; pRec.wo = normalize(wo); return 1.f; } else if (m_sampleType == EDiffuse) { Float u1 = sampler->next1D(); Float u2 = sampler->next1D(); Frame frame(wm); Float r1 = 2.f * u1 - 1.f; Float r2 = 2.f * u2 - 1.f; Float phi, r; if (r1 == 0 && r2 == 0) { r = phi = 0; } else if (r1 * r1 > r2 * r2) { r = r1; phi = (M_PI / 4.f) * (r2 / r1); } else { r = r2; phi = (M_PI / 2.f) - (r1 / r2) * (M_PI / 4.f); } Float x = r * cosf(phi); Float y = r * sinf(phi); Float z = sqrtf(1.f - x * x - y * y); Vector wo = x * frame.s + y * frame.t + z * wm; wo = normalize(wo); pRec.wo = wo; return 1.f; } else if (m_sampleType == EMixed) { Float flag = sampler->next1D(); if (flag < m_mixedWeight) { // specular Vector wo = -wi + 2.f * dot(wm, wi) * wm; pRec.wo = normalize(wo); return 1.f; } else { // diffuse Float u1 = sampler->next1D(); Float u2 = sampler->next1D(); Frame frame(wm); Float r1 = 2.f * u1 - 1.f; Float r2 = 2.f * u2 - 1.f; Float phi, r; if (r1 == 0 && r2 == 0) { r = phi = 0; } else if (r1 * r1 > r2 * r2) { r = r1; phi = (M_PI / 4.f) * (r2 / r1); } else { r = r2; phi = (M_PI / 2.f) - (r1 / r2) * (M_PI / 4.f); } Float x = r * cosf(phi); Float y = r * sinf(phi); Float z = sqrtf(1.f - x * x - y * y); Vector wo = x * frame.s + y * frame.t + z * wm; wo = normalize(wo); pRec.wo = wo; return 1.f; } } else return 0.f; }
nsresult ISOMediaWriter::WriteEncodedTrack(const EncodedFrameContainer& aData, uint32_t aFlags) { PROFILER_LABEL("ISOMediaWriter", "WriteEncodedTrack", js::ProfileEntry::Category::OTHER); // Muxing complete, it doesn't allowed to reentry again. if (mState == MUXING_DONE) { MOZ_ASSERT(false); return NS_ERROR_FAILURE; } FragmentBuffer* frag = nullptr; uint32_t len = aData.GetEncodedFrames().Length(); if (!len) { // no frame? why bother to WriteEncodedTrack return NS_OK; } for (uint32_t i = 0; i < len; i++) { nsRefPtr<EncodedFrame> frame(aData.GetEncodedFrames()[i]); EncodedFrame::FrameType type = frame->GetFrameType(); if (type == EncodedFrame::AAC_AUDIO_FRAME || type == EncodedFrame::AAC_CSD || type == EncodedFrame::AMR_AUDIO_FRAME || type == EncodedFrame::AMR_AUDIO_CSD) { frag = mAudioFragmentBuffer; } else if (type == EncodedFrame::AVC_I_FRAME || type == EncodedFrame::AVC_P_FRAME || type == EncodedFrame::AVC_B_FRAME || type == EncodedFrame::AVC_CSD) { frag = mVideoFragmentBuffer; } else { MOZ_ASSERT(0); return NS_ERROR_FAILURE; } frag->AddFrame(frame); } // Encoder should send CSD (codec specific data) frame before sending the // audio/video frames. When CSD data is ready, it is sufficient to generate a // moov data. If encoder doesn't send CSD yet, muxer needs to wait before // generating anything. if (mType & Audio_Track && (!mAudioFragmentBuffer || !mAudioFragmentBuffer->HasCSD())) { return NS_OK; } if (mType & Video_Track && (!mVideoFragmentBuffer || !mVideoFragmentBuffer->HasCSD())) { return NS_OK; } // Only one FrameType in EncodedFrameContainer so it doesn't need to be // inside the for-loop. if (frag && (aFlags & END_OF_STREAM)) { frag->SetEndOfStream(); } nsresult rv; bool EOS; if (ReadyToRunState(EOS)) { // Because track encoder won't generate new data after EOS, it needs to make // sure the state reaches MUXING_DONE when EOS is signaled. do { rv = RunState(); } while (EOS && mState != MUXING_DONE); NS_ENSURE_SUCCESS(rv, rv); } return NS_OK; }
PassRefPtr<ArchiveResource> DocumentLoader::mainResource() const { const ResourceResponse& r = response(); RefPtr<SharedBuffer> mainResourceBuffer = mainResourceData(); if (!mainResourceBuffer) mainResourceBuffer = SharedBuffer::create(); return ArchiveResource::create(mainResourceBuffer, r.url(), r.mimeType(), r.textEncodingName(), frame()->tree()->uniqueName()); }
v8::MaybeLocal<v8::Value> ScriptController::callFunction(v8::Local<v8::Function> function, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info[]) { // Keep LocalFrame (and therefore ScriptController) alive. RefPtrWillBeRawPtr<LocalFrame> protect(frame()); return ScriptController::callFunction(frame()->document(), function, receiver, argc, info, isolate()); }
void ExcitedStates::initMoPlot() { m_moPlot = new QCustomPlot(); m_moPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables); m_moPlot->axisRect()->setRangeDrag(m_moPlot->yAxis->orientation()); m_moPlot->axisRect()->setRangeZoom(m_moPlot->yAxis->orientation()); m_moPlot->xAxis->setSelectableParts(QCPAxis::spNone); QFrame* frame(m_configurator.moFrame); QVBoxLayout* layout(new QVBoxLayout()); frame->setLayout(layout); layout->addWidget(m_moPlot); //layout->addWidget(new QLabel("This is a test")); //layout->setStretch(0,1); //layout->setStretch(1,0); QVector<double> ticks; QVector<QString> labels; ticks << 0.75 << 2.50; labels << "Alpha" << "Beta"; m_moPlot->xAxis->setAutoTicks(false); m_moPlot->xAxis->setAutoTickLabels(false); m_moPlot->xAxis->setTickVector(ticks); m_moPlot->xAxis->setTickVectorLabels(labels); m_moPlot->xAxis->setSubTickCount(0); m_moPlot->xAxis->setRange(0,3.25); Data::OrbitalSymmetries const& orbitals(m_excitedStates.data().orbitalSymmetries()); unsigned nOrbs(orbitals.nOrbitals()); unsigned nAlpha(orbitals.nAlpha()); unsigned nBeta(orbitals.nBeta()); QVector<double> xAlpha(nOrbs), yAlpha(nOrbs), xBeta(nOrbs), yBeta(nOrbs); QVector<double> a(1), b(1), y(1); QCPGraph* graph(0); unsigned i(0), g(0); Data::Spin spin(Data::Alpha); while (i < nOrbs) { y[0] = orbitals.energy(spin, i); g = 1; // degeneracy while (i+g < nOrbs && std::abs(y[0]-orbitals.energy(spin, i+g)) < 0.001) { ++g; } for (unsigned k = i; k < i+g; ++k) { a[0] = 0.75 - 0.25*(g-1) + (k-i)*0.50; graph = m_moPlot->addGraph(); graph->setData(a, y); graph->setName(QString::number(k)); graph->setScatterStyle(k<nAlpha ? QCPScatterStyle::ssOccupied : QCPScatterStyle::ssVirtual); connect(graph, SIGNAL(selectionChanged(bool)), this, SLOT(moSelectionChanged(bool))); } i += g; } i = 0; spin = Data::Beta; while (i < nOrbs) { y[0] = orbitals.energy(spin, i); g = 1; // degeneracy while (i+g < nOrbs && std::abs(y[0]-orbitals.energy(spin, i+g)) < 0.001) { ++g; } for (unsigned k = i; k < i+g; ++k) { a[0] = 2.50 - 0.25*(g-1) + (k-i)*0.50; graph = m_moPlot->addGraph(); graph->setData(a, y); graph->setName(QString::number(k+nOrbs)); graph->setScatterStyle(k<nBeta ? QCPScatterStyle::ssOccupied : QCPScatterStyle::ssVirtual); connect(graph, SIGNAL(selectionChanged(bool)), this, SLOT(moSelectionChanged(bool))); } i += g; } m_moPlot->yAxis->setLabel("Energy/Hartree"); m_moPlot->yAxis->setNumberPrecision(3); // Set the scale double yMin(-1.0), yMax(0.5); // Show 5 occupied and virtual orbitals to start with unsigned index, nShow(5); if (nBeta > nAlpha) { // Use the beta energies instead index = nBeta < nShow ? 0 : nBeta-nShow; yMin = orbitals.energy(Data::Beta, index); index = nOrbs > nBeta+nShow ? nBeta+nShow : nOrbs; yMax = orbitals.energy(Data::Beta, index); }else { index = nAlpha < nShow ? 0 : nAlpha-nShow; yMin = orbitals.energy(Data::Alpha, index); index = nOrbs > nAlpha+nShow ? nAlpha+nShow : nOrbs; yMax = orbitals.energy(Data::Alpha, index); } yMax = std::min(yMax, 0.5*std::abs(yMin)); m_moPlot->yAxis->setRange(1.05*yMin,1.05*yMax); // add the orbital label m_label = new QCPItemText(m_moPlot); m_moPlot->addItem(m_label); m_label->position->setType(QCPItemPosition::ptViewportRatio); m_label->setPositionAlignment(Qt::AlignTop|Qt::AlignRight); m_label->position->setCoords(0, 0); m_label->setText("Orbital"); m_label->setFont(QFont(font().family(), 10)); }
void FrameFetchContext::dispatchDidChangeResourcePriority(unsigned long identifier, ResourceLoadPriority loadPriority, int intraPriorityValue) { frame()->loader().client()->dispatchDidChangeResourcePriority(identifier, loadPriority, intraPriorityValue); }
void ClientPrivate::sendDisconnect() { Frame frame(DISCONNECT); network->sendFrame(frame); }
void FrameFetchContext::dispatchDidDownloadData(unsigned long identifier, int dataLength, int encodedDataLength) { frame()->loader().progress().incrementProgress(identifier, dataLength); TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceReceivedData", TRACE_EVENT_SCOPE_THREAD, "data", InspectorReceiveDataEvent::data(identifier, frame(), encodedDataLength)); InspectorInstrumentation::didReceiveData(frame(), identifier, 0, dataLength, encodedDataLength); }
void game (void) { int button; redraw(); rb->lcd_update(); /*main loop:*/ while (1) { if(frames==5) { frame(); if(frames > 0) frames = 0; } frames++; if(frames == 0) { die(); } else { if(frames < 0) { if(sillydir != dir) { /*it has, great set frames to a positive value again:*/ frames = 1; } } } if (dead) return; draw_apple(); rb->sleep(HZ/speed); button = rb->button_get(false); #ifdef HAS_BUTTON_HOLD if (rb->button_hold()) button = SNAKE2_PLAYPAUSE; #endif switch (button) { case SNAKE2_UP: case SNAKE2_UP | BUTTON_REPEAT: if (dir != SOUTH) set_direction(NORTH); break; case SNAKE2_RIGHT: case SNAKE2_RIGHT | BUTTON_REPEAT: if (dir != WEST) set_direction(EAST); break; case SNAKE2_DOWN: case SNAKE2_DOWN | BUTTON_REPEAT: if (dir != NORTH) set_direction(SOUTH); break; case SNAKE2_LEFT: case SNAKE2_LEFT | BUTTON_REPEAT: if (dir != EAST) set_direction(WEST); break; #ifdef SNAKE2_RC_QUIT case SNAKE2_RC_QUIT: #endif case SNAKE2_QUIT: quit = 1; return; case SNAKE2_PLAYPAUSE: game_pause(); break; default: if (rb->default_event_handler(button)==SYS_USB_CONNECTED) { quit = 2; return; } break; } } }
bool FrameFetchContext::allowImage(bool imagesEnabled, const KURL& url) const { return frame()->loader().client()->allowImage(imagesEnabled, url); }
frame box_rep::get_frame () { return frame (); }
bool FrameFetchContext::isMainFrame() const { return frame()->isMainFrame(); }
void LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion) { PROFILER_LABEL("LayerManagerComposite", "Render", js::ProfileEntry::Category::GRAPHICS); if (mDestroyed) { NS_WARNING("Call on destroyed layer manager"); return; } // At this time, it doesn't really matter if these preferences change // during the execution of the function; we should be safe in all // permutations. However, may as well just get the values onces and // then use them, just in case the consistency becomes important in // the future. bool invertVal = gfxPrefs::LayersEffectInvert(); bool grayscaleVal = gfxPrefs::LayersEffectGrayscale(); float contrastVal = gfxPrefs::LayersEffectContrast(); bool haveLayerEffects = (invertVal || grayscaleVal || contrastVal != 0.0); // Set LayerScope begin/end frame LayerScopeAutoFrame frame(PR_Now()); // Dump to console if (gfxPrefs::LayersDump()) { this->Dump(); } else if (profiler_feature_active("layersdump")) { std::stringstream ss; Dump(ss); profiler_log(ss.str().c_str()); } // Dump to LayerScope Viewer if (LayerScope::CheckSendable()) { // Create a LayersPacket, dump Layers into it and transfer the // packet('s ownership) to LayerScope. auto packet = MakeUnique<layerscope::Packet>(); layerscope::LayersPacket* layersPacket = packet->mutable_layers(); this->Dump(layersPacket); LayerScope::SendLayerDump(Move(packet)); } /** Our more efficient but less powerful alter ego, if one is available. */ RefPtr<Composer2D> composer2D; composer2D = mCompositor->GetWidget()->GetComposer2D(); // We can't use composert2D if we have layer effects if (!mTarget && !haveLayerEffects && gfxPrefs::Composer2DCompositionEnabled() && composer2D && composer2D->HasHwc() && composer2D->TryRenderWithHwc(mRoot, mCompositor->GetWidget(), mGeometryChanged)) { LayerScope::SetHWComposed(); if (mFPS) { double fps = mFPS->mCompositionFps.AddFrameAndGetFps(TimeStamp::Now()); if (gfxPrefs::LayersDrawFPS()) { printf_stderr("HWComposer: FPS is %g\n", fps); } } mCompositor->EndFrameForExternalComposition(Matrix()); mLastFrameMissedHWC = false; return; } else if (!mTarget && !haveLayerEffects) { mLastFrameMissedHWC = !!composer2D; } { PROFILER_LABEL("LayerManagerComposite", "PreRender", js::ProfileEntry::Category::GRAPHICS); if (!mCompositor->GetWidget()->PreRender(this)) { return; } } ParentLayerIntRect clipRect; Rect bounds(mRenderBounds.x, mRenderBounds.y, mRenderBounds.width, mRenderBounds.height); Rect actualBounds; CompositorBench(mCompositor, bounds); if (mRoot->GetClipRect()) { clipRect = *mRoot->GetClipRect(); Rect rect(clipRect.x, clipRect.y, clipRect.width, clipRect.height); mCompositor->BeginFrame(aInvalidRegion, &rect, bounds, nullptr, &actualBounds); } else { gfx::Rect rect; mCompositor->BeginFrame(aInvalidRegion, nullptr, bounds, &rect, &actualBounds); clipRect = ParentLayerIntRect(rect.x, rect.y, rect.width, rect.height); } if (actualBounds.IsEmpty()) { mCompositor->GetWidget()->PostRender(this); return; } // Allow widget to render a custom background. mCompositor->GetWidget()->DrawWindowUnderlay(this, IntRect(actualBounds.x, actualBounds.y, actualBounds.width, actualBounds.height)); RefPtr<CompositingRenderTarget> previousTarget; if (haveLayerEffects) { previousTarget = PushGroupForLayerEffects(); } else { mTwoPassTmpTarget = nullptr; } // Render our layers. RootLayer()->Prepare(ViewAs<RenderTargetPixel>(clipRect, PixelCastJustification::RenderTargetIsParentLayerForRoot)); RootLayer()->RenderLayer(ParentLayerIntRect::ToUntyped(clipRect)); if (!mRegionToClear.IsEmpty()) { nsIntRegionRectIterator iter(mRegionToClear); const IntRect *r; while ((r = iter.Next())) { mCompositor->ClearRect(Rect(r->x, r->y, r->width, r->height)); } } if (mTwoPassTmpTarget) { MOZ_ASSERT(haveLayerEffects); PopGroupForLayerEffects(previousTarget, ParentLayerIntRect::ToUntyped(clipRect), grayscaleVal, invertVal, contrastVal); } // Allow widget to render a custom foreground. mCompositor->GetWidget()->DrawWindowOverlay(this, IntRect(actualBounds.x, actualBounds.y, actualBounds.width, actualBounds.height)); // Debugging RenderDebugOverlay(actualBounds); { PROFILER_LABEL("LayerManagerComposite", "EndFrame", js::ProfileEntry::Category::GRAPHICS); mCompositor->EndFrame(); mCompositor->SetDispAcquireFence(mRoot, mCompositor->GetWidget()); // Call after EndFrame() } if (composer2D) { composer2D->Render(mCompositor->GetWidget()); } mCompositor->GetWidget()->PostRender(this); RecordFrame(); }
void FrameFetchContext::sendImagePing(const KURL& url) { PingLoader::loadImage(frame(), url); }
/* FUNCTION: MainApp :: MainApp ARGS: none RETURN: n/a DESCRIPTION: Application constructor */ MainApp :: MainApp(MainWindow::SHAPE shape) : BApplication("application/x_vnd.Antares") { BRect frame(50, 50, 50+400, 50+300); fWindow = new MainWindow(frame, shape); }
void FrameFetchContext::countClientHintsDPR() { UseCounter::count(frame(), UseCounter::ClientHintsDPR); }
void FrameFetchContext::setFirstPartyForCookies(ResourceRequest& request) { if (frame()->tree().top()->isLocalFrame()) request.setFirstPartyForCookies(toLocalFrame(frame()->tree().top())->document()->firstPartyForCookies()); }
void FrameFetchContext::countClientHintsViewportWidth() { UseCounter::count(frame(), UseCounter::ClientHintsViewportWidth); }
// FIXME(http://crbug.com/274173): // |loader| can be null if the resource is loaded from imported document. // This means inspector, which uses DocumentLoader as an grouping entity, // cannot see imported documents. inline DocumentLoader* FrameFetchContext::ensureLoaderForNotifications() const { return m_documentLoader ? m_documentLoader.get() : frame()->loader().documentLoader(); }
void Layer::setGeometry( const sp<const DisplayDevice>& hw, HWComposer::HWCLayerInterface& layer) { layer.setDefaultState(); // enable this layer layer.setSkip(false); if (isSecure() && !hw->isSecure()) { layer.setSkip(true); } // this gives us only the "orientation" component of the transform const State& s(getDrawingState()); if (!isOpaque() || s.alpha != 0xFF) { layer.setBlending(mPremultipliedAlpha ? HWC_BLENDING_PREMULT : HWC_BLENDING_COVERAGE); } // apply the layer's transform, followed by the display's global transform // here we're guaranteed that the layer's transform preserves rects Rect frame(s.transform.transform(computeBounds())); frame.intersect(hw->getViewport(), &frame); const Transform& tr(hw->getTransform()); layer.setFrame(tr.transform(frame)); #ifdef QCOM_BSP // set dest_rect to display width and height, if external_only flag // for the layer is enabled or if its yuvLayer in extended mode. uint32_t x = 0, y = 0; uint32_t w = hw->getWidth(); uint32_t h = hw->getHeight(); bool extendedMode = SurfaceFlinger::isExtendedMode(); if(isExtOnly()) { // Position: fullscreen for ext_only Rect r(0, 0, w, h); layer.setFrame(r); } else if(hw->getDisplayType() > 0 && (extendedMode && isYuvLayer())) { // Need to position the video full screen on external with aspect ratio Rect r = getAspectRatio(hw, s.active.w, s.active.h); layer.setFrame(r); } #endif layer.setCrop(computeCrop(hw)); layer.setPlaneAlpha(s.alpha); /* * Transformations are applied in this order: * 1) buffer orientation/flip/mirror * 2) state transformation (window manager) * 3) layer orientation (screen orientation) * (NOTE: the matrices are multiplied in reverse order) */ const Transform bufferOrientation(mCurrentTransform); Transform transform(tr * s.transform * bufferOrientation); if (mSurfaceFlingerConsumer->getTransformToDisplayInverse()) { /* * the code below applies the display's inverse transform to the buffer */ uint32_t invTransform = hw->getOrientationTransform(); // calculate the inverse transform if (invTransform & NATIVE_WINDOW_TRANSFORM_ROT_90) { invTransform ^= NATIVE_WINDOW_TRANSFORM_FLIP_V | NATIVE_WINDOW_TRANSFORM_FLIP_H; } // and apply to the current transform transform = transform * Transform(invTransform); } // this gives us only the "orientation" component of the transform const uint32_t orientation = transform.getOrientation(); if (orientation & Transform::ROT_INVALID) { // we can only handle simple transformation layer.setSkip(true); } else { layer.setTransform(orientation); } }
int msg_parts_selftest() { printf (" * msg_parts: "); int rc = 0; // @selftest void *ctx = zmq_ctx_new(); assert (ctx); void *output = zmq_socket (ctx, ZMQ_PAIR); assert (output); zmq_bind (output, "inproc://zmsg.test"); void *input = zmq_socket (ctx, ZMQ_PAIR); assert (input); zmq_connect (input, "inproc://zmsg.test"); { msg_single_t frame("Hello", 5); // zframe_new frame.send(output); // zframe_send frame.recv(input); // zframe_recv std::string str = frame.str(); // zframe_strdup std::cout << str << std::endl; } { msg_multi_t msg; msg_single_t frame("Frame3", 6); msg.parts.push_back(std::move(frame)); // zmsg_add msg.parts.emplace_back("Frame4", 6); // zmsg_addmem msg.parts.emplace_back("Frame5"); // zmsg_addstr frame.reset("Frame2", 6); msg.parts.push_front(std::move(frame)); // zmsg_push msg.parts.emplace_front("Frame1", 6); // zmsg_pushmem msg.parts.emplace_front("Frame0"); // zmsg_pushstr msg.parts.push_back(std::string("Frame6")); rc = msg.sendcopy(output); assert (rc == 0); msg_multi_t msgin; rc = msgin.recv(input); assert (rc == 0); assert (msgin.parts.size() == 7); rc = msg.send(output); // zmsg_send assert (rc == 0); rc = msg.recv(input); // zmsg_recv assert (rc == 0); assert (msg.parts.size() == 7); for (auto&& part: msg.parts) { auto str = part.str_view(); std::cout << str << std::endl; } } zmq_close(input); zmq_close(output); zmq_ctx_destroy (ctx); // @end printf ("OK\n"); return 0; }