Revert "Revert "Make mock GrContext unit testable.""
This reverts commit c867a89b012c07e7e5cb719a31ed90e61f4a4901.
Reason for revert: test
Original change's description:
> Revert "Make mock GrContext unit testable."
>
> This reverts commit 993e7e25217df05d63c3354c817e8bd18ea3738b.
>
> Reason for revert: Seeing if this fixes the NexusPlayer bots
>
> Original change's description:
> > Make mock GrContext unit testable.
> >
> > Bug: skia:
> > Change-Id: I959122f1f2c390832ab1033bcdbdd2ca6cfc0419
> > Reviewed-on: https://skia-review.googlesource.com/20699
> > Reviewed-by: Greg Daniel <egdaniel@google.com>
> > Commit-Queue: Brian Salomon <bsalomon@google.com>
>
> TBR=egdaniel@google.com,bsalomon@google.com
>
> Change-Id: I25ed9329962d930fe38108f779ff7083e0e4847e
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:
> Reviewed-on: https://skia-review.googlesource.com/21731
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
TBR=egdaniel@google.com,bsalomon@google.com
Change-Id: I62c579e087db1ff9891cf6c41b3eb40f47561887
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/21733
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/mock/GrMockGpuCommandBuffer.h b/src/gpu/mock/GrMockGpuCommandBuffer.h
new file mode 100644
index 0000000..c5719a5
--- /dev/null
+++ b/src/gpu/mock/GrMockGpuCommandBuffer.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2017 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrMockGpuCommandBuffer_DEFINED
+#define GrMockGpuCommandBuffer_DEFINED
+
+#include "GrGpuCommandBuffer.h"
+#include "GrMockGpu.h"
+
+class GrMockGpuCommandBuffer : public GrGpuCommandBuffer {
+public:
+ GrMockGpuCommandBuffer(GrMockGpu* gpu) : fGpu(gpu) {}
+
+ GrGpu* gpu() override { return fGpu; }
+ void inlineUpload(GrOpFlushState*, GrDrawOp::DeferredUploadFn&, GrRenderTarget*) override {}
+ void discard(GrRenderTarget*) override {}
+ void end() override {}
+
+ int numDraws() const { return fNumDraws; }
+
+private:
+ void onSubmit() override { fGpu->submitCommandBuffer(this); }
+ void onDraw(const GrPipeline&, const GrPrimitiveProcessor&, const GrMesh[],
+ const GrPipeline::DynamicState[], int meshCount, const SkRect& bounds) override {
+ ++fNumDraws;
+ }
+ void onClear(GrRenderTarget*, const GrFixedClip&, GrColor) override {}
+ void onClearStencilClip(GrRenderTarget*, const GrFixedClip&, bool insideStencilMask) override {}
+ GrRenderTarget* renderTarget() override { return nullptr; }
+
+ GrMockGpu* fGpu;
+ int fNumDraws = 0;
+
+ typedef GrGpuCommandBuffer INHERITED;
+};
+
+#endif