Add mock context and use in ResourceCacheTest.
BUG=skia:2889
Committed: https://skia.googlesource.com/skia/+/820dd6c335411aad889c1d7e8a857642ecd87e30
Review URL: https://codereview.chromium.org/702083003
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 5891840..a456a79 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -121,7 +121,11 @@
if (NULL == fGpu) {
return false;
}
+ this->initCommon();
+ return true;
+}
+void GrContext::initCommon() {
fDrawState = SkNEW(GrDrawState);
fGpu->setDrawState(fDrawState);
@@ -141,8 +145,6 @@
fDidTestPMConversions = false;
this->setupDrawBuffer();
-
- return true;
}
GrContext::~GrContext() {
@@ -156,14 +158,14 @@
(*fCleanUpData[i].fFunc)(this, fCleanUpData[i].fInfo);
}
- delete fResourceCache2;
+ SkDELETE(fResourceCache2);
fResourceCache2 = NULL;
- delete fResourceCache;
+ SkDELETE(fResourceCache);
fResourceCache = NULL;
- delete fFontCache;
- delete fDrawBuffer;
- delete fDrawBufferVBAllocPool;
- delete fDrawBufferIBAllocPool;
+ SkDELETE(fFontCache);
+ SkDELETE(fDrawBuffer);
+ SkDELETE(fDrawBufferVBAllocPool);
+ SkDELETE(fDrawBufferIBAllocPool);
fAARectRenderer->unref();
fOvalRenderer->unref();