Index: cc/resource_update_controller.cc |
diff --git a/cc/resource_update_controller.cc b/cc/resource_update_controller.cc |
index d60b5bbed1ef361dd03c64fa06e53eb7be0f5a61..0bb9913124972b9b27605123643318448fa8ff45 100644 |
--- a/cc/resource_update_controller.cc |
+++ b/cc/resource_update_controller.cc |
@@ -13,12 +13,11 @@ |
#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" |
+#include "ui/gl/context_provider.h" |
using WebKit::WebGraphicsContext3D; |
-using WebKit::WebSharedGraphicsContext3D; |
namespace { |
@@ -67,9 +66,8 @@ size_t ResourceUpdateController::maxFullUpdatesPerTick( |
return texturesPerTick ? texturesPerTick : 1; |
} |
-ResourceUpdateController::ResourceUpdateController(ResourceUpdateControllerClient* client, Thread* thread, scoped_ptr<ResourceUpdateQueue> queue, ResourceProvider* resourceProvider, bool hasImplThread) |
+ResourceUpdateController::ResourceUpdateController(ResourceUpdateControllerClient* client, Thread* thread, scoped_ptr<ResourceUpdateQueue> queue, ResourceProvider* resourceProvider) |
: m_client(client) |
- , m_hasImplThread(hasImplThread) |
, m_queue(queue.Pass()) |
, m_resourceProvider(resourceProvider) |
, m_textureUpdatesPerTick(maxFullUpdatesPerTick(resourceProvider)) |
@@ -130,27 +128,22 @@ 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(); |
- |
- // 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. |
+ ui::ContextProvider* offscreenContexts = m_resourceProvider->offscreenContextProvider(); |
+ |
ResourceProvider::ScopedWriteLockGL lock( |
m_resourceProvider, texture->resourceId()); |
+ |
+ // Flush the compositor context to ensure that textures there are available |
+ // in the shared context. Do this after locking/creating the compositor |
+ // texture. |
m_resourceProvider->flush(); |
// 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->GrContext(), 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 |
@@ -171,11 +164,11 @@ void ResourceUpdateController::updateTexture(ResourceUpdate update) |
// Flush ganesh context so that all the rendered stuff appears on the |
// texture. |
- paintGrContext->flush(); |
+ offscreenContexts->GrContext()->flush(); |
// Flush the GL context so rendering results from this context are |
// visible in the compositor's context. |
- paintContext->flush(); |
+ offscreenContexts->Context3d()->flush(); |
} |
if (update.bitmap) { |