Move mock gpu and caps, add Gr prefix, and create via GrContext::Create

Change-Id: I02427839f78372e337ed717b071c6baaa8ba4450
Reviewed-on: https://skia-review.googlesource.com/20622
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index b0d40f6..405668d 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -53,14 +53,12 @@
 
 GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext,
                              const GrContextOptions& options) {
-    GrContext* context = new GrContext;
+    sk_sp<GrContext> context(new GrContext);
 
-    if (context->init(backend, backendContext, options)) {
-        return context;
-    } else {
-        context->unref();
+    if (!context->init(backend, backendContext, options)) {
         return nullptr;
     }
+    return context.release();
 }
 
 static int32_t gNextID = 1;
@@ -91,12 +89,6 @@
     if (!fGpu) {
         return false;
     }
-    this->initCommon(options);
-    return true;
-}
-
-void GrContext::initCommon(const GrContextOptions& options) {
-    ASSERT_SINGLE_OWNER
 
     fCaps = SkRef(fGpu->caps());
     fResourceCache = new GrResourceCache(fCaps, fUniqueID);
@@ -113,6 +105,8 @@
     fAtlasGlyphCache = new GrAtlasGlyphCache(this, options.fGlyphCacheTextureMaximumBytes);
 
     fTextBlobCache.reset(new GrTextBlobCache(TextBlobCacheOverBudgetCB, this));
+
+    return true;
 }
 
 GrContext::~GrContext() {