1 /* 2 * Copyright 2022 Google LLC 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef skgpu_RecorderPriv_DEFINED 9 #define skgpu_RecorderPriv_DEFINED 10 11 #include "experimental/graphite/include/Recorder.h" 12 13 namespace skgpu { 14 15 class RecorderPriv { 16 public: 17 void add(sk_sp<Task>); 18 19 ResourceProvider* resourceProvider() const; 20 UniformCache* uniformCache() const; 21 DrawBufferManager* drawBufferManager() const; 22 const Caps* caps() const; 23 24 private: RecorderPriv(Recorder * recorder)25 explicit RecorderPriv(Recorder* recorder) : fRecorder(recorder) {} 26 RecorderPriv& operator=(const RecorderPriv&) = delete; 27 28 // No taking addresses of this type. 29 const RecorderPriv* operator&() const = delete; 30 RecorderPriv* operator&() = delete; 31 32 Recorder* fRecorder; 33 34 friend class Recorder; // to construct/copy this type. 35 36 }; 37 priv()38inline RecorderPriv Recorder::priv() { 39 return RecorderPriv(this); 40 } 41 priv()42inline const RecorderPriv Recorder::priv() const { // NOLINT(readability-const-return-type) 43 return RecorderPriv(const_cast<Recorder*>(this)); 44 } 45 46 } // namespace skgpu 47 48 #endif // skgpu_RecorderPriv_DEFINED 49