コード例 #1
0
bool WebKitJSStrategies::isAvailable() const
{
  webkitTrace();
    // Shared workers do not work across multiple processes, and using network process is tied to multiple secondary process model.
    //return !WebProcess::shared().usesNetworkProcess();
  return true;
}
コード例 #2
0
void WebKitJSStrategies::loadResourceSynchronously(NetworkingContext* context, unsigned long resourceLoadIdentifier, const ResourceRequest& request, StoredCredentials storedCredentials, ClientCredentialPolicy clientCredentialPolicy, ResourceError& error, ResourceResponse& response, Vector<char>& data)
{
  webkitTrace();
   if (!WebProcess::shared().usesNetworkProcess()) {
        LoaderStrategy::loadResourceSynchronously(context, resourceLoadIdentifier, request, storedCredentials, clientCredentialPolicy, error, response, data);
        return;
    }

    WebFrameNetworkingContext* webContext = static_cast<WebFrameNetworkingContext*>(context);
    // FIXME: Some entities in WebCore use WebCore's "EmptyFrameLoaderClient" instead of having a proper WebFrameLoaderClient.
    // EmptyFrameLoaderClient shouldn't exist and everything should be using a WebFrameLoaderClient,
    // but in the meantime we have to make sure not to mis-cast.
    WebFrameLoaderClient* webFrameLoaderClient = webContext->webFrameLoaderClient();
    WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0;
    WebPage* webPage = webFrame ? webFrame->page() : 0;

    NetworkResourceLoadParameters loadParameters;
    loadParameters.identifier = resourceLoadIdentifier;
    loadParameters.webPageID = webPage ? webPage->pageID() : 0;
    loadParameters.webFrameID = webFrame ? webFrame->frameID() : 0;
    loadParameters.request = request;
    loadParameters.priority = ResourceLoadPriorityHighest;
    loadParameters.contentSniffingPolicy = SniffContent;
    loadParameters.allowStoredCredentials = storedCredentials;
    loadParameters.clientCredentialPolicy = clientCredentialPolicy;
    loadParameters.inPrivateBrowsingMode = context->storageSession().isPrivateBrowsingSession();
    loadParameters.shouldClearReferrerOnHTTPSToHTTPRedirect = context->shouldClearReferrerOnHTTPSToHTTPRedirect();

    data.resize(0);

    if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad(loadParameters), Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::Reply(error, response, data), 0)) {
        response = ResourceResponse();
        error = internalError(request.url());
    }
}
コード例 #3
0
BlobRegistry* WebKitJSStrategies::createBlobRegistry()
{
  webkitTrace();
    if (!WebProcess::shared().usesNetworkProcess())
        return LoaderStrategy::createBlobRegistry();
    return new BlobRegistryProxy;    
}
コード例 #4
0
	static void coalesceRectsIfPossible(const IntRect& clipRect, Vector<IntRect>& rects)
	{
		webkitTrace();

		const unsigned int cRectThreshold = 10;
		const float cWastedSpaceThreshold = 0.75f;
		bool useUnionedRect = (rects.size() <= 1) || (rects.size() > cRectThreshold);
		if (!useUnionedRect) {
			// Attempt to guess whether or not we should use the unioned rect or the individual rects.
			// We do this by computing the percentage of "wasted space" in the union. If that wasted space
			// is too large, then we will do individual rect painting instead.
			float unionPixels = (clipRect.width() * clipRect.height());
			float singlePixels = 0;
			for (size_t i = 0; i < rects.size(); ++i)
				singlePixels += rects[i].width() * rects[i].height();
			float wastedSpace = 1 - (singlePixels / unionPixels);
			if (wastedSpace <= cWastedSpaceThreshold)
				useUnionedRect = true;
		}

		if (!useUnionedRect)
			return;

		rects.clear();
		rects.append(clipRect);
	}
コード例 #5
0
void DrawingBuffer::commit(long x, long y, long width, long height)
{

#if PLATFORM(JS)
	webkitTrace();
#endif
    if (!m_context)
        return;

    if (width < 0)
        width = m_size.width();
    if (height < 0)
        height = m_size.height();

    m_context->makeContextCurrent();

    if (m_multisampleFBO) {
        m_context->bindFramebuffer(Extensions3D::READ_FRAMEBUFFER, m_multisampleFBO);
        m_context->bindFramebuffer(Extensions3D::DRAW_FRAMEBUFFER, m_fbo);

        if (m_scissorEnabled)
            m_context->disable(GraphicsContext3D::SCISSOR_TEST);

        // Use NEAREST, because there is no scale performed during the blit.
        m_context->getExtensions()->blitFramebuffer(x, y, width, height, x, y, width, height, GraphicsContext3D::COLOR_BUFFER_BIT, GraphicsContext3D::NEAREST);

        if (m_scissorEnabled)
            m_context->enable(GraphicsContext3D::SCISSOR_TEST);
    }

    m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo);
}
コード例 #6
0
  PassRefPtr<DocumentLoader> FrameLoaderClientJS::createDocumentLoader(const ResourceRequest& request, const SubstituteData& subtituteData) {
    webkitTrace();
    RefPtr<WebCore::DocumentLoader> loader = WebCore::DocumentLoaderJS::create(request, subtituteData);
		//GRefPtr<WebKitWebDataSource> webDataSource(adoptGRef(kitNew(loader.get())));
    //loader->setDataSource(webDataSource.get());
    return loader.release();
  }
コード例 #7
0
// Only way to ensure that we're not getting a bad framebuffer on some AMD/OSX devices.
// FIXME: This can be removed once renderbufferStorageMultisample starts reporting GL_OUT_OF_MEMORY properly.
bool DrawingBuffer::checkBufferIntegrity()
{

#if PLATFORM(JS)
	webkitTrace();
#endif
    if (!m_multisampleFBO)
        return true;

    if (m_scissorEnabled)
        m_context->disable(GraphicsContext3D::SCISSOR_TEST);

    m_context->colorMask(true, true, true, true);

    m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO);
    m_context->clearColor(1.0f, 0.0f, 1.0f, 1.0f);
    m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT);

    commit(0, 0, 1, 1);

    unsigned char pixel[4] = {0, 0, 0, 0};
    m_context->readPixels(0, 0, 1, 1, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, &pixel);

    if (m_scissorEnabled)
        m_context->enable(GraphicsContext3D::SCISSOR_TEST);

    return (pixel[0] == 0xFF && pixel[1] == 0x00 && pixel[2] == 0xFF && pixel[3] == 0xFF);
}
コード例 #8
0
	static void paintWebView(WebView* webView, Frame* frame, const Region& dirtyRegion)
	{
		webkitTrace();
		if (!webView->p()->backingStore)
			return;

		Vector<IntRect> rects = dirtyRegion.rects();
		coalesceRectsIfPossible(dirtyRegion.bounds(), rects);

		RefPtr<cairo_t> backingStoreContext = adoptRef(cairo_create(webView->p()->backingStore->cairoSurface()));
		GraphicsContext gc(backingStoreContext.get());
		gc.applyDeviceScaleFactor(frame->page()->deviceScaleFactor());

		for (size_t i = 0; i < rects.size(); i++) {
			const IntRect& rect = rects[i];

			gc.save();
			gc.clip(rect);
			if (webView->p()->transparent)
				gc.clearRect(rect);
			frame->view()->paint(&gc, rect);
			gc.restore();
		}

		gc.save();
		gc.clip(dirtyRegion.bounds());
		gc.restore();
	}
コード例 #9
0
bool DrawingBuffer::multisample() const
{

#if PLATFORM(JS)
	webkitTrace();
#endif
    return m_context && m_context->getContextAttributes().antialias && m_multisampleExtensionSupported;
}
コード例 #10
0
  void FrameLoaderClientJS::forceLayout() {
    webkitTrace();
		FrameView* view = m_frame->view();
		view->setNeedsLayout();
    if (view)
			view->forceLayout(true);

  }
コード例 #11
0
PassRefPtr<IDBFactoryBackendInterface> WebKitJSStrategies::createIDBFactoryBackend(const String& databaseDirectoryIdentifier)
{
  webkitTrace();
#if !ENABLE(DATABASE_PROCESS)
    return DatabaseStrategy::createIDBFactoryBackend(databaseDirectoryIdentifier);
#endif

    return WebIDBFactoryBackend::create(databaseDirectoryIdentifier);
}
コード例 #12
0
  void FrameLoaderClientJS::committedLoad(DocumentLoader* loader, const char* data, int length) {
    webkitTrace();
		ASSERT(loader->frame());
		loader->commitData(data, length);

		Frame* coreFrame = loader->frame();
		if (coreFrame && coreFrame->document()->isMediaDocument())
			loader->cancelMainResourceLoad(coreFrame->loader().client().pluginWillHandleLoadError(loader->response()));
  }
コード例 #13
0
void DrawingBuffer::clear()
{

#if PLATFORM(JS)
	webkitTrace();
#endif
    if (!m_context)
        return;

    m_context->makeContextCurrent();

    if (!m_size.isEmpty()) {
        s_currentResourceUsePixels -= m_size.width() * m_size.height();
        m_size = IntSize();
    }

    if (m_colorBuffer) {
        m_context->deleteTexture(m_colorBuffer);
        m_colorBuffer = 0;
    }

    if (m_frontColorBuffer) {
        m_context->deleteTexture(m_frontColorBuffer);
        m_frontColorBuffer = 0;
    }

    if (m_multisampleColorBuffer) {
        m_context->deleteRenderbuffer(m_multisampleColorBuffer);
        m_multisampleColorBuffer = 0;
    }

    if (m_depthStencilBuffer) {
        m_context->deleteRenderbuffer(m_depthStencilBuffer);
        m_depthStencilBuffer = 0;
    }

    if (m_depthBuffer) {
        m_context->deleteRenderbuffer(m_depthBuffer);
        m_depthBuffer = 0;
    }

    if (m_stencilBuffer) {
        m_context->deleteRenderbuffer(m_stencilBuffer);
        m_stencilBuffer = 0;
    }

    if (m_multisampleFBO) {
        m_context->deleteFramebuffer(m_multisampleFBO);
        m_multisampleFBO = 0;
    }

    if (m_fbo) {
        m_context->deleteFramebuffer(m_fbo);
        m_fbo = 0;
    }
}
コード例 #14
0
void DrawingBuffer::bind()
	{
#if PLATFORM(JS)
		webkitTrace();
#endif
    if (!m_context)
        return;

    m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO ? m_multisampleFBO : m_fbo);
}
コード例 #15
0
Widget::Widget(PlatformWidget widget)
    : m_parent(0)
    , m_widget(widget)
    , m_selfVisible(false)
    , m_parentVisible(false)
    , m_frame(0, 0, 0, 0)
{
		webkitTrace();
    init(widget);
}
コード例 #16
0
PlatformContextCairo::PlatformContextCairo(cairo_t* cr)
    : m_cr(cr)
{
#if PLATFORM(JS)
	webkitTrace();
#endif

    m_stateStack.append(State());
    m_state = &m_stateStack.last();
}
コード例 #17
0
std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient* client)
{

#if PLATFORM(JS)
	webkitTrace();
#endif
    if (!factory)
        return std::make_unique<GraphicsLayerTextureMapper>(client);

    return factory->createGraphicsLayer(client);
}
コード例 #18
0
void DrawingBuffer::restoreFramebufferBinding()
{

#if PLATFORM(JS)
	webkitTrace();
#endif
    if (!m_context || !m_framebufferBinding)
        return;

    m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_framebufferBinding);
}
コード例 #19
0
GLContextEGL::GLContextEGL(EGLContext context, EGLSurface surface, EGLSurfaceType type)
    : m_context(context)
    , m_surface(surface)
    , m_type(type)
#if USE(CAIRO)
    , m_cairoDevice(0)
#endif
	{
#if PLATFORM(JS)
		webkitTrace();
#endif
}
コード例 #20
0
	void ChromeClientJS::paint(WebCore::Timer<ChromeClientJS>*)
	{
		webkitTrace();

		if (m_view->m_private->acceleratedContext && m_view->m_private->acceleratedContext->enabled())
			return;

		if(m_dirtyRegion.isEmpty() || !m_view->m_private->backingStore)
			return;

		static const double minimumFrameInterval = 1.0 / 60.0; // No more than 60 frames a second.
		double timeSinceLastDisplay = monotonicallyIncreasingTime() - m_lastDisplayTime;
		double timeUntilNextDisplay = minimumFrameInterval - timeSinceLastDisplay;

		if (timeUntilNextDisplay > 0 && !m_forcePaint) {
			m_displayTimer.startOneShot(timeUntilNextDisplay);
			return;
		}

		m_forcePaint = false;

		Frame& frame = (m_view->m_private->mainFrame->coreFrame()->mainFrame());
		if (!frame.contentRenderer() || !frame.view())
			return;

		frame.view()->updateLayoutAndStyleIfNeededRecursive();
		performAllPendingScrolls();
		paintWebView(m_view, &frame, m_dirtyRegion);

		const IntRect& rect = m_dirtyRegion;

		SDL_Rect offset;

		offset.x = rect.x();
		offset.y = rect.y();
		offset.w = rect.width();
		offset.h = rect.height();

		// Bit blitting is done by locking and unlocking the backstore, we should only do this when
		// we're sure we have a solid backstore surface with no errors.  Part of the problem we may
		// have with this approach is the backstore may only require a small sub-set that needs to be
		// blitted which might be a lot of overhead to send to the screen.  However, there may be
		// use cases where the backstore is not representative of the screen (only the dirtyRegion)
		// in this case we'll have incorrect rendering.  We need to have drawImage and UpperBlit implemented
		// in worker proxies for this to work.
		SDL_UnlockSurface(m_view->m_private->backingStore->widget());
		SDL_LockSurface(m_view->m_private->backingStore->widget());

		m_dirtyRegion = IntRect();
		m_lastDisplayTime = monotonicallyIncreasingTime();
		m_repaintSoonSourceId = 0;
	}
コード例 #21
0
	static void clearEverywhereInBackingStore(WebView* webView, cairo_t* cr)
	{
		webkitTrace();
		// The strategy here is to quickly draw white into this new canvas, so that
		// when a user quickly resizes the WebView in an environment that has opaque
		// resizing (like Gnome Shell), there are no drawing artifacts.
		if (!webView->p()->transparent) {
			cairo_set_source_rgb(cr, 1, 1, 1);
			cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
		} else
			cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
		cairo_paint(cr);
	}
コード例 #22
0
/* \reimp (GraphicsLayer.h): The current size might change, thus we need to update the whole display.
*/
void GraphicsLayerTextureMapper::setNeedsDisplay()
{

#if PLATFORM(JS)
	webkitTrace();
#endif
    if (!drawsContent())
        return;

    m_needsDisplay = true;
    notifyChange(DisplayChange);
    addRepaintRect(FloatRect(FloatPoint(), m_size));
}
コード例 #23
0
	static void clipOutOldWidgetArea(cairo_t* cr, const IntSize& oldSize, const IntSize& newSize)
	{
		webkitTrace();

		cairo_move_to(cr, oldSize.width(), 0);
		cairo_line_to(cr, newSize.width(), 0);
		cairo_line_to(cr, newSize.width(), newSize.height());
		cairo_line_to(cr, 0, newSize.height());
		cairo_line_to(cr, 0, oldSize.height());
		cairo_line_to(cr, oldSize.width(), oldSize.height());
		cairo_close_path(cr);
		cairo_clip(cr);
	}
コード例 #24
0
ResourceLoadScheduler* WebKitJSStrategies::resourceLoadScheduler()
{
  webkitTrace();
   static ResourceLoadScheduler* scheduler;
    if (!scheduler) {
        if (WebProcess::shared().usesNetworkProcess())
            scheduler = &WebProcess::shared().webResourceLoadScheduler();
        else
            scheduler = WebCore::resourceLoadScheduler();
    }
    
    return scheduler;
}
コード例 #25
0
void DrawingBuffer::createSecondaryBuffers()
{

#if PLATFORM(JS)
	webkitTrace();
#endif
    // create a multisample FBO
    if (multisample()) {
        m_multisampleFBO = m_context->createFramebuffer();
        m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO);
        m_multisampleColorBuffer = m_context->createRenderbuffer();
    }
}
コード例 #26
0
/* \reimp (GraphicsLayer.h)
*/
void GraphicsLayerTextureMapper::setDrawsContent(bool value)
{

#if PLATFORM(JS)
	webkitTrace();
#endif
    if (value == drawsContent())
        return;
    GraphicsLayer::setDrawsContent(value);
    notifyChange(DrawsContentChange);

    if (value)
        setNeedsDisplay();
}
コード例 #27
0
cairo_device_t* GLContextEGL::cairoDevice()
	{
#if PLATFORM(JS)
		webkitTrace();
#endif
    if (m_cairoDevice)
        return m_cairoDevice;

#if ENABLE(ACCELERATED_2D_CANVAS)
    m_cairoDevice = cairo_egl_device_create(sharedEGLDisplay(), m_context);
#endif

    return m_cairoDevice;
}
コード例 #28
0
	void ChromeClientJS::invalidateContentsAndRootView(const IntRect& updateRect, bool immediate)
	{
		webkitTrace();

		if (m_view->m_private->acceleratedContext && m_view->m_private->acceleratedContext->enabled()) {
			m_view->m_private->acceleratedContext->setNonCompositedContentsNeedDisplay(updateRect);
			return;
		}

		if (updateRect.isEmpty())
			return;

		m_dirtyRegion.unite(updateRect);
		m_displayTimer.startOneShot(0);
	}
コード例 #29
0
	void ChromeClientJS::performAllPendingScrolls()
	{
		webkitTrace();

		if (!m_view->m_private->backingStore)
			return;

		// Scroll all pending scroll rects and invalidate those parts of the widget.
		for (size_t i = 0; i < m_rectsToScroll.size(); i++) {
			IntRect& scrollRect = m_rectsToScroll[i];
			m_view->m_private->backingStore->scroll(scrollRect, m_scrollOffsets[i]);
		}

		m_rectsToScroll.clear();
		m_scrollOffsets.clear();
	}
コード例 #30
0
/* \reimp (GraphicsLayer.h)
*/
void GraphicsLayerTextureMapper::flushCompositingState(const FloatRect& rect)
	{
#if PLATFORM(JS)
		webkitTrace();
#endif
    if (!m_layer->textureMapper())
        return;

    flushCompositingStateForThisLayerOnly();

    if (maskLayer())
        maskLayer()->flushCompositingState(rect);
    if (replicaLayer())
        replicaLayer()->flushCompositingState(rect);
    for (size_t i = 0; i < children().size(); ++i)
        children()[i]->flushCompositingState(rect);
}