Merge 1304263003 to m45

BUG=521943
NOTREECHECKS=true
NOTRY=true
NOPRESUBMIT=true

Review URL: https://codereview.chromium.org/1304403003
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index 728fb88..3e013f1 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -232,6 +232,15 @@
     this->onClearStencilClip(renderTarget, rect, insideClip);
 }
 
+bool GrGpu::copySurface(GrSurface* dst,
+                        GrSurface* src,
+                        const SkIRect& srcRect,
+                        const SkIPoint& dstPoint) {
+    SkASSERT(dst && src);
+    this->handleDirtyContext();
+    return this->onCopySurface(dst, src, srcRect, dstPoint);
+}
+
 bool GrGpu::readPixels(GrRenderTarget* target,
                        int left, int top, int width, int height,
                        GrPixelConfig config, void* buffer,
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index 8d449b7..517f998 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -271,10 +271,10 @@
     // take place at the GrDrawTarget level and this function implement faster copy paths. The rect
     // and point are pre-clipped. The src rect and implied dst rect are guaranteed to be within the
     // src/dst bounds and non-empty.
-    virtual bool copySurface(GrSurface* dst,
-                             GrSurface* src,
-                             const SkIRect& srcRect,
-                             const SkIPoint& dstPoint) = 0;
+    bool copySurface(GrSurface* dst,
+                     GrSurface* src,
+                     const SkIRect& srcRect,
+                     const SkIPoint& dstPoint);
 
     // Called before certain draws in order to guarantee coherent results from dst reads.
     virtual void xferBarrier(GrRenderTarget*, GrXferBarrierType) = 0;
@@ -434,6 +434,12 @@
     // overridden by backend-specific derived class to perform the resolve
     virtual void onResolveRenderTarget(GrRenderTarget* target) = 0;
 
+    // overridden by backend specific derived class to perform the copy surface
+    virtual bool onCopySurface(GrSurface* dst,
+                               GrSurface* src,
+                               const SkIRect& srcRect,
+                               const SkIPoint& dstPoint) = 0;
+
     // width and height may be larger than rt (if underlying API allows it).
     // Should attach the SB to the RT. Returns false if compatible sb could
     // not be created.
diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp
index 3e1ef6c..d7048dd 100644
--- a/src/gpu/GrTest.cpp
+++ b/src/gpu/GrTest.cpp
@@ -162,10 +162,10 @@
 
     void discard(GrRenderTarget*) override {}
 
-    bool copySurface(GrSurface* dst,
-                     GrSurface* src,
-                     const SkIRect& srcRect,
-                     const SkIPoint& dstPoint) override { return false; };
+    bool onCopySurface(GrSurface* dst,
+                       GrSurface* src,
+                       const SkIRect& srcRect,
+                       const SkIPoint& dstPoint) override { return false; };
 
     bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) override {
         return false;
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 20669b8..552e2ae 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -2716,10 +2716,10 @@
     return true;
 }
 
-bool GrGLGpu::copySurface(GrSurface* dst,
-                          GrSurface* src,
-                          const SkIRect& srcRect,
-                          const SkIPoint& dstPoint) {
+bool GrGLGpu::onCopySurface(GrSurface* dst,
+                            GrSurface* src,
+                            const SkIRect& srcRect,
+                            const SkIPoint& dstPoint) {
     if (src->asTexture() && dst->asRenderTarget()) {
         this->copySurfaceAsDraw(dst, src, srcRect, dstPoint);
         return true;
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index e5cd7a9..5fc6470 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -96,11 +96,6 @@
         fHWGeometryState.notifyIndexBufferDelete(id);
     }
 
-    bool copySurface(GrSurface* dst,
-                     GrSurface* src,
-                     const SkIRect& srcRect,
-                     const SkIPoint& dstPoint) override;
-
     void xferBarrier(GrRenderTarget*, GrXferBarrierType) override;
 
     void buildProgramDesc(GrProgramDesc*,
@@ -153,6 +148,11 @@
 
     void onDraw(const DrawArgs&, const GrNonInstancedVertices&) override;
 
+    bool onCopySurface(GrSurface* dst,
+                       GrSurface* src,
+                       const SkIRect& srcRect,
+                       const SkIPoint& dstPoint) override;
+
     void clearStencil(GrRenderTarget*) override;
 
     // GrDrawTarget overrides