Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: chrome/browser/resources/md_bookmarks/types.js

Issue 2869273011: [MD Bookmarks] Convert bookmark list to iron-list. (Closed)
Patch Set: add comment, fix closure, rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/md_bookmarks/list.js ('k') | chrome/test/data/webui/md_bookmarks/list_test.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/md_bookmarks/types.js
diff --git a/chrome/browser/resources/md_bookmarks/types.js b/chrome/browser/resources/md_bookmarks/types.js
index c878a8b2cde90028a5d5ff77a93ff5ccde2ae057..888031a7c164e54d5488e4622d8c65285ebaf391 100644
--- a/chrome/browser/resources/md_bookmarks/types.js
+++ b/chrome/browser/resources/md_bookmarks/types.js
@@ -93,3 +93,39 @@ function StoreObserver(){};
/** @param {!BookmarksPageState} newState */
StoreObserver.prototype.onStateChanged = function(newState) {};
+
+// TODO(calamity): Remove once
+// https://github.com/google/closure-compiler/pull/2495 is merged.
+Polymer.ArraySplice = {};
+
+/**
+ * Returns an array of splice records indicating the minimum edits required
+ * to transform the `previous` array into the `current` array.
+ *
+ * Splice records are ordered by index and contain the following fields:
+ * - `index`: index where edit started
+ * - `removed`: array of removed items from this index
+ * - `addedCount`: number of items added at this index
+ *
+ * This function is based on the Levenshtein "minimum edit distance"
+ * algorithm. Note that updates are treated as removal followed by addition.
+ *
+ * The worst-case time complexity of this algorithm is `O(l * p)`
+ * l: The length of the current array
+ * p: The length of the previous array
+ *
+ * However, the worst-case complexity is reduced by an `O(n)` optimization
+ * to detect any shared prefix & suffix between the two arrays and only
+ * perform the more expensive minimum edit distance calculation over the
+ * non-shared portions of the arrays.
+ *
+ * @param {Array} current The "changed" array for which splices will be
+ * calculated.
+ * @param {Array} previous The "unchanged" original array to compare
+ * `current` against to determine the splices.
+ * @return {Array} Returns an array of splice record objects. Each of these
+ * contains: `index` the location where the splice occurred; `removed`
+ * the array of removed items from this location; `addedCount` the number
+ * of items added at this location.
+ */
+Polymer.ArraySplice.calculateSplices = function(current, previous) {};
« no previous file with comments | « chrome/browser/resources/md_bookmarks/list.js ('k') | chrome/test/data/webui/md_bookmarks/list_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698