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
This commit is contained in:
msarett 2016-04-19 07:27:58 -07:00 committed by Commit bot
parent 3c920243f8
commit be991efbd9
4 changed files with 1 additions and 49 deletions

View File

@ -21,7 +21,6 @@ class SkBitmap;
class SkBitmapHeap; class SkBitmapHeap;
class SkFactorySet; class SkFactorySet;
class SkFlattenable; class SkFlattenable;
class SkNamedFactorySet;
class SkRefCntSet; class SkRefCntSet;
class SkWriteBuffer { class SkWriteBuffer {
@ -81,7 +80,6 @@ public:
void writeToMemory(void* dst) { fWriter.flatten(dst); } void writeToMemory(void* dst) { fWriter.flatten(dst); }
SkFactorySet* setFactoryRecorder(SkFactorySet*); SkFactorySet* setFactoryRecorder(SkFactorySet*);
SkNamedFactorySet* setNamedFactoryRecorder(SkNamedFactorySet*);
SkRefCntSet* getTypefaceRecorder() const { return fTFSet; } SkRefCntSet* getTypefaceRecorder() const { return fTFSet; }
SkRefCntSet* setTypefaceRecorder(SkRefCntSet*); SkRefCntSet* setTypefaceRecorder(SkRefCntSet*);
@ -114,7 +112,6 @@ private:
const uint32_t fFlags; const uint32_t fFlags;
SkFactorySet* fFactorySet; SkFactorySet* fFactorySet;
SkNamedFactorySet* fNamedFactorySet;
SkWriter32 fWriter; SkWriter32 fWriter;
SkBitmapHeap* fBitmapHeap; SkBitmapHeap* fBitmapHeap;

View File

@ -63,13 +63,11 @@ SkFlatController::SkFlatController(uint32_t writeBufferFlags)
: fBitmapHeap(nullptr) : fBitmapHeap(nullptr)
, fTypefaceSet(nullptr) , fTypefaceSet(nullptr)
, fTypefacePlayback(nullptr) , fTypefacePlayback(nullptr)
, fFactorySet(nullptr)
, fWriteBufferFlags(writeBufferFlags) {} , fWriteBufferFlags(writeBufferFlags) {}
SkFlatController::~SkFlatController() { SkFlatController::~SkFlatController() {
SkSafeUnref(fBitmapHeap); SkSafeUnref(fBitmapHeap);
SkSafeUnref(fTypefaceSet); SkSafeUnref(fTypefaceSet);
SkSafeUnref(fFactorySet);
} }
void SkFlatController::setBitmapHeap(SkBitmapHeap* heap) { void SkFlatController::setBitmapHeap(SkBitmapHeap* heap) {
@ -83,8 +81,3 @@ void SkFlatController::setTypefaceSet(SkRefCntSet *set) {
void SkFlatController::setTypefacePlayback(SkTypefacePlayback* playback) { void SkFlatController::setTypefacePlayback(SkTypefacePlayback* playback) {
fTypefacePlayback = playback; fTypefacePlayback = playback;
} }
SkNamedFactorySet* SkFlatController::setNamedFactorySet(SkNamedFactorySet* set) {
SkRefCnt_SafeAssign(fFactorySet, set);
return set;
}

View File

@ -229,12 +229,6 @@ public:
*/ */
SkTypefacePlayback* getTypefacePlayback() { return fTypefacePlayback; } 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. * Flags to use during creation of SkFlatData objects. Defaults to zero.
*/ */
@ -259,18 +253,10 @@ protected:
*/ */
void setTypefacePlayback(SkTypefacePlayback*); 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: private:
SkBitmapHeap* fBitmapHeap; SkBitmapHeap* fBitmapHeap;
SkRefCntSet* fTypefaceSet; SkRefCntSet* fTypefaceSet;
SkTypefacePlayback* fTypefacePlayback; SkTypefacePlayback* fTypefacePlayback;
SkNamedFactorySet* fFactorySet;
const uint32_t fWriteBufferFlags; const uint32_t fWriteBufferFlags;
typedef SkRefCnt INHERITED; typedef SkRefCnt INHERITED;
@ -287,7 +273,6 @@ public:
buffer.setBitmapHeap(controller->getBitmapHeap()); buffer.setBitmapHeap(controller->getBitmapHeap());
buffer.setTypefaceRecorder(controller->getTypefaceSet()); buffer.setTypefaceRecorder(controller->getTypefaceSet());
buffer.setNamedFactoryRecorder(controller->getNamedFactorySet());
Traits::Flatten(buffer, obj); Traits::Flatten(buffer, obj);
size_t size = buffer.bytesWritten(); size_t size = buffer.bytesWritten();
@ -498,7 +483,6 @@ private:
SkASSERT(fController->getBitmapHeap() != nullptr); SkASSERT(fController->getBitmapHeap() != nullptr);
fScratch.setBitmapHeap(fController->getBitmapHeap()); fScratch.setBitmapHeap(fController->getBitmapHeap());
fScratch.setTypefaceRecorder(fController->getTypefaceSet()); fScratch.setTypefaceRecorder(fController->getTypefaceSet());
fScratch.setNamedFactoryRecorder(fController->getNamedFactorySet());
fReady = true; fReady = true;
} }

View File

@ -17,7 +17,6 @@
SkWriteBuffer::SkWriteBuffer(uint32_t flags) SkWriteBuffer::SkWriteBuffer(uint32_t flags)
: fFlags(flags) : fFlags(flags)
, fFactorySet(nullptr) , fFactorySet(nullptr)
, fNamedFactorySet(nullptr)
, fBitmapHeap(nullptr) , fBitmapHeap(nullptr)
, fTFSet(nullptr) { , fTFSet(nullptr) {
} }
@ -25,7 +24,6 @@ SkWriteBuffer::SkWriteBuffer(uint32_t flags)
SkWriteBuffer::SkWriteBuffer(void* storage, size_t storageSize, uint32_t flags) SkWriteBuffer::SkWriteBuffer(void* storage, size_t storageSize, uint32_t flags)
: fFlags(flags) : fFlags(flags)
, fFactorySet(nullptr) , fFactorySet(nullptr)
, fNamedFactorySet(nullptr)
, fWriter(storage, storageSize) , fWriter(storage, storageSize)
, fBitmapHeap(nullptr) , fBitmapHeap(nullptr)
, fTFSet(nullptr) { , fTFSet(nullptr) {
@ -33,7 +31,6 @@ SkWriteBuffer::SkWriteBuffer(void* storage, size_t storageSize, uint32_t flags)
SkWriteBuffer::~SkWriteBuffer() { SkWriteBuffer::~SkWriteBuffer() {
SkSafeUnref(fFactorySet); SkSafeUnref(fFactorySet);
SkSafeUnref(fNamedFactorySet);
SkSafeUnref(fBitmapHeap); SkSafeUnref(fBitmapHeap);
SkSafeUnref(fTFSet); SkSafeUnref(fTFSet);
} }
@ -233,19 +230,6 @@ void SkWriteBuffer::writeTypeface(SkTypeface* obj) {
SkFactorySet* SkWriteBuffer::setFactoryRecorder(SkFactorySet* rec) { SkFactorySet* SkWriteBuffer::setFactoryRecorder(SkFactorySet* rec) {
SkRefCnt_SafeAssign(fFactorySet, 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; return rec;
} }
@ -286,7 +270,7 @@ void SkWriteBuffer::writeFlattenable(const SkFlattenable* flattenable) {
if (nullptr == flattenable) { if (nullptr == flattenable) {
if (this->isValidating()) { if (this->isValidating()) {
this->writeString(""); this->writeString("");
} else if (fFactorySet != nullptr || fNamedFactorySet != nullptr) { } else if (fFactorySet != nullptr) {
this->write32(0); this->write32(0);
} else { } else {
this->writeFunctionPtr(nullptr); this->writeFunctionPtr(nullptr);
@ -313,12 +297,6 @@ void SkWriteBuffer::writeFlattenable(const SkFlattenable* flattenable) {
this->writeString(flattenable->getTypeName()); this->writeString(flattenable->getTypeName());
} else if (fFactorySet) { } else if (fFactorySet) {
this->write32(fFactorySet->add(factory)); this->write32(fFactorySet->add(factory));
} else if (fNamedFactorySet) {
int32_t index = fNamedFactorySet->find(factory);
this->write32(index);
if (0 == index) {
return;
}
} else { } else {
this->writeFunctionPtr((void*)factory); this->writeFunctionPtr((void*)factory);
} }