void ImageDocumentParser::finish() { if (!isStopped() && document()->imageElement() && document()->cachedImage()) { ImageResource* cachedImage = document()->cachedImage(); DocumentLoader* loader = document()->loader(); cachedImage->setResponse(loader->response()); cachedImage->setLoadFinishTime(loader->timing().responseEnd()); cachedImage->finish(); // Report the natural image size in the page title, regardless of zoom level. // At a zoom level of 1 the image is guaranteed to have an integer size. IntSize size = flooredIntSize(cachedImage->imageSizeForLayoutObject(document()->imageElement()->layoutObject(), 1.0f)); if (size.width()) { // Compute the title, we use the decoded filename of the resource, falling // back on the (decoded) hostname if there is no path. String fileName = decodeURLEscapeSequences(document()->url().lastPathComponent()); if (fileName.isEmpty()) fileName = document()->url().host(); document()->setTitle(imageTitle(fileName, size)); } document()->imageUpdated(); } // TODO(esprehn): These null checks on Document don't make sense, document() // will ASSERT if it was null. Do these want to check isDetached() ? if (document()) document()->finishedParsing(); }
DocumentLoadTiming* PerformanceTiming::documentLoadTiming() const { DocumentLoader* loader = documentLoader(); if (!loader) return nullptr; return &loader->timing(); }
unsigned short PerformanceNavigation::redirectCount() const { if (!frame()) return 0; DocumentLoader* loader = frame()->loader().documentLoader(); if (!loader) return 0; const DocumentLoadTiming& timing = loader->timing(); if (timing.hasCrossOriginRedirect()) return 0; return timing.redirectCount(); }
unsigned short PerformanceNavigation::redirectCount() const { if (!m_frame) return 0; DocumentLoader* loader = m_frame->loader()->documentLoader(); if (!loader) return 0; DocumentLoadTiming* timing = loader->timing(); if (timing->hasCrossOriginRedirect) return 0; return timing->redirectCount; }