Example #1
0
void ResourceLoader::didFinishLoading(double finishTime)
{
    didFinishLoadingOnePart(finishTime);

    // If the load has been cancelled by a delegate in response to didFinishLoad(), do not release
    // the resources a second time, they have been released by cancel.
    if (wasCancelled())
        return;
    releaseResources();
}
Example #2
0
void ResourceLoader::didFail(const ResourceError& error)
{
    if (wasCancelled())
        return;
    ASSERT(!m_reachedTerminalState);

    // Protect this in this delegate method since the additional processing can do
    // anything including possibly derefing this; one example of this is Radar 3266216.
    Ref<ResourceLoader> protect(*this);

    cleanupForError(error);
    releaseResources();
}
Example #3
0
void ResourceLoader::didFinishLoadingOnePart(double finishTime)
{
    // If load has been cancelled after finishing (which could happen with a
    // JavaScript that changes the window location), do nothing.
    if (wasCancelled())
        return;
    ASSERT(!m_reachedTerminalState);

    if (m_notifiedLoadComplete)
        return;
    m_notifiedLoadComplete = true;
    if (m_options.sendLoadCallbacks == SendCallbacks)
        frameLoader()->notifier().didFinishLoad(this, finishTime);
}
Example #4
0
	virtual void runThread() {
		m_Mutex.lock();
		// We are running, tell the main thread
		m_bThreadReady = true;
		m_CVThreadReady.broadcast();
		// Have to unlock here so that wait() can get the mutex
		m_Mutex.unlock();

		while (!wasCancelled()) {
			// We can't do much besides busy-looping here. If the
			// job really gets cancelled while it is already
			// running, the main thread is stuck in cancelJob(), so
			// it cannot signal us in any way. And signaling us
			// before calling cancelJob() effictively is the same
			// thing as busy looping anyway. So busy looping it is.
			// (Yes, CJob shouldn't be used for anything that
			// requires synchronisation between threads!)
		}
	}
Example #5
0
void SubresourceLoader::didFinishLoading(double finishTime)
{
    if (m_state != Initialized)
        return;
    ASSERT(!reachedTerminalState());
    ASSERT(!m_resource->resourceToRevalidate());
    // FIXME (129394): We should cancel the load when a decode error occurs instead of continuing the load to completion.
    ASSERT(!m_resource->errorOccurred() || m_resource->status() == CachedResource::DecodeError);
    LOG(ResourceLoading, "Received '%s'.", m_resource->url().string().latin1().data());
    logResourceLoaded(m_frame.get(), m_resource->type());

    Ref<SubresourceLoader> protectedThis(*this);
    CachedResourceHandle<CachedResource> protectResource(m_resource);

    // FIXME: The finishTime that is passed in is from the NetworkProcess and is more accurate.
    // However, all other load times are generated from the web process or offsets.
    // Mixing times from different processes can cause the finish time to be earlier than
    // the response received time due to inter-process communication lag.
    UNUSED_PARAM(finishTime);
    double responseEndTime = monotonicallyIncreasingTime();
    m_loadTiming.setResponseEnd(responseEndTime);

#if ENABLE(WEB_TIMING)
    if (m_documentLoader->cachedResourceLoader().document() && RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled())
        m_documentLoader->cachedResourceLoader().resourceTimingInformation().addResourceTiming(m_resource, *m_documentLoader->cachedResourceLoader().document(), m_resource->loader()->loadTiming());
#endif

    m_state = Finishing;
    m_resource->setLoadFinishTime(responseEndTime); // FIXME: Users of the loadFinishTime should use the LoadTiming struct instead.
    m_resource->finishLoading(resourceData());

    if (wasCancelled())
        return;
    m_resource->finish();
    ASSERT(!reachedTerminalState());
    didFinishLoadingOnePart(responseEndTime);
    notifyDone();
    if (reachedTerminalState())
        return;
    releaseResources();
}
bool PhotometricOptimizer::runAlgorithm()
{
    // is this correct? how much progress requierd?
    AppBase::ProgressReporter* progRep = 
        AppBase::ProgressReporterAdaptor::newProgressReporter(getProgressDisplay(), 0.0);    
    
    optimizePhotometric(o_panorama, 
                        o_vars, o_correspondences,
                        *progRep, o_resultError);
    
    delete progRep;
    
    // optimizePhotometric does not tell us if it's cancelled
    if(hasProgressDisplay())
    {
        if(getProgressDisplay()->wasCancelled())
            cancelAlgorithm();
    }

    return wasCancelled(); // let's hope so.
}
Example #7
0
	~CCancelJob() {
		EXPECT_TRUE(wasCancelled());
		m_bDestroyed = true;
	}
Example #8
0
	~CWaitingJob() {
		EXPECT_TRUE(m_bThreadReady);
		EXPECT_TRUE(m_bThreadDone);
		EXPECT_FALSE(wasCancelled());
		m_bDestroyed = true;
	}