From be991efbd9fe62a26a652b5ec8b8c98eb0fc6591 Mon Sep 17 00:00:00 2001 From: msarett Date: Tue, 19 Apr 2016 07:27:58 -0700 Subject: [PATCH] Delete unused fNamedFactorySet from SkWriteBuffer BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1903483002 Review URL: https://codereview.chromium.org/1903483002 --- include/core/SkWriteBuffer.h | 3 --- src/core/SkPictureFlat.cpp | 7 ------- src/core/SkPictureFlat.h | 16 ---------------- src/core/SkWriteBuffer.cpp | 24 +----------------------- 4 files changed, 1 insertion(+), 49 deletions(-) diff --git a/include/core/SkWriteBuffer.h b/include/core/SkWriteBuffer.h index 3ae82d014a..306a3e37a9 100644 --- a/include/core/SkWriteBuffer.h +++ b/include/core/SkWriteBuffer.h @@ -21,7 +21,6 @@ class SkBitmap; class SkBitmapHeap; class SkFactorySet; class SkFlattenable; -class SkNamedFactorySet; class SkRefCntSet; class SkWriteBuffer { @@ -81,7 +80,6 @@ public: void writeToMemory(void* dst) { fWriter.flatten(dst); } SkFactorySet* setFactoryRecorder(SkFactorySet*); - SkNamedFactorySet* setNamedFactoryRecorder(SkNamedFactorySet*); SkRefCntSet* getTypefaceRecorder() const { return fTFSet; } SkRefCntSet* setTypefaceRecorder(SkRefCntSet*); @@ -114,7 +112,6 @@ private: const uint32_t fFlags; SkFactorySet* fFactorySet; - SkNamedFactorySet* fNamedFactorySet; SkWriter32 fWriter; SkBitmapHeap* fBitmapHeap; diff --git a/src/core/SkPictureFlat.cpp b/src/core/SkPictureFlat.cpp index 71f39ea0f9..792345885c 100644 --- a/src/core/SkPictureFlat.cpp +++ b/src/core/SkPictureFlat.cpp @@ -63,13 +63,11 @@ SkFlatController::SkFlatController(uint32_t writeBufferFlags) : fBitmapHeap(nullptr) , fTypefaceSet(nullptr) , fTypefacePlayback(nullptr) -, fFactorySet(nullptr) , fWriteBufferFlags(writeBufferFlags) {} SkFlatController::~SkFlatController() { SkSafeUnref(fBitmapHeap); SkSafeUnref(fTypefaceSet); - SkSafeUnref(fFactorySet); } void SkFlatController::setBitmapHeap(SkBitmapHeap* heap) { @@ -83,8 +81,3 @@ void SkFlatController::setTypefaceSet(SkRefCntSet *set) { void SkFlatController::setTypefacePlayback(SkTypefacePlayback* playback) { fTypefacePlayback = playback; } - -SkNamedFactorySet* SkFlatController::setNamedFactorySet(SkNamedFactorySet* set) { - SkRefCnt_SafeAssign(fFactorySet, set); - return set; -} diff --git a/src/core/SkPictureFlat.h b/src/core/SkPictureFlat.h index 73103c69f0..cd750bffab 100644 --- a/src/core/SkPictureFlat.h +++ b/src/core/SkPictureFlat.h @@ -229,12 +229,6 @@ public: */ SkTypefacePlayback* getTypefacePlayback() { return fTypefacePlayback; } - /** - * Optional factory recorder used during creation of SkFlatData objects. Set - * using the protected method setNamedFactorySet. - */ - SkNamedFactorySet* getNamedFactorySet() { return fFactorySet; } - /** * Flags to use during creation of SkFlatData objects. Defaults to zero. */ @@ -259,18 +253,10 @@ protected: */ void setTypefacePlayback(SkTypefacePlayback*); - /** - * Set an SkNamedFactorySet to be used to store Factorys and their - * corresponding names during flattening. Ref counted. Returns the same - * set as a convenience. - */ - SkNamedFactorySet* setNamedFactorySet(SkNamedFactorySet*); - private: SkBitmapHeap* fBitmapHeap; SkRefCntSet* fTypefaceSet; SkTypefacePlayback* fTypefacePlayback; - SkNamedFactorySet* fFactorySet; const uint32_t fWriteBufferFlags; typedef SkRefCnt INHERITED; @@ -287,7 +273,6 @@ public: buffer.setBitmapHeap(controller->getBitmapHeap()); buffer.setTypefaceRecorder(controller->getTypefaceSet()); - buffer.setNamedFactoryRecorder(controller->getNamedFactorySet()); Traits::Flatten(buffer, obj); size_t size = buffer.bytesWritten(); @@ -498,7 +483,6 @@ private: SkASSERT(fController->getBitmapHeap() != nullptr); fScratch.setBitmapHeap(fController->getBitmapHeap()); fScratch.setTypefaceRecorder(fController->getTypefaceSet()); - fScratch.setNamedFactoryRecorder(fController->getNamedFactorySet()); fReady = true; } diff --git a/src/core/SkWriteBuffer.cpp b/src/core/SkWriteBuffer.cpp index c33a7aec52..1674b931ee 100644 --- a/src/core/SkWriteBuffer.cpp +++ b/src/core/SkWriteBuffer.cpp @@ -17,7 +17,6 @@ SkWriteBuffer::SkWriteBuffer(uint32_t flags) : fFlags(flags) , fFactorySet(nullptr) - , fNamedFactorySet(nullptr) , fBitmapHeap(nullptr) , fTFSet(nullptr) { } @@ -25,7 +24,6 @@ SkWriteBuffer::SkWriteBuffer(uint32_t flags) SkWriteBuffer::SkWriteBuffer(void* storage, size_t storageSize, uint32_t flags) : fFlags(flags) , fFactorySet(nullptr) - , fNamedFactorySet(nullptr) , fWriter(storage, storageSize) , fBitmapHeap(nullptr) , fTFSet(nullptr) { @@ -33,7 +31,6 @@ SkWriteBuffer::SkWriteBuffer(void* storage, size_t storageSize, uint32_t flags) SkWriteBuffer::~SkWriteBuffer() { SkSafeUnref(fFactorySet); - SkSafeUnref(fNamedFactorySet); SkSafeUnref(fBitmapHeap); SkSafeUnref(fTFSet); } @@ -233,19 +230,6 @@ void SkWriteBuffer::writeTypeface(SkTypeface* obj) { SkFactorySet* SkWriteBuffer::setFactoryRecorder(SkFactorySet* rec) { SkRefCnt_SafeAssign(fFactorySet, rec); - if (fNamedFactorySet != nullptr) { - fNamedFactorySet->unref(); - fNamedFactorySet = nullptr; - } - return rec; -} - -SkNamedFactorySet* SkWriteBuffer::setNamedFactoryRecorder(SkNamedFactorySet* rec) { - SkRefCnt_SafeAssign(fNamedFactorySet, rec); - if (fFactorySet != nullptr) { - fFactorySet->unref(); - fFactorySet = nullptr; - } return rec; } @@ -286,7 +270,7 @@ void SkWriteBuffer::writeFlattenable(const SkFlattenable* flattenable) { if (nullptr == flattenable) { if (this->isValidating()) { this->writeString(""); - } else if (fFactorySet != nullptr || fNamedFactorySet != nullptr) { + } else if (fFactorySet != nullptr) { this->write32(0); } else { this->writeFunctionPtr(nullptr); @@ -313,12 +297,6 @@ void SkWriteBuffer::writeFlattenable(const SkFlattenable* flattenable) { this->writeString(flattenable->getTypeName()); } else if (fFactorySet) { this->write32(fFactorySet->add(factory)); - } else if (fNamedFactorySet) { - int32_t index = fNamedFactorySet->find(factory); - this->write32(index); - if (0 == index) { - return; - } } else { this->writeFunctionPtr((void*)factory); }