Exemple #1
0
void DocumentLoader::setRequest(const ResourceRequest& req)
{
    // Replacing an unreachable URL with alternate content looks like a server-side
    // redirect at this point, but we can replace a committed dataSource.
    bool handlingUnreachableURL = false;

    handlingUnreachableURL = m_substituteData.isValid() && !m_substituteData.failingURL().isEmpty();

    if (handlingUnreachableURL)
        m_committed = false;

    // We should never be getting a redirect callback after the data
    // source is committed, except in the unreachable URL case. It 
    // would be a WebFoundation bug if it sent a redirect callback after commit.
    ASSERT(!m_committed);

    KURL oldURL = m_request.url();
    m_request = req;

// <lab126>
	KINDLE_BEGIN(Kindle_Debug_Resources)
	KINDLE_PRINT("\033[35mDocumentLoader::setRequest %s...\033[0m\n", req.url().string().latin1().data());
	KINDLE_END()
// </lab126>

    // Only send webView:didReceiveServerRedirectForProvisionalLoadForFrame: if URL changed.
    // Also, don't send it when replacing unreachable URLs with alternate content.
    if (!handlingUnreachableURL && oldURL != req.url())
        frameLoader()->didReceiveServerRedirectForProvisionalLoadForFrame();
}
Exemple #2
0
void DocumentLoader::finishedLoading()
{
// <lab126>
	KINDLE_BEGIN(Kindle_Debug_Resources)
		KINDLE_PRINT("\033[35mFinished Loading %s...\033[0m\n", requestURL().string().latin1().data());
	KINDLE_END()
// </lab126>
    m_gotFirstByte = true;   
    commitIfReady();
    if (FrameLoader* loader = frameLoader()) {
        loader->finishedLoadingDocument(this);
        loader->end();
    }
}
Exemple #3
0
NativeImagePtr ImageSource::createFrameAtIndex(size_t index)
{
    if (!initialized())
        return 0;

    if (!m_decoder)
        return 0;

    RGBA32Buffer* buffer = m_decoder->frameBufferAtIndex(index);
    if (!buffer || buffer->status() == RGBA32Buffer::FrameEmpty)
        return 0;

    // Cairo does not like zero height images.
    // If we have a zero height image, just pretend we don't have enough data yet.
    if (!buffer->height())
        return 0;
    /* <lab126> */
    struct timespec startTime;
    KINDLE_BEGIN(Kindle_Debug_Perf)
    clock_gettime(CLOCK_MONOTONIC, &startTime);
    KINDLE_END()

    if (m_imageDitherType == USE_SIMPLE_ALGORITHM) {
        int imageWidth = size().width();
        int imageHeight = buffer->height();
        if(!dither_inited)
            for(int i=0; i<3333; i++)
                dither_buffer[i]=rand()%17;
        for (int n = 0; n < imageHeight; n++)
        {
            for (int m = 0; m < imageWidth; m++)
            {
                int rgb=buffer->bytes().data()[ (n*imageWidth) + m ];
                int r = (rgb >> 16) & 0xff;
                int g = (rgb >> 8) & 0xff;
                int b = rgb & 0xff;
                int gray = (r == g && g == b) ?  r : ((77 * r + 150 * g + 29 * b) >> 8);
                dither_index=(dither_index+1)%3333;
                int ngray=gray+dither_buffer[dither_index];
                ngray-=ngray%17;
                if(ngray>0xff) ngray=0xff;
                buffer->bytes().data()[ (n*imageWidth) + m ] =   (rgb&STRIP_ALPHA)|(ngray<<16)|(ngray<<8)|ngray;
            }
        }
    }