diff options
author | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-02 22:02:54 +0000 |
---|---|---|
committer | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-02 22:02:54 +0000 |
commit | 702126c6af7e854d09274cc9540b909f4e0f3249 (patch) | |
tree | 794761e5d94ebfc7c37d39bcf20f5b022513cd2c /chrome/browser/cocoa/cookies_window_controller.h | |
parent | ab9d7a06c05e3aa36a558a0b7e1f0bf9a20767ee (diff) | |
download | chromium_src-702126c6af7e854d09274cc9540b909f4e0f3249.zip chromium_src-702126c6af7e854d09274cc9540b909f4e0f3249.tar.gz chromium_src-702126c6af7e854d09274cc9540b909f4e0f3249.tar.bz2 |
[Mac] Reduce jank in the cookie manager by batching updates from the model.
Subclass TreeModelObserver specifically for the CookiesTreeModel so that we can
send TreeModelBatchBegin() and BatchEnd() notifications before and after local
storage, databases, and appcache entries load, respectively.
This also rewrites CookiesTreeModelObserverBridge::FindCocoaNode() to do
breadth-first search, rather than a pre-order traversal as we most often search
for origin nodes, which are at depth 1.
BUG=35134
TEST=Get a profile with 1K local storage entries. Chromium-->Preferences-->Under the Hood-->Content Settings-->Cookies should not be slow/janky.
Review URL: http://codereview.chromium.org/660251
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40444 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/cookies_window_controller.h')
-rw-r--r-- | chrome/browser/cocoa/cookies_window_controller.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/chrome/browser/cocoa/cookies_window_controller.h b/chrome/browser/cocoa/cookies_window_controller.h index e0d31f3..8f85285 100644 --- a/chrome/browser/cocoa/cookies_window_controller.h +++ b/chrome/browser/cocoa/cookies_window_controller.h @@ -21,7 +21,7 @@ class CookiesWindowControllerTest; // Thin bridge to the window controller that performs model update actions // directly on the treeController_. -class CookiesTreeModelObserverBridge : public TreeModelObserver { +class CookiesTreeModelObserverBridge : public CookiesTreeModel::Observer { public: explicit CookiesTreeModelObserverBridge(CookiesWindowController* controller); @@ -45,6 +45,9 @@ class CookiesTreeModelObserverBridge : public TreeModelObserver { // Notification that the contents of a node has changed. virtual void TreeNodeChanged(TreeModel* model, TreeModelNode* node); + virtual void TreeModelBeginBatch(CookiesTreeModel* model); + virtual void TreeModelEndBatch(CookiesTreeModel* model); + // Invalidates the Cocoa model. This is used to tear down the Cocoa model // when we're about to entirely rebuild it. void InvalidateCocoaModel(); @@ -66,6 +69,11 @@ class CookiesTreeModelObserverBridge : public TreeModelObserver { bool HasCocoaModel(); CookiesWindowController* window_controller_; // weak, owns us. + + // If this is true, then the Model has informed us that it is batching + // updates. Rather than updating the Cocoa side of the model, we ignore those + // small changes and rebuild once at the end. + bool batch_update_; }; // Controller for the cookies manager. This class stores an internal copy of |