Add direct getter for GrCaps to GrContext.

TBR=joshualitt@google.com

Committed: https://skia.googlesource.com/skia/+/9138c46e572085870638b6f7ad7fcdfcdf3cac99

Review URL: https://codereview.chromium.org/1149773005
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 5baf722..ca98ffb 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -138,6 +138,7 @@
 
 GrContext::GrContext() : fUniqueID(next_id()) {
     fGpu = NULL;
+    fCaps = NULL;
     fResourceCache = NULL;
     fResourceProvider = NULL;
     fPathRendererChain = NULL;
@@ -159,6 +160,7 @@
 }
 
 void GrContext::initCommon() {
+    fCaps = SkRef(fGpu->caps());
     fResourceCache = SkNEW(GrResourceCache);
     fResourceCache->setOverBudgetCallback(OverBudgetCB, this);
     fResourceProvider = SkNEW_ARGS(GrResourceProvider, (fGpu, fResourceCache));
@@ -177,6 +179,7 @@
 
 GrContext::~GrContext() {
     if (!fGpu) {
+        SkASSERT(!fCaps);
         return;
     }
 
@@ -191,6 +194,7 @@
     SkDELETE(fBatchFontCache);
 
     fGpu->unref();
+    fCaps->unref();
     SkSafeUnref(fPathRendererChain);
     SkSafeUnref(fSoftwarePathRenderer);
 }
@@ -258,18 +262,6 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 
-bool GrContext::shaderDerivativeSupport() const {
-    return fGpu->caps()->shaderCaps()->shaderDerivativeSupport();
-}
-
-bool GrContext::isConfigTexturable(GrPixelConfig config) const {
-    return fGpu->caps()->isConfigTexturable(config);
-}
-
-bool GrContext::npotTextureTileSupport() const {
-    return fGpu->caps()->npotTextureTileSupport();
-}
-
 void GrContext::OverBudgetCB(void* data) {
     SkASSERT(data);
 
@@ -290,18 +282,6 @@
     context->flush();
 }
 
-int GrContext::getMaxTextureSize() const {
-    return fGpu->caps()->maxTextureSize();
-}
-
-int GrContext::getMaxRenderTargetSize() const {
-    return fGpu->caps()->maxRenderTargetSize();
-}
-
-int GrContext::getMaxSampleCount() const {
-    return fGpu->caps()->maxSampleCount();
-}
-
 ////////////////////////////////////////////////////////////////////////////////
 
 void GrContext::flush(int flagsBitfield) {
@@ -687,13 +667,9 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-bool GrContext::isConfigRenderable(GrPixelConfig config, bool withMSAA) const {
-    return fGpu->caps()->isConfigRenderable(config, withMSAA);
-}
-
 int GrContext::getRecommendedSampleCount(GrPixelConfig config,
                                          SkScalar dpi) const {
-    if (!this->isConfigRenderable(config, true)) {
+    if (!this->caps()->isConfigRenderable(config, true)) {
         return 0;
     }
     int chosenSampleCount = 0;