Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/filterStorage.js

Issue 29900557: Issue 7016 - Convert serialization functions into generators (Closed)
Patch Set: Actually Address PS2 Comments Created Oct. 21, 2018, 5:25 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/filterStorage.js
===================================================================
--- a/lib/filterStorage.js
+++ b/lib/filterStorage.js
@@ -454,46 +454,38 @@
subscriptions.push(subscription);
}
}
yield "# Adblock Plus preferences";
yield "version=" + formatVersion;
let saved = new Set();
- let buf = [];
// Save subscriptions
for (let subscription of subscriptions)
{
- yield "";
+ yield* subscription.serialize();
- subscription.serialize(buf);
if (subscription.filters.length)
{
- buf.push("", "[Subscription filters]");
- subscription.serializeFilters(buf);
+ yield "[Subscription filters]";
Manish Jethani 2018/10/21 21:51:43 We could actually move this line into serializeFil
Jon Sonesen 2018/10/22 19:27:47 Yeah I will move it.
+ yield* subscription.serializeFilters();
}
- for (let line of buf)
- yield line;
- buf.splice(0);
}
// Save filter data
for (let subscription of subscriptions)
{
for (let filter of subscription.filters)
{
if (!saved.has(filter.text))
{
- filter.serialize(buf);
+ yield* filter.serialize();
saved.add(filter.text);
- for (let line of buf)
- yield line;
- buf.splice(0);
}
}
}
},
/**
* Will be set to true if saveToDisk() is running (reentrance protection).
* @type {boolean}

Powered by Google App Engine
This is Rietveld