Bug 1434662 - Move initialization code to ProtocolParser::Begin(). r=gcp
Repurpose the previously unused Begin() function to initialize ProtocolParser objects and also assert that we are not reusing objects across update since that's not supported. MozReview-Commit-ID: HIGGgOr388h
This commit is contained in:
@@ -90,6 +90,25 @@ ProtocolParser::CleanupUpdates()
|
||||
mTableUpdates.Clear();
|
||||
}
|
||||
|
||||
nsresult
|
||||
ProtocolParser::Begin(const nsACString& aTable,
|
||||
const nsTArray<nsCString>& aUpdateTables)
|
||||
{
|
||||
// ProtocolParser objects should never be reused.
|
||||
MOZ_ASSERT(mPending.IsEmpty());
|
||||
MOZ_ASSERT(mTableUpdates.IsEmpty());
|
||||
MOZ_ASSERT(mForwards.IsEmpty());
|
||||
MOZ_ASSERT(mRequestedTables.IsEmpty());
|
||||
MOZ_ASSERT(mTablesToReset.IsEmpty());
|
||||
|
||||
if (!aTable.IsEmpty()) {
|
||||
SetCurrentTable(aTable);
|
||||
}
|
||||
SetRequestedTables(aUpdateTables);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
TableUpdate *
|
||||
ProtocolParser::GetTableUpdate(const nsACString& aTable)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user