Rename SkCanvasDrawable to SkDrawable, and make public

 (patchset #2 id:20001 of https://codereview.chromium.org/903993002/)"

This reverts commit c4e87724920222a218f31b22612efc5b1ec0ed6c.

BUG=skia:
TBR=
NOTREECHECKS=True

Review URL: https://codereview.chromium.org/898343004
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 055e673..ce99546 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -6,11 +6,11 @@
  */
 
 #include "SkCanvas.h"
-#include "SkCanvasDrawable.h"
 #include "SkCanvasPriv.h"
 #include "SkBitmapDevice.h"
 #include "SkDeviceImageFilterProxy.h"
 #include "SkDraw.h"
+#include "SkDrawable.h"
 #include "SkDrawFilter.h"
 #include "SkDrawLooper.h"
 #include "SkImage.h"
@@ -2293,13 +2293,13 @@
     LOOPER_END
 }
 
-void SkCanvas::EXPERIMENTAL_drawDrawable(SkCanvasDrawable* dr) {
+void SkCanvas::drawDrawable(SkDrawable* dr) {
     if (dr && !this->quickReject(dr->getBounds())) {
         this->onDrawDrawable(dr);
     }
 }
 
-void SkCanvas::onDrawDrawable(SkCanvasDrawable* dr) {
+void SkCanvas::onDrawDrawable(SkDrawable* dr) {
     dr->draw(this);
 }
 
diff --git a/src/core/SkCanvasDrawable.h b/src/core/SkCanvasDrawable.h
deleted file mode 100644
index bc5b4fd..0000000
--- a/src/core/SkCanvasDrawable.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkCanvasDrawable_DEFINED
-#define SkCanvasDrawable_DEFINED
-
-#include "SkRefCnt.h"
-
-class SkCanvas;
-class SkPicture;
-struct SkRect;
-
-/**
- *  Base-class for objects that draw into SkCanvas.
- *
- *  The object has a generation ID, which is guaranteed to be unique across all drawables. To
- *  allow for clients of the drawable that may want to cache the results, the drawable must
- *  change its generation ID whenever its internal state changes such that it will draw differently.
- */
-class SkCanvasDrawable : public SkRefCnt {
-public:
-    SkCanvasDrawable();
-
-    /**
-     *  Draws into the specified content. The drawing sequence will be balanced upon return
-     *  (i.e. the saveLevel() on the canvas will match what it was when draw() was called,
-     *  and the current matrix and clip settings will not be changed.
-     */
-    void draw(SkCanvas*);
-
-    SkPicture* newPictureSnapshot();
-
-    /**
-     *  Return a unique value for this instance. If two calls to this return the same value,
-     *  it is presumed that calling the draw() method will render the same thing as well.
-     *
-     *  Subclasses that change their state should call notifyDrawingChanged() to ensure that
-     *  a new value will be returned the next time it is called.
-     */
-    uint32_t getGenerationID();
-
-    /**
-     *  Return the (conservative) bounds of what the drawable will draw. If the drawable can
-     *  change what it draws (e.g. animation or in response to some external change), then this
-     *  must return a bounds that is always valid for all possible states.
-     */
-    SkRect getBounds();
-
-    /**
-     *  Calling this invalidates the previous generation ID, and causes a new one to be computed
-     *  the next time getGenerationID() is called. Typically this is called by the object itself,
-     *  in response to its internal state changing.
-     */
-    void notifyDrawingChanged();
-
-protected:
-    virtual SkRect onGetBounds() = 0;
-    virtual void onDraw(SkCanvas*) = 0;
-    virtual SkPicture* onNewPictureSnapshot();
-
-private:
-    int32_t fGenerationID;
-};
-
-#endif
diff --git a/src/core/SkCanvasDrawable.cpp b/src/core/SkDrawable.cpp
similarity index 80%
rename from src/core/SkCanvasDrawable.cpp
rename to src/core/SkDrawable.cpp
index 99a4996..64fefd2 100644
--- a/src/core/SkCanvasDrawable.cpp
+++ b/src/core/SkDrawable.cpp
@@ -6,7 +6,7 @@
  */
 
 #include "SkCanvas.h"
-#include "SkCanvasDrawable.h"
+#include "SkDrawable.h"
 #include "SkThread.h"
 
 static int32_t next_generation_id() {
@@ -21,7 +21,7 @@
     return genID;
 }
 
-SkCanvasDrawable::SkCanvasDrawable() : fGenerationID(0) {}
+SkDrawable::SkDrawable() : fGenerationID(0) {}
 
 static void draw_bbox(SkCanvas* canvas, const SkRect& r) {
     SkPaint paint;
@@ -32,7 +32,7 @@
     canvas->drawLine(r.left(), r.bottom(), r.right(), r.top(), paint);
 }
 
-void SkCanvasDrawable::draw(SkCanvas* canvas) {
+void SkDrawable::draw(SkCanvas* canvas) {
     SkAutoCanvasRestore acr(canvas, true);
     this->onDraw(canvas);
 
@@ -41,22 +41,22 @@
     }
 }
 
-SkPicture* SkCanvasDrawable::newPictureSnapshot() {
+SkPicture* SkDrawable::newPictureSnapshot() {
     return this->onNewPictureSnapshot();
 }
 
-uint32_t SkCanvasDrawable::getGenerationID() {
+uint32_t SkDrawable::getGenerationID() {
     if (0 == fGenerationID) {
         fGenerationID = next_generation_id();
     }
     return fGenerationID;
 }
 
-SkRect SkCanvasDrawable::getBounds() {
+SkRect SkDrawable::getBounds() {
     return this->onGetBounds();
 }
 
-void SkCanvasDrawable::notifyDrawingChanged() {
+void SkDrawable::notifyDrawingChanged() {
     fGenerationID = 0;
 }
 
@@ -64,7 +64,7 @@
 
 #include "SkPictureRecorder.h"
 
-SkPicture* SkCanvasDrawable::onNewPictureSnapshot() {
+SkPicture* SkDrawable::onNewPictureSnapshot() {
     SkPictureRecorder recorder;
 
     const SkRect bounds = this->getBounds();
diff --git a/src/core/SkPictureRecorder.cpp b/src/core/SkPictureRecorder.cpp
index 69411d3..42f8732 100644
--- a/src/core/SkPictureRecorder.cpp
+++ b/src/core/SkPictureRecorder.cpp
@@ -5,8 +5,8 @@
  * found in the LICENSE file.
  */
 
-#include "SkCanvasDrawable.h"
 #include "SkData.h"
+#include "SkDrawable.h"
 #include "SkLayerInfo.h"
 #include "SkPictureRecorder.h"
 #include "SkRecord.h"
@@ -51,7 +51,7 @@
         saveLayerData.reset(SkNEW_ARGS(SkLayerInfo, (key)));
     }
 
-    SkCanvasDrawableList* drawableList = fRecorder->getDrawableList();
+    SkDrawableList* drawableList = fRecorder->getDrawableList();
     SkPicture::SnapshotArray* pictList = drawableList ? drawableList->newDrawableSnapshot() : NULL;
 
     if (fBBH.get()) {
@@ -82,8 +82,8 @@
     }
 
     int drawableCount = 0;
-    SkCanvasDrawable* const* drawables = NULL;
-    SkCanvasDrawableList* drawableList = fRecorder->getDrawableList();
+    SkDrawable* const* drawables = NULL;
+    SkDrawableList* drawableList = fRecorder->getDrawableList();
     if (drawableList) {
         drawableCount = drawableList->count();
         drawables = drawableList->begin();
@@ -93,15 +93,15 @@
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-class SkRecordedDrawable : public SkCanvasDrawable {
-    SkAutoTUnref<SkRecord>              fRecord;
-    SkAutoTUnref<SkBBoxHierarchy>       fBBH;
-    SkAutoTDelete<SkCanvasDrawableList> fDrawableList;
-    const SkRect                        fBounds;
-    const bool                          fDoSaveLayerInfo;
+class SkRecordedDrawable : public SkDrawable {
+    SkAutoTUnref<SkRecord>          fRecord;
+    SkAutoTUnref<SkBBoxHierarchy>   fBBH;
+    SkAutoTDelete<SkDrawableList>   fDrawableList;
+    const SkRect                    fBounds;
+    const bool                      fDoSaveLayerInfo;
 
 public:
-    SkRecordedDrawable(SkRecord* record, SkBBoxHierarchy* bbh, SkCanvasDrawableList* drawableList,
+    SkRecordedDrawable(SkRecord* record, SkBBoxHierarchy* bbh, SkDrawableList* drawableList,
                        const SkRect& bounds, bool doSaveLayerInfo)
         : fRecord(SkRef(record))
         , fBBH(SkSafeRef(bbh))
@@ -114,7 +114,7 @@
     SkRect onGetBounds() SK_OVERRIDE { return fBounds; }
 
     void onDraw(SkCanvas* canvas) SK_OVERRIDE {
-        SkCanvasDrawable* const* drawables = NULL;
+        SkDrawable* const* drawables = NULL;
         int drawableCount = 0;
         if (fDrawableList) {
             drawables = fDrawableList->begin();
@@ -153,7 +153,7 @@
     }
 };
 
-SkCanvasDrawable* SkPictureRecorder::EXPERIMENTAL_endRecordingAsDrawable() {
+SkDrawable* SkPictureRecorder::endRecordingAsDrawable() {
     // TODO: delay as much of this work until just before first playback?
     SkRecordOptimize(fRecord);
 
@@ -161,10 +161,10 @@
         SkRecordFillBounds(fCullRect, *fRecord, fBBH.get());
     }
 
-    SkCanvasDrawable* drawable = SkNEW_ARGS(SkRecordedDrawable,
-                                            (fRecord, fBBH, fRecorder->detachDrawableList(),
-                                             fCullRect,
-                                             SkToBool(fFlags & kComputeSaveLayerInfo_RecordFlag)));
+    SkDrawable* drawable = SkNEW_ARGS(SkRecordedDrawable,
+                                        (fRecord, fBBH, fRecorder->detachDrawableList(),
+                                         fCullRect,
+                                         SkToBool(fFlags & kComputeSaveLayerInfo_RecordFlag)));
 
     // release our refs now, so only the drawable will be the owner.
     fRecorder.reset(NULL);
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp
index a59d325..3fed8de 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -12,7 +12,7 @@
 void SkRecordDraw(const SkRecord& record,
                   SkCanvas* canvas,
                   SkPicture const* const drawablePicts[],
-                  SkCanvasDrawable* const drawables[],
+                  SkDrawable* const drawables[],
                   int drawableCount,
                   const SkBBoxHierarchy* bbh,
                   SkPicture::AbortCallback* callback) {
@@ -124,7 +124,7 @@
     SkASSERT(r.index < fDrawableCount);
     if (fDrawables) {
         SkASSERT(NULL == fDrawablePicts);
-        fCanvas->EXPERIMENTAL_drawDrawable(fDrawables[r.index]);
+        fCanvas->drawDrawable(fDrawables[r.index]);
     } else {
         fCanvas->drawPicture(fDrawablePicts[r.index]);
     }
diff --git a/src/core/SkRecordDraw.h b/src/core/SkRecordDraw.h
index 593674e..7bbab81 100644
--- a/src/core/SkRecordDraw.h
+++ b/src/core/SkRecordDraw.h
@@ -13,7 +13,7 @@
 #include "SkMatrix.h"
 #include "SkRecord.h"
 
-class SkCanvasDrawable;
+class SkDrawable;
 class SkLayerInfo;
 
 // Fill a BBH to be used by SkRecordDraw to accelerate playback.
@@ -25,7 +25,7 @@
 
 // Draw an SkRecord into an SkCanvas.  A convenience wrapper around SkRecords::Draw.
 void SkRecordDraw(const SkRecord&, SkCanvas*, SkPicture const* const drawablePicts[],
-                  SkCanvasDrawable* const drawables[], int drawableCount,
+                  SkDrawable* const drawables[], int drawableCount,
                   const SkBBoxHierarchy*, SkPicture::AbortCallback*);
 
 // Draw a portion of an SkRecord into an SkCanvas.
@@ -43,7 +43,7 @@
 class Draw : SkNoncopyable {
 public:
     explicit Draw(SkCanvas* canvas, SkPicture const* const drawablePicts[],
-                  SkCanvasDrawable* const drawables[], int drawableCount,
+                  SkDrawable* const drawables[], int drawableCount,
                   const SkMatrix* initialCTM = NULL)
         : fInitialCTM(initialCTM ? *initialCTM : canvas->getTotalMatrix())
         , fCanvas(canvas)
@@ -70,7 +70,7 @@
     const SkMatrix fInitialCTM;
     SkCanvas* fCanvas;
     SkPicture const* const* fDrawablePicts;
-    SkCanvasDrawable* const* fDrawables;
+    SkDrawable* const* fDrawables;
     int fDrawableCount;
 };
 
diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp
index de16d62..aafb540 100644
--- a/src/core/SkRecorder.cpp
+++ b/src/core/SkRecorder.cpp
@@ -9,11 +9,11 @@
 #include "SkPatchUtils.h"
 #include "SkPicture.h"
 
-SkCanvasDrawableList::~SkCanvasDrawableList() {
+SkDrawableList::~SkDrawableList() {
     fArray.unrefAll();
 }
 
-SkPicture::SnapshotArray* SkCanvasDrawableList::newDrawableSnapshot() {
+SkPicture::SnapshotArray* SkDrawableList::newDrawableSnapshot() {
     const int count = fArray.count();
     if (0 == count) {
         return NULL;
@@ -25,7 +25,7 @@
     return SkNEW_ARGS(SkPicture::SnapshotArray, (pics.detach(), count));
 }
 
-void SkCanvasDrawableList::append(SkCanvasDrawable* drawable) {
+void SkDrawableList::append(SkDrawable* drawable) {
     *fArray.append() = SkRef(drawable);
 }
 
@@ -143,9 +143,9 @@
     APPEND(DrawDRRect, delay_copy(paint), outer, inner);
 }
 
-void SkRecorder::onDrawDrawable(SkCanvasDrawable* drawable) {
+void SkRecorder::onDrawDrawable(SkDrawable* drawable) {
     if (!fDrawableList) {
-        fDrawableList.reset(SkNEW(SkCanvasDrawableList));
+        fDrawableList.reset(SkNEW(SkDrawableList));
     }
     fDrawableList->append(drawable);
     APPEND(DrawDrawable, drawable->getBounds(), fDrawableList->count() - 1);
diff --git a/src/core/SkRecorder.h b/src/core/SkRecorder.h
index 611dbbd..130dce9 100644
--- a/src/core/SkRecorder.h
+++ b/src/core/SkRecorder.h
@@ -15,20 +15,20 @@
 
 class SkBBHFactory;
 
-class SkCanvasDrawableList : SkNoncopyable {
+class SkDrawableList : SkNoncopyable {
 public:
-    ~SkCanvasDrawableList();
+    ~SkDrawableList();
 
     int count() const { return fArray.count(); }
-    SkCanvasDrawable* const* begin() const { return fArray.begin(); }
+    SkDrawable* const* begin() const { return fArray.begin(); }
 
-    void append(SkCanvasDrawable* drawable);
+    void append(SkDrawable* drawable);
 
     // Return a new or ref'd array of pictures that were snapped from our drawables.
     SkPicture::SnapshotArray* newDrawableSnapshot();
 
 private:
-    SkTDArray<SkCanvasDrawable*> fArray;
+    SkTDArray<SkDrawable*> fArray;
 };
 
 // SkRecorder provides an SkCanvas interface for recording into an SkRecord.
@@ -39,8 +39,8 @@
     SkRecorder(SkRecord*, int width, int height);   // legacy version
     SkRecorder(SkRecord*, const SkRect& bounds);
 
-    SkCanvasDrawableList* getDrawableList() const { return fDrawableList.get(); }
-    SkCanvasDrawableList* detachDrawableList() { return fDrawableList.detach(); }
+    SkDrawableList* getDrawableList() const { return fDrawableList.get(); }
+    SkDrawableList* detachDrawableList() { return fDrawableList.detach(); }
 
     // Make SkRecorder forget entirely about its SkRecord*; all calls to SkRecorder will fail.
     void forgetRecord();
@@ -54,7 +54,7 @@
     void didSetMatrix(const SkMatrix&) SK_OVERRIDE;
 
     void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE;
-    void onDrawDrawable(SkCanvasDrawable*) SK_OVERRIDE;
+    void onDrawDrawable(SkDrawable*) SK_OVERRIDE;
     void onDrawText(const void* text,
                     size_t byteLength,
                     SkScalar x,
@@ -131,7 +131,7 @@
 
     SkRecord* fRecord;
 
-    SkAutoTDelete<SkCanvasDrawableList> fDrawableList;
+    SkAutoTDelete<SkDrawableList> fDrawableList;
 };
 
 #endif//SkRecorder_DEFINED
diff --git a/src/core/SkRecords.h b/src/core/SkRecords.h
index 522bf68..319d155 100644
--- a/src/core/SkRecords.h
+++ b/src/core/SkRecords.h
@@ -9,7 +9,7 @@
 #define SkRecords_DEFINED
 
 #include "SkCanvas.h"
-#include "SkCanvasDrawable.h"
+#include "SkDrawable.h"
 #include "SkPicture.h"
 #include "SkTextBlob.h"