Bug 1355011: Remove DrawEventRecorderMemory as it can too easily cause OOMs. r=lsalzman

This commit is contained in:
Bob Owen 2017-04-11 08:20:41 +01:00
parent fc959f3460
commit ab1587da50
2 changed files with 0 additions and 82 deletions

View File

@ -78,40 +78,5 @@ DrawEventRecorderFile::Close()
mOutputFile.close();
}
DrawEventRecorderMemory::DrawEventRecorderMemory()
: DrawEventRecorderPrivate(nullptr)
{
mOutputStream = &mMemoryStream;
WriteHeader();
}
void
DrawEventRecorderMemory::Flush()
{
mOutputStream->flush();
}
size_t
DrawEventRecorderMemory::RecordingSize()
{
return mMemoryStream.tellp();
}
bool
DrawEventRecorderMemory::CopyRecording(char* aBuffer, size_t aBufferLen)
{
return !!mMemoryStream.read(aBuffer, aBufferLen);
}
void
DrawEventRecorderMemory::WipeRecording()
{
mMemoryStream.str(std::string());
mMemoryStream.clear();
WriteHeader();
}
} // namespace gfx
} // namespace mozilla

View File

@ -103,53 +103,6 @@ private:
std::ofstream mOutputFile;
};
class DrawEventRecorderMemory final : public DrawEventRecorderPrivate
{
public:
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(DrawEventRecorderMemory)
/**
* Constructs a DrawEventRecorder that stores the recording in memory.
*/
DrawEventRecorderMemory();
/**
* @return the current size of the recording (in chars).
*/
size_t RecordingSize();
/**
* Copies at most aBufferLen chars of the recording into aBuffer.
*
* @param aBuffer buffer to receive the recording chars
* @param aBufferLen length of aBuffer
* @return true if copied successfully
*/
bool CopyRecording(char* aBuffer, size_t aBufferLen);
/**
* Wipes the internal recording buffer, but the recorder does NOT forget which
* objects it has recorded. This can be used so that a recording can be copied
* and processed in chunks, releasing memory as it goes.
*/
void WipeRecording();
/**
* Gets a readable reference of the underlying stream, reset to the beginning.
*/
std::istream& GetInputStream() {
mMemoryStream.seekg(0);
return mMemoryStream;
}
private:
~DrawEventRecorderMemory() {};
void Flush() final;
std::stringstream mMemoryStream;
};
} // namespace gfx
} // namespace mozilla