Index: cc/resource_update_controller.cc |
diff --git a/cc/resource_update_controller.cc b/cc/resource_update_controller.cc |
index 1177d5372fcaa69b0d8012bf20243bdc572c23e9..9b251d1e60fada0e31b4dd2ead32c39fbc7d2dd6 100644 |
--- a/cc/resource_update_controller.cc |
+++ b/cc/resource_update_controller.cc |
@@ -7,18 +7,17 @@ |
#include <limits> |
#include "base/debug/trace_event.h" |
+#include "cc/ganesh_resource_provider.h" |
#include "cc/prioritized_resource.h" |
#include "cc/resource_provider.h" |
#include "cc/texture_copier.h" |
#include "cc/thread.h" |
#include "skia/ext/refptr.h" |
#include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h" |
-#include "third_party/WebKit/Source/Platform/chromium/public/WebSharedGraphicsContext3D.h" |
#include "third_party/khronos/GLES2/gl2.h" |
#include "third_party/skia/include/gpu/SkGpuDevice.h" |
using WebKit::WebGraphicsContext3D; |
-using WebKit::WebSharedGraphicsContext3D; |
namespace { |
@@ -130,27 +129,25 @@ void ResourceUpdateController::updateTexture(ResourceUpdate update) |
DCHECK(m_resourceProvider->resourceType(texture->resourceId()) == |
ResourceProvider::GLTexture); |
- WebGraphicsContext3D* paintContext = m_hasImplThread ? |
- WebSharedGraphicsContext3D::compositorThreadContext() : |
- WebSharedGraphicsContext3D::mainThreadContext(); |
- GrContext* paintGrContext = m_hasImplThread ? |
- WebSharedGraphicsContext3D::compositorThreadGrContext() : |
- WebSharedGraphicsContext3D::mainThreadGrContext(); |
+ if (!m_resourceProvider->ganeshResourceProvider()->has_contexts()) |
+ return; |
+ |
+ ResourceProvider::ScopedWriteLockGL lock( |
+ m_resourceProvider, texture->resourceId()); |
// Flush the context in which the backing texture is created so that it |
// is available in other shared contexts. It is important to do here |
// because the backing texture is created in one context while it is |
// being written to in another. |
- ResourceProvider::ScopedWriteLockGL lock( |
- m_resourceProvider, texture->resourceId()); |
- m_resourceProvider->flush(); |
+ GaneshResourceProvider::ScopedContextsFlushed offscreenContexts( |
+ m_resourceProvider, m_resourceProvider->ganeshResourceProvider()); |
// Make sure ganesh uses the correct GL context. |
- paintContext->makeContextCurrent(); |
+ offscreenContexts.context3d()->makeContextCurrent(); |
// Create an accelerated canvas to draw on. |
skia::RefPtr<SkCanvas> canvas = createAcceleratedCanvas( |
- paintGrContext, texture->size(), lock.textureId()); |
+ offscreenContexts.gr_context(), texture->size(), lock.textureId()); |
// The compositor expects the textures to be upside-down so it can flip |
// the final composited image. Ganesh renders the image upright so we |
@@ -168,14 +165,6 @@ void ResourceUpdateController::updateTexture(ResourceUpdate update) |
pictureRect.x() - sourceRect.x() + destOffset.x(), |
pictureRect.y() - sourceRect.y() + destOffset.y()); |
canvas->drawPicture(*update.picture); |
- |
- // Flush ganesh context so that all the rendered stuff appears on the |
- // texture. |
- paintGrContext->flush(); |
- |
- // Flush the GL context so rendering results from this context are |
- // visible in the compositor's context. |
- paintContext->flush(); |
} |
if (update.bitmap) { |