| Index: cc/gl_renderer.cc | 
| diff --git a/cc/gl_renderer.cc b/cc/gl_renderer.cc | 
| index b3bad726fbef27b43eb65f2414cddf9aa8695f15..d5c90412895157060b0cbff126ed6652e503c20d 100644 | 
| --- a/cc/gl_renderer.cc | 
| +++ b/cc/gl_renderer.cc | 
| @@ -31,7 +31,6 @@ | 
| #include "cc/video_layer_impl.h" | 
| #include "gpu/GLES2/gl2extchromium.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/khronos/GLES2/gl2ext.h" | 
| #include "third_party/skia/include/core/SkBitmap.h" | 
| @@ -45,7 +44,6 @@ | 
|  | 
| using WebKit::WebGraphicsContext3D; | 
| using WebKit::WebGraphicsMemoryAllocation; | 
| -using WebKit::WebSharedGraphicsContext3D; | 
|  | 
| namespace cc { | 
|  | 
| @@ -350,31 +348,15 @@ void GLRenderer::drawDebugBorderQuad(const DrawingFrame& frame, const DebugBorde | 
| GLC(context(), context()->drawElements(GL_LINE_LOOP, 4, GL_UNSIGNED_SHORT, 0)); | 
| } | 
|  | 
| -static WebGraphicsContext3D* getFilterContext(bool hasImplThread) | 
| -{ | 
| -    if (hasImplThread) | 
| -        return WebSharedGraphicsContext3D::compositorThreadContext(); | 
| -    else | 
| -        return WebSharedGraphicsContext3D::mainThreadContext(); | 
| -} | 
| - | 
| -static GrContext* getFilterGrContext(bool hasImplThread) | 
| -{ | 
| -    if (hasImplThread) | 
| -        return WebSharedGraphicsContext3D::compositorThreadGrContext(); | 
| -    else | 
| -        return WebSharedGraphicsContext3D::mainThreadGrContext(); | 
| -} | 
| - | 
| -static inline SkBitmap applyFilters(GLRenderer* renderer, const WebKit::WebFilterOperations& filters, ScopedResource* sourceTexture, bool hasImplThread) | 
| +static inline SkBitmap applyFilters(GLRenderer* renderer, const WebKit::WebFilterOperations& filters, ScopedResource* sourceTexture, WebGraphicsContext3D* filterContext, GrContext* filterGrContext) | 
| { | 
| if (filters.isEmpty()) | 
| return SkBitmap(); | 
|  | 
| -    WebGraphicsContext3D* filterContext = getFilterContext(hasImplThread); | 
| -    GrContext* filterGrContext = getFilterGrContext(hasImplThread); | 
| +    if (!filterContext) | 
| +      return SkBitmap(); | 
|  | 
| -    if (!filterContext || !filterGrContext) | 
| +    if (!filterGrContext) | 
| return SkBitmap(); | 
|  | 
| renderer->context()->flush(); | 
| @@ -384,19 +366,17 @@ static inline SkBitmap applyFilters(GLRenderer* renderer, const WebKit::WebFilte | 
| return source; | 
| } | 
|  | 
| -static SkBitmap applyImageFilter(GLRenderer* renderer, SkImageFilter* filter, ScopedResource* sourceTexture, bool hasImplThread) | 
| +static SkBitmap applyImageFilter(GLRenderer* renderer, SkImageFilter* filter, ScopedResource* sourceTexture, WebGraphicsContext3D* filterContext, GrContext* grContext) | 
| { | 
| if (!filter) | 
| return SkBitmap(); | 
|  | 
| -    WebGraphicsContext3D* context3d = getFilterContext(hasImplThread); | 
| -    GrContext* grContext = getFilterGrContext(hasImplThread); | 
| +    if (!filterContext) | 
| +      return SkBitmap(); | 
|  | 
| -    if (!context3d || !grContext) | 
| +    if (!grContext) | 
| return SkBitmap(); | 
|  | 
| -    renderer->context()->flush(); | 
| - | 
| ResourceProvider::ScopedWriteLockGL lock(renderer->resourceProvider(), sourceTexture->id()); | 
|  | 
| // Wrap the source texture in a Ganesh platform texture. | 
| @@ -433,7 +413,7 @@ static SkBitmap applyImageFilter(GLRenderer* renderer, SkImageFilter* filter, Sc | 
| canvas.clear(0x0); | 
| canvas.drawSprite(source, 0, 0, &paint); | 
| canvas.flush(); | 
| -    context3d->flush(); | 
| +    filterContext->flush(); | 
| return device.accessBitmap(false); | 
| } | 
|  | 
| @@ -481,7 +461,9 @@ scoped_ptr<ScopedResource> GLRenderer::drawBackgroundFilters( | 
| if (!getFramebufferTexture(deviceBackgroundTexture.get(), deviceRect)) | 
| return scoped_ptr<ScopedResource>(); | 
|  | 
| -    SkBitmap filteredDeviceBackground = applyFilters(this, filters, deviceBackgroundTexture.get(), m_client->hasImplThread()); | 
| +    WebKit::WebGraphicsContext3D* filterContext = m_resourceProvider->offscreenGraphicsContext3d(); | 
| +    GrContext* filterGrContext = m_resourceProvider->offscreenGrContext(); | 
| +    SkBitmap filteredDeviceBackground = applyFilters(this, filters, deviceBackgroundTexture.get(), filterContext, filterGrContext); | 
| if (!filteredDeviceBackground.getTexture()) | 
| return scoped_ptr<ScopedResource>(); | 
|  | 
| @@ -532,11 +514,13 @@ void GLRenderer::drawRenderPassQuad(DrawingFrame& frame, const RenderPassDrawQua | 
|  | 
| // FIXME: Cache this value so that we don't have to do it for both the surface and its replica. | 
| // Apply filters to the contents texture. | 
| +    WebGraphicsContext3D* filterContext = m_resourceProvider->offscreenGraphicsContext3d(); | 
| +    GrContext* filterGrContext = m_resourceProvider->offscreenGrContext(); | 
| SkBitmap filterBitmap; | 
| if (quad->filter) { | 
| -        filterBitmap = applyImageFilter(this, quad->filter.get(), contentsTexture, m_client->hasImplThread()); | 
| +        filterBitmap = applyImageFilter(this, quad->filter.get(), contentsTexture, filterContext, filterGrContext); | 
| } else { | 
| -        filterBitmap = applyFilters(this, quad->filters, contentsTexture, m_client->hasImplThread()); | 
| +        filterBitmap = applyFilters(this, quad->filters, contentsTexture, filterContext, filterGrContext); | 
| } | 
|  | 
| // Draw the background texture if there is one. | 
|  |