remove unused SkCachingPixelRef

BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1364743002
diff --git a/gyp/core.gypi b/gyp/core.gypi
index 710a8e4..9e9727c 100644
--- a/gyp/core.gypi
+++ b/gyp/core.gypi
@@ -343,10 +343,6 @@
         '<(skia_include_path)/core/SkXfermode.h',
         '<(skia_include_path)/private/SkTemplates.h',
 
-        # Lazy decoding:
-        '<(skia_src_path)/lazy/SkCachingPixelRef.cpp',
-        '<(skia_src_path)/lazy/SkCachingPixelRef.h',
-
         # Path ops
         '<(skia_include_path)/pathops/SkPathOps.h',
 
diff --git a/src/lazy/SkCachingPixelRef.cpp b/src/lazy/SkCachingPixelRef.cpp
deleted file mode 100644
index 692e4ea..0000000
--- a/src/lazy/SkCachingPixelRef.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2013 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkCachingPixelRef.h"
-#include "SkBitmapCache.h"
-#include "SkRect.h"
-
-bool SkCachingPixelRef::Install(SkImageGenerator* generator,
-                                SkBitmap* dst) {
-    SkASSERT(dst != nullptr);
-    if (nullptr == generator) {
-        return false;
-    }
-    const SkImageInfo info = generator->getInfo();
-    if (!dst->setInfo(info)) {
-        delete generator;
-        return false;
-    }
-    SkAutoTUnref<SkCachingPixelRef> ref(new SkCachingPixelRef(info, generator, dst->rowBytes()));
-    dst->setPixelRef(ref);
-    return true;
-}
-
-SkCachingPixelRef::SkCachingPixelRef(const SkImageInfo& info,
-                                     SkImageGenerator* generator,
-                                     size_t rowBytes)
-    : INHERITED(info)
-    , fImageGenerator(generator)
-    , fErrorInDecoding(false)
-    , fRowBytes(rowBytes) {
-    SkASSERT(fImageGenerator != nullptr);
-}
-SkCachingPixelRef::~SkCachingPixelRef() {
-    delete fImageGenerator;
-    // Assert always unlock before unref.
-}
-
-bool SkCachingPixelRef::onNewLockPixels(LockRec* rec) {
-    if (fErrorInDecoding) {
-        return false;  // don't try again.
-    }
-
-    const SkImageInfo& info = this->info();
-    if (!SkBitmapCache::Find(
-                this->getGenerationID(), info.bounds(), &fLockedBitmap)) {
-        // Cache has been purged, must re-decode.
-        if (!fLockedBitmap.tryAllocPixels(info, fRowBytes)) {
-            fErrorInDecoding = true;
-            return false;
-        }
-        if (!fImageGenerator->getPixels(info, fLockedBitmap.getPixels(), fRowBytes)) {
-            fErrorInDecoding = true;
-            return false;
-        }
-        fLockedBitmap.setImmutable();
-        SkBitmapCache::Add(this, info.bounds(), fLockedBitmap);
-    }
-
-    // Now bitmap should contain a concrete PixelRef of the decoded image.
-    void* pixels = fLockedBitmap.getPixels();
-    SkASSERT(pixels != nullptr);
-    rec->fPixels = pixels;
-    rec->fColorTable = nullptr;
-    rec->fRowBytes = fLockedBitmap.rowBytes();
-    return true;
-}
-
-void SkCachingPixelRef::onUnlockPixels() {
-    fLockedBitmap.reset();
-}
diff --git a/src/lazy/SkCachingPixelRef.h b/src/lazy/SkCachingPixelRef.h
deleted file mode 100644
index 1057441..0000000
--- a/src/lazy/SkCachingPixelRef.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2013 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkCachingPixelRef_DEFINED
-#define SkCachingPixelRef_DEFINED
-
-#include "SkBitmapCache.h"
-#include "SkImageInfo.h"
-#include "SkImageGenerator.h"
-#include "SkPixelRef.h"
-
-class SkColorTable;
-
-/**
- *  PixelRef which defers decoding until SkBitmap::lockPixels() is
- *  called.  Caches the decoded images in the global
- *  SkScaledImageCache.  When the pixels are unlocked, this cache may
- *  or be destroyed before the next lock.  If so, onLockPixels will
- *  attempt to re-decode.
- *
- *  Decoding is handled by the SkImageGenerator
- */
-class SkCachingPixelRef : public SkPixelRef {
-public:
-    
-    /**
-     *  Takes ownership of SkImageGenerator.  If this method fails for
-     *  whatever reason, it will return false and immediatetely delete
-     *  the generator.  If it succeeds, it will modify destination
-     *  bitmap.
-     *
-     *  If Install fails or when the SkCachingPixelRef that is
-     *  installed into destination is destroyed, it will call
-     *  `delete` on the generator.  Therefore, generator should be
-     *  allocated with `new`.
-     */
-    static bool Install(SkImageGenerator* gen, SkBitmap* dst);
-
-protected:
-    virtual ~SkCachingPixelRef();
-    bool onNewLockPixels(LockRec*) override;
-    void onUnlockPixels() override;
-    bool onLockPixelsAreWritable() const override { return false; }
-
-    SkData* onRefEncodedData() override {
-        return fImageGenerator->refEncodedData();
-    }
-
-    bool onIsLazyGenerated() const override { return true; }
-
-private:
-    SkImageGenerator* const fImageGenerator;
-    bool                    fErrorInDecoding;
-    const size_t            fRowBytes;
-
-    SkBitmap                fLockedBitmap;
-
-    SkCachingPixelRef(const SkImageInfo&, SkImageGenerator*, size_t rowBytes);
-
-    typedef SkPixelRef INHERITED;
-};
-
-#endif  // SkCachingPixelRef_DEFINED
diff --git a/tests/CachedDecodingPixelRefTest.cpp b/tests/CachedDecodingPixelRefTest.cpp
index b58880b..c14fb00 100644
--- a/tests/CachedDecodingPixelRefTest.cpp
+++ b/tests/CachedDecodingPixelRefTest.cpp
@@ -6,7 +6,6 @@
  */
 
 #include "SkBitmap.h"
-#include "SkCachingPixelRef.h"
 #include "SkCanvas.h"
 #include "SkData.h"
 #include "SkDiscardableMemoryPool.h"
@@ -141,9 +140,6 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-static bool install_skCachingPixelRef(SkData* encoded, SkBitmap* dst) {
-    return SkCachingPixelRef::Install(SkImageGenerator::NewFromEncoded(encoded), dst);
-}
 static bool install_skDiscardablePixelRef(SkData* encoded, SkBitmap* dst) {
     // Use system-default discardable memory.
     return SkInstallDiscardablePixelRef(encoded, dst);
@@ -151,12 +147,10 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 /**
- *  This checks to see that a SkCachingPixelRef and a
- *  SkDiscardablePixelRef works as advertised with a
+ *  This checks to see that SkDiscardablePixelRef works as advertised with a
  *  SkDecodingImageGenerator.
  */
 DEF_TEST(DecodingImageGenerator, reporter) {
-    test_three_encodings(reporter, install_skCachingPixelRef);
     test_three_encodings(reporter, install_skDiscardablePixelRef);
 }
 
@@ -228,27 +222,14 @@
     REPORTER_ASSERT(reporter, 0 == errors);
 }
 
-enum PixelRefType {
-    kSkCaching_PixelRefType,
-    kSkDiscardable_PixelRefType,
-    kLast_PixelRefType = kSkDiscardable_PixelRefType
-};
-
 static void check_pixelref(TestImageGenerator::TestType type,
                            skiatest::Reporter* reporter,
-                           PixelRefType pixelRefType,
                            SkDiscardableMemory::Factory* factory) {
-    SkASSERT((pixelRefType >= 0) && (pixelRefType <= kLast_PixelRefType));
     SkAutoTDelete<SkImageGenerator> gen(new TestImageGenerator(type, reporter));
     REPORTER_ASSERT(reporter, gen.get() != nullptr);
     SkBitmap lazy;
-    bool success;
-    if (kSkCaching_PixelRefType == pixelRefType) {
-        // Ignore factory; use global cache.
-        success = SkCachingPixelRef::Install(gen.detach(), &lazy);
-    } else {
-        success = SkInstallDiscardablePixelRef(gen.detach(), nullptr, &lazy, factory);
-    }
+    bool success = SkInstallDiscardablePixelRef(gen.detach(), nullptr, &lazy, factory);
+
     REPORTER_ASSERT(reporter, success);
     if (TestImageGenerator::kSucceedGetPixels_TestType == type) {
         check_test_image_generator_bitmap(reporter, lazy);
@@ -277,34 +258,23 @@
 DEF_TEST(DiscardableAndCachingPixelRef, reporter) {
     test_newlockdelete(reporter);
 
-    check_pixelref(TestImageGenerator::kFailGetPixels_TestType,
-                   reporter, kSkCaching_PixelRefType, nullptr);
-    check_pixelref(TestImageGenerator::kSucceedGetPixels_TestType,
-                   reporter, kSkCaching_PixelRefType, nullptr);
-
-    check_pixelref(TestImageGenerator::kFailGetPixels_TestType,
-                   reporter, kSkDiscardable_PixelRefType, nullptr);
-    check_pixelref(TestImageGenerator::kSucceedGetPixels_TestType,
-                   reporter, kSkDiscardable_PixelRefType, nullptr);
+    check_pixelref(TestImageGenerator::kFailGetPixels_TestType, reporter, nullptr);
+    check_pixelref(TestImageGenerator::kSucceedGetPixels_TestType, reporter, nullptr);
 
     SkAutoTUnref<SkDiscardableMemoryPool> pool(
         SkDiscardableMemoryPool::Create(1, nullptr));
     REPORTER_ASSERT(reporter, 0 == pool->getRAMUsed());
-    check_pixelref(TestImageGenerator::kFailGetPixels_TestType,
-                   reporter, kSkDiscardable_PixelRefType, pool);
+    check_pixelref(TestImageGenerator::kFailGetPixels_TestType, reporter, pool);
     REPORTER_ASSERT(reporter, 0 == pool->getRAMUsed());
-    check_pixelref(TestImageGenerator::kSucceedGetPixels_TestType,
-                   reporter, kSkDiscardable_PixelRefType, pool);
+    check_pixelref(TestImageGenerator::kSucceedGetPixels_TestType, reporter, pool);
     REPORTER_ASSERT(reporter, 0 == pool->getRAMUsed());
 
     SkDiscardableMemoryPool* globalPool = SkGetGlobalDiscardableMemoryPool();
     // Only acts differently from nullptr on a platform that has a
     // default discardable memory implementation that differs from the
     // global DM pool.
-    check_pixelref(TestImageGenerator::kFailGetPixels_TestType,
-                   reporter, kSkDiscardable_PixelRefType, globalPool);
-    check_pixelref(TestImageGenerator::kSucceedGetPixels_TestType,
-                   reporter, kSkDiscardable_PixelRefType, globalPool);
+    check_pixelref(TestImageGenerator::kFailGetPixels_TestType, reporter, globalPool);
+    check_pixelref(TestImageGenerator::kSucceedGetPixels_TestType, reporter, globalPool);
 }
 
 ////////////////////////////////////////////////////////////////////////////////