Move SkDeferredDisplayList.h into include\core

Clients will need official access to this class for the compilation iterator.

This CL also hides some of the cruft we don't want exposed.

Bug: skia:9455
Change-Id: I408c19f9ecd6880a5a7853def591407b0ca43e4e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272343
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/gn/core.gni b/gn/core.gni
index d4817ae..212ceb5 100644
--- a/gn/core.gni
+++ b/gn/core.gni
@@ -25,6 +25,7 @@
   "$_include/core/SkCubicMap.h",
   "$_include/core/SkData.h",
   "$_include/core/SkDataTable.h",
+  "$_include/core/SkDeferredDisplayList.h",
   "$_include/core/SkDeferredDisplayListRecorder.h",
   "$_include/core/SkDocument.h",
   "$_include/core/SkDrawLooper.h",
@@ -460,7 +461,6 @@
   "$_include/private/SkChecksum.h",
   "$_include/private/SkColorData.h",
   "$_include/private/SkDDLTmpRedirect.h",
-  "$_include/private/SkDeferredDisplayList.h",
   "$_include/private/SkDeque.h",
   "$_include/private/SkFixed.h",
   "$_include/private/SkFloatBits.h",
diff --git a/include/private/SkDeferredDisplayList.h b/include/core/SkDeferredDisplayList.h
similarity index 69%
rename from include/private/SkDeferredDisplayList.h
rename to include/core/SkDeferredDisplayList.h
index 5046cd5..1fb552e 100644
--- a/include/private/SkDeferredDisplayList.h
+++ b/include/core/SkDeferredDisplayList.h
@@ -18,38 +18,16 @@
 #include "include/private/GrRecordingContext.h"
 #include "include/private/SkTArray.h"
 #include <map>
-class GrOpMemoryPool;
 class GrRenderTask;
-class GrRenderTargetProxy;
 struct GrCCPerOpsTaskPaths;
 #endif
 
 /*
  * This class contains pre-processed gpu operations that can be replayed into
- * an SkSurface via draw(SkDeferredDisplayList*).
- *
- * TODO: we probably need to expose this class so users can query it for memory usage.
+ * an SkSurface via SkSurface::draw(SkDeferredDisplayList*).
  */
 class SkDeferredDisplayList {
 public:
-
-#if SK_SUPPORT_GPU
-    // This object is the source from which the lazy proxy backing the DDL will pull its backing
-    // texture when the DDL is replayed. It has to be separately ref counted bc the lazy proxy
-    // can outlive the DDL.
-    class SK_API LazyProxyData : public SkRefCnt {
-    public:
-        // Upon being replayed - this field will be filled in (by the DrawingManager) with the
-        // proxy backing the destination SkSurface. Note that, since there is no good place to
-        // clear it, it can become a dangling pointer.
-        GrRenderTargetProxy* fReplayDest = nullptr;
-    };
-#else
-    class SK_API LazyProxyData : public SkRefCnt {};
-#endif
-
-    SK_API SkDeferredDisplayList(const SkSurfaceCharacterization& characterization,
-                                 sk_sp<LazyProxyData>);
     SK_API ~SkDeferredDisplayList();
 
     SK_API const SkSurfaceCharacterization& characterization() const {
@@ -61,16 +39,21 @@
     const SkDeferredDisplayListPriv priv() const;
 
 private:
-#if SK_SUPPORT_GPU
-    SK_API const SkTArray<GrRecordingContext::ProgramData>& programData() const {
-        return fProgramData;
-    }
-#endif
-
     friend class GrDrawingManager; // for access to 'fRenderTasks', 'fLazyProxyData', 'fArenas'
     friend class SkDeferredDisplayListRecorder; // for access to 'fLazyProxyData'
     friend class SkDeferredDisplayListPriv;
 
+    class LazyProxyData;
+
+    SK_API SkDeferredDisplayList(const SkSurfaceCharacterization& characterization,
+                                 sk_sp<LazyProxyData>);
+
+#if SK_SUPPORT_GPU
+    const SkTArray<GrRecordingContext::ProgramData>& programData() const {
+        return fProgramData;
+    }
+#endif
+
     const SkSurfaceCharacterization fCharacterization;
 
 #if SK_SUPPORT_GPU
@@ -84,8 +67,8 @@
     SkTArray<sk_sp<GrRenderTask>>   fRenderTasks;
 
     SkTArray<GrRecordingContext::ProgramData> fProgramData;
-#endif
     sk_sp<LazyProxyData>            fLazyProxyData;
+#endif
 };
 
 #endif
diff --git a/include/core/SkDeferredDisplayListRecorder.h b/include/core/SkDeferredDisplayListRecorder.h
index e4e9b2a..ecb61f8 100644
--- a/include/core/SkDeferredDisplayListRecorder.h
+++ b/include/core/SkDeferredDisplayListRecorder.h
@@ -8,11 +8,11 @@
 #ifndef SkDeferredDisplayListRecorder_DEFINED
 #define SkDeferredDisplayListRecorder_DEFINED
 
+#include "include/core/SkDeferredDisplayList.h"
 #include "include/core/SkImageInfo.h"
 #include "include/core/SkRefCnt.h"
 #include "include/core/SkSurfaceCharacterization.h"
 #include "include/core/SkTypes.h"
-#include "include/private/SkDeferredDisplayList.h"
 
 class GrBackendFormat;
 class GrBackendTexture;
diff --git a/include/private/SkDDLTmpRedirect.h b/include/private/SkDDLTmpRedirect.h
index 71684f3..2fbfc14 100644
--- a/include/private/SkDDLTmpRedirect.h
+++ b/include/private/SkDDLTmpRedirect.h
@@ -10,6 +10,6 @@
 
 // A client is directly referencing include/private/SkDeferredDisplayList.h. This temporary
 // header is required to move them over to referencing include/core/SkDeferredDisplayList.h.
-#include "include/private/SkDeferredDisplayList.h"
+#include "include/core/SkDeferredDisplayList.h"
 
 #endif
diff --git a/src/core/SkDeferredDisplayList.cpp b/src/core/SkDeferredDisplayList.cpp
index c718433..e84dc3d 100644
--- a/src/core/SkDeferredDisplayList.cpp
+++ b/src/core/SkDeferredDisplayList.cpp
@@ -5,9 +5,10 @@
  * found in the LICENSE file.
  */
 
+#include "src/core/SkDeferredDisplayListPriv.h"
+
 #include "include/core/SkRefCnt.h"
 #include "include/core/SkTypes.h"
-#include "include/private/SkDeferredDisplayList.h"
 #include "src/core/SkArenaAlloc.h"
 #include <utility>
 class SkSurfaceCharacterization;
@@ -20,8 +21,10 @@
 SkDeferredDisplayList::SkDeferredDisplayList(const SkSurfaceCharacterization& characterization,
                                              sk_sp<LazyProxyData> lazyProxyData)
         : fCharacterization(characterization)
-        , fLazyProxyData(std::move(lazyProxyData)) {
+#if SK_SUPPORT_GPU
+        , fLazyProxyData(std::move(lazyProxyData))
+#endif
+{
 }
 
-SkDeferredDisplayList::~SkDeferredDisplayList() {
-}
+SkDeferredDisplayList::~SkDeferredDisplayList() {}
diff --git a/src/core/SkDeferredDisplayListPriv.h b/src/core/SkDeferredDisplayListPriv.h
index 51f1c4b..ced7c2c 100644
--- a/src/core/SkDeferredDisplayListPriv.h
+++ b/src/core/SkDeferredDisplayListPriv.h
@@ -8,32 +8,44 @@
 #ifndef SkDeferredDisplayListPriv_DEFINED
 #define SkDeferredDisplayListPriv_DEFINED
 
-#include "include/private/SkDeferredDisplayList.h"
+#include "include/core/SkDeferredDisplayList.h"
+class GrRenderTargetProxy;
 
+/*************************************************************************************************/
+
+// This object is the source from which the lazy proxy backing the DDL will pull its backing
+// texture when the DDL is replayed. It has to be separately ref counted bc the lazy proxy
+// can outlive the DDL.
+class SkDeferredDisplayList::LazyProxyData : public SkRefCnt {
+#if SK_SUPPORT_GPU
+public:
+    // Upon being replayed - this field will be filled in (by the DrawingManager) with the
+    // proxy backing the destination SkSurface. Note that, since there is no good place to
+    // clear it, it can become a dangling pointer.
+    GrRenderTargetProxy* fReplayDest = nullptr;
+#endif
+};
+
+/*************************************************************************************************/
 /** Class that adds methods to SkDeferredDisplayList that are only intended for use internal to Skia.
     This class is purely a privileged window into SkDeferredDisplayList. It should never have
     additional data members or virtual methods. */
 class SkDeferredDisplayListPriv {
 public:
-    int numRenderTasks() const {
+
 #if SK_SUPPORT_GPU
+    int numRenderTasks() const {
         return fDDL->fRenderTasks.count();
-#else
-        return 0;
-#endif
     }
 
     const SkDeferredDisplayList::LazyProxyData* lazyProxyData() const {
-#if SK_SUPPORT_GPU
         return fDDL->fLazyProxyData.get();
-#else
-        return nullptr;
-#endif
     }
 
     const SkTArray<GrRecordingContext::ProgramData>& programData() const {
         return fDDL->programData();
     }
+#endif
 
 private:
     explicit SkDeferredDisplayListPriv(SkDeferredDisplayList* ddl) : fDDL(ddl) {}
diff --git a/src/core/SkDeferredDisplayListRecorder.cpp b/src/core/SkDeferredDisplayListRecorder.cpp
index d523f5c..afcab82 100644
--- a/src/core/SkDeferredDisplayListRecorder.cpp
+++ b/src/core/SkDeferredDisplayListRecorder.cpp
@@ -6,9 +6,10 @@
  */
 
 #include "include/core/SkDeferredDisplayListRecorder.h"
+
 #include "include/core/SkSurface.h"
 #include "include/core/SkSurfaceCharacterization.h"
-#include "include/private/SkDeferredDisplayList.h"
+#include "src/core/SkDeferredDisplayListPriv.h"
 #include "src/core/SkMessageBus.h"
 
 #if !SK_SUPPORT_GPU
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index c9f95bb..39e7492 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -7,9 +7,9 @@
 
 #include "include/gpu/GrContext.h"
 
+#include "include/core/SkDeferredDisplayList.h"
 #include "include/core/SkTraceMemoryDump.h"
 #include "include/gpu/GrBackendSemaphore.h"
-#include "include/private/SkDeferredDisplayList.h"
 #include "include/private/SkImageInfoPriv.h"
 #include "src/core/SkMipMap.h"
 #include "src/core/SkTaskGroup.h"
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index b53f0bc..e4d53b4 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -10,7 +10,7 @@
 #include "include/gpu/GrBackendSemaphore.h"
 #include "include/gpu/GrTexture.h"
 #include "include/private/GrRecordingContext.h"
-#include "include/private/SkDeferredDisplayList.h"
+#include "src/core/SkDeferredDisplayListPriv.h"
 #include "src/core/SkTTopoSort.h"
 #include "src/gpu/GrAuditTrail.h"
 #include "src/gpu/GrClientMappedBufferManager.h"
diff --git a/src/gpu/vk/GrVkSecondaryCBDrawContext.cpp b/src/gpu/vk/GrVkSecondaryCBDrawContext.cpp
index f0e1dce..b547526 100644
--- a/src/gpu/vk/GrVkSecondaryCBDrawContext.cpp
+++ b/src/gpu/vk/GrVkSecondaryCBDrawContext.cpp
@@ -7,11 +7,11 @@
 
 #include "src/gpu/vk/GrVkSecondaryCBDrawContext.h"
 
+#include "include/core/SkDeferredDisplayList.h"
 #include "include/core/SkImageInfo.h"
 #include "include/core/SkSurfaceCharacterization.h"
 #include "include/gpu/GrContext.h"
 #include "include/gpu/vk/GrVkTypes.h"
-#include "include/private/SkDeferredDisplayList.h"
 #include "src/core/SkSurfacePriv.h"
 #include "src/gpu/GrContextPriv.h"
 #include "src/gpu/GrContextThreadSafeProxyPriv.h"
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index 90b6448..015e0e3 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -6,11 +6,11 @@
  */
 
 #include "include/core/SkCanvas.h"
+#include "include/core/SkDeferredDisplayList.h"
 #include "include/core/SkSurfaceCharacterization.h"
 #include "include/gpu/GrBackendSurface.h"
 #include "include/gpu/GrTexture.h"
 #include "include/private/GrRecordingContext.h"
-#include "include/private/SkDeferredDisplayList.h"
 #include "src/core/SkImagePriv.h"
 #include "src/gpu/GrAHardwareBufferUtils.h"
 #include "src/gpu/GrCaps.h"
diff --git a/tests/DeferredDisplayListTest.cpp b/tests/DeferredDisplayListTest.cpp
index 743f1a6..5012b67 100644
--- a/tests/DeferredDisplayListTest.cpp
+++ b/tests/DeferredDisplayListTest.cpp
@@ -9,6 +9,7 @@
 #include "include/core/SkCanvas.h"
 #include "include/core/SkColor.h"
 #include "include/core/SkColorSpace.h"
+#include "include/core/SkDeferredDisplayList.h"
 #include "include/core/SkDeferredDisplayListRecorder.h"
 #include "include/core/SkImage.h"
 #include "include/core/SkImageInfo.h"
@@ -26,7 +27,6 @@
 #include "include/gpu/GrTypes.h"
 #include "include/gpu/gl/GrGLTypes.h"
 #include "include/private/GrTypesPriv.h"
-#include "include/private/SkDeferredDisplayList.h"
 #include "src/core/SkDeferredDisplayListPriv.h"
 #include "src/gpu/GrCaps.h"
 #include "src/gpu/GrContextPriv.h"
diff --git a/tools/skpbench/skpbench.cpp b/tools/skpbench/skpbench.cpp
index 31e01e3..fde81b8 100644
--- a/tools/skpbench/skpbench.cpp
+++ b/tools/skpbench/skpbench.cpp
@@ -6,6 +6,7 @@
  */
 
 #include "include/core/SkCanvas.h"
+#include "include/core/SkDeferredDisplayList.h"
 #include "include/core/SkGraphics.h"
 #include "include/core/SkPicture.h"
 #include "include/core/SkPictureRecorder.h"
@@ -13,7 +14,6 @@
 #include "include/core/SkSurface.h"
 #include "include/core/SkSurfaceProps.h"
 #include "include/effects/SkPerlinNoiseShader.h"
-#include "include/private/SkDeferredDisplayList.h"
 #include "src/core/SkOSFile.h"
 #include "src/core/SkTaskGroup.h"
 #include "src/gpu/GrCaps.h"