Change DebugCanvas API to not encourage memory leaks
Pass command strings and offset arrays as out parameters instead of
returning new arrays from the functions.
This simplifies debugger leak investigations, as the app leaks less by
design.
Review URL: https://codereview.chromium.org/821663003
diff --git a/debugger/SkDebugger.h b/debugger/SkDebugger.h
index 5359b10..683b98d 100644
--- a/debugger/SkDebugger.h
+++ b/debugger/SkDebugger.h
@@ -44,12 +44,8 @@
fDebugCanvas->toggleCommand(index, isVisible);
}
- SkTArray<SkString>* getDrawCommandsAsStrings() {
- return fDebugCanvas->getDrawCommandsAsStrings();
- }
-
- SkTDArray<size_t>* getDrawCommandOffsets() {
- return fDebugCanvas->getDrawCommandOffsets();
+ SkDrawCommand* getDrawCommandAt(int index) {
+ return fDebugCanvas->getDrawCommandAt(index);
}
const SkTDArray<SkDrawCommand*>& getDrawCommands() const {
@@ -66,7 +62,7 @@
SkPicture* copyPicture();
- int getSize() {
+ int getSize() const {
return fDebugCanvas->getSize();
}