MD Bookmarks: Batch updates to the UI when processing API operations

In MD Bookmarks, each action processed from the bookmarks API listeners
would immediately notify the UI about changes that need to be made. In
cases where many notifications are triggered in a row (eg, deleting 100
bookmarks), this would cause many useless UI updates, slowing the page
down significantly.

This CL adds a 'batch mode' to the data store which suppresses UI
notifications while it is active. Enabling batch mode for API operations
(move, add, delete) makes these >10x faster with large numbers of nodes.

BUG=727177
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Review-Url: https://codereview.chromium.org/2946203002
Cr-Commit-Position: refs/heads/master@{#482838}
4 files changed