void MainResourceLoader::load(const ResourceRequest& r, const SubstituteData& substituteData) { ASSERT(!m_handle); // It appears that it is possible for this load to be cancelled and derefenced by the DocumentLoader // in willSendRequest() if loadNow() is called. RefPtr<MainResourceLoader> protect(this); m_substituteData = substituteData; ASSERT(documentLoader()->timing()->navigationStart()); ASSERT(!documentLoader()->timing()->fetchStart()); documentLoader()->timing()->markFetchStart(); ResourceRequest request(r); documentLoader()->applicationCacheHost()->maybeLoadMainResource(request, m_substituteData); bool defer = defersLoading(); if (defer) { bool shouldLoadEmpty = shouldLoadAsEmptyDocument(request.url()); if (shouldLoadEmpty) defer = false; } if (!defer) { if (loadNow(request)) { // Started as an empty document, but was redirected to something non-empty. ASSERT(defersLoading()); defer = true; } } if (defer) m_initialRequest = request; }
bool MainResourceLoader::load(const ResourceRequest& r, const SubstituteData& substituteData) { ASSERT(!m_handle); m_substituteData = substituteData; ASSERT(documentLoader()->timing()->navigationStart); ASSERT(!documentLoader()->timing()->fetchStart); documentLoader()->timing()->fetchStart = currentTime(); ResourceRequest request(r); #if ENABLE(OFFLINE_WEB_APPLICATIONS) documentLoader()->applicationCacheHost()->maybeLoadMainResource(request, m_substituteData); #endif bool defer = defersLoading(); if (defer) { bool shouldLoadEmpty = shouldLoadAsEmptyDocument(request.url()); if (shouldLoadEmpty) defer = false; } if (!defer) { if (loadNow(request)) { // Started as an empty document, but was redirected to something non-empty. ASSERT(defersLoading()); defer = true; } } if (defer) m_initialRequest = request; return true; }
bool MainResourceLoader::load(const ResourceRequest& r, const SubstituteData& substituteData) { ASSERT(!m_handle); m_substituteData = substituteData; ResourceRequest request(r); bool defer = defersLoading(); if (defer) { bool shouldLoadEmpty = shouldLoadAsEmptyDocument(r.url()); if (shouldLoadEmpty) defer = false; } if (!defer) { if (loadNow(request)) { // Started as an empty document, but was redirected to something non-empty. ASSERT(defersLoading()); defer = true; } } if (defer) m_initialRequest = request; return true; }
void MainResourceLoader::setDefersLoading(bool defers) { ResourceLoader::setDefersLoading(defers); if (!defers) { if (!m_initialRequest.isNull()) { ResourceRequest r(m_initialRequest); m_initialRequest = ResourceRequest(); loadNow(r); } } }
BaseConfigObject::BaseConfigObject(const QString &filename) : m_filename(filename) { m_saveTimer = new QTimer; m_saveTimer->setSingleShot(true); // cppcheck-suppress pureVirtualCall QObject::connect(m_saveTimer, &QTimer::timeout, [this]() { saveNow(); }); setSaveTimeout(250); QTimer::singleShot(0, [this]() { loadNow(); }); // cppcheck-suppress pureVirtualCall m_appQuitConnection = QObject::connect(qApp, &QCoreApplication::aboutToQuit, [this]() { saveNow(); }); }
bool MainResourceLoader::load(const ResourceRequest& r, const SubstituteData& substituteData) { ASSERT(!m_handle); m_substituteData = substituteData; #if ENABLE(OFFLINE_WEB_APPLICATIONS) // Check if this request should be loaded from the application cache if (!m_substituteData.isValid() && frameLoader()->frame()->settings() && frameLoader()->frame()->settings()->offlineWebApplicationCacheEnabled()) { ASSERT(!m_applicationCache); if (Page* page = frameLoader()->frame()->page()) { if (frameLoader()->frame() == page->mainFrame()) m_applicationCache = ApplicationCacheGroup::cacheForMainRequest(r, m_documentLoader.get()); else m_applicationCache = frameLoader()->documentLoader()->topLevelApplicationCache(); } if (m_applicationCache) { // Get the resource from the application cache. // FIXME: If the resource does not exist, the load should fail. if (ApplicationCacheResource* resource = m_applicationCache->resourceForRequest(r)) { m_substituteData = SubstituteData(resource->data(), resource->response().mimeType(), resource->response().textEncodingName(), KURL()); } } } #endif ResourceRequest request(r); bool defer = defersLoading(); if (defer) { bool shouldLoadEmpty = shouldLoadAsEmptyDocument(r.url()); if (shouldLoadEmpty) defer = false; } if (!defer) { if (loadNow(request)) { // Started as an empty document, but was redirected to something non-empty. ASSERT(defersLoading()); defer = true; } } if (defer) m_initialRequest = request; return true; }
void MainResourceLoader::setDefersLoading(bool defers) { ResourceLoader::setDefersLoading(defers); if (defers) { if (m_dataLoadTimer.isActive()) m_dataLoadTimer.stop(); } else { if (m_initialRequest.isNull()) return; ResourceRequest initialRequest(m_initialRequest); m_initialRequest = ResourceRequest(); loadNow(initialRequest); } }
void MainResourceLoader::setDefersLoading(bool defers) { ResourceLoader::setDefersLoading(defers); if (defers) { if (m_dataLoadTimer.isActive()) m_dataLoadTimer.stop(); } else { if (m_initialRequest.isNull()) return; if (m_substituteData.isValid() && m_documentLoader->deferMainResourceDataLoad()) startDataLoadTimer(); else { ResourceRequest r(m_initialRequest); m_initialRequest = ResourceRequest(); loadNow(r); } } }
void MainResourceLoader::load(const ResourceRequest& r, const SubstituteData& substituteData) { ASSERT(!m_handle); // It appears that it is possible for this load to be cancelled and derefenced by the DocumentLoader // in willSendRequest() if loadNow() is called. RefPtr<MainResourceLoader> protect(this); m_substituteData = substituteData; ASSERT(documentLoader()->timing()->navigationStart()); ASSERT(!documentLoader()->timing()->fetchStart()); documentLoader()->timing()->markFetchStart(); ResourceRequest request(r); // Send this synthetic delegate callback since clients expect it, and // we no longer send the callback from within NSURLConnection for // initial requests. willSendRequest(request, ResourceResponse()); ASSERT(!deletionHasBegun()); // <rdar://problem/4801066> // willSendRequest() is liable to make the call to frameLoader() return null, so we need to check that here if (!frameLoader() || request.isNull()) { if (!reachedTerminalState()) releaseResources(); return; } documentLoader()->applicationCacheHost()->maybeLoadMainResource(request, m_substituteData); if (defersLoading()) m_initialRequest = request; else loadNow(request); }