diff options
author | kkinnunen <kkinnunen@nvidia.com> | 2014-12-30 07:22:58 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-30 07:22:58 -0800 |
commit | 5037e9de94e57d36592cc596d831cc2b5ec45bd3 (patch) | |
tree | 816d7c02cb2d4640e2d4565b7c799ed86045ed17 /src | |
parent | d5e98713576a961d05b957465e83cdf992daca1b (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/utils/debugger/SkDebugCanvas.cpp | 21 | ||||
-rw-r--r-- | src/utils/debugger/SkDebugCanvas.h | 10 |
2 files changed, 0 insertions, 31 deletions
diff --git a/src/utils/debugger/SkDebugCanvas.cpp b/src/utils/debugger/SkDebugCanvas.cpp index f2f92b8492..46c0b8b472 100644 --- a/src/utils/debugger/SkDebugCanvas.cpp +++ b/src/utils/debugger/SkDebugCanvas.cpp @@ -388,27 +388,6 @@ SkTDArray <SkDrawCommand*>& SkDebugCanvas::getDrawCommands() { return fCommandVector; } -// TODO(chudy): Free command string memory. -SkTArray<SkString>* SkDebugCanvas::getDrawCommandsAsStrings() const { - SkTArray<SkString>* commandString = new SkTArray<SkString>(fCommandVector.count()); - if (!fCommandVector.isEmpty()) { - for (int i = 0; i < fCommandVector.count(); i ++) { - commandString->push_back() = fCommandVector[i]->toString(); - } - } - return commandString; -} - -SkTDArray<size_t>* SkDebugCanvas::getDrawCommandOffsets() const { - SkTDArray<size_t>* commandOffsets = new SkTDArray<size_t>; - if (!fCommandVector.isEmpty()) { - for (int i = 0; i < fCommandVector.count(); i ++) { - *commandOffsets->push() = fCommandVector[i]->offset(); - } - } - return commandOffsets; -} - void SkDebugCanvas::overrideTexFiltering(bool overrideTexFiltering, SkPaint::FilterLevel level) { if (NULL == fTexOverrideFilter) { fTexOverrideFilter = new SkTexOverrideFilter; diff --git a/src/utils/debugger/SkDebugCanvas.h b/src/utils/debugger/SkDebugCanvas.h index 18f4c8d713..a526525f45 100644 --- a/src/utils/debugger/SkDebugCanvas.h +++ b/src/utils/debugger/SkDebugCanvas.h @@ -123,16 +123,6 @@ public: SkTDArray<SkDrawCommand*>& getDrawCommands(); /** - * Returns the string vector of draw commands - */ - SkTArray<SkString>* getDrawCommandsAsStrings() const; - - /** - * Returns an array containing an offset (in the SkPicture) for each command - */ - SkTDArray<size_t>* getDrawCommandOffsets() const; - - /** Returns length of draw command vector. */ int getSize() const { |