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

Issue 1005873012: Makes bookmark menu lazily create menus and removes limits (Closed)

Created:
5 years, 9 months ago by sky
Modified:
5 years, 8 months ago
Reviewers:
Peter Kasting
CC:
chromium-reviews, tfarina
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Increases the limit of bookmarks shown in the menu to 10,000 The ids now start at 0xDFFF. Since the menus are lazily loaded there isn't a need to limit how much is shown. R=pkasting@chromium.org BUG=374312 TEST=none Committed: https://crrev.com/80d99738f74feb34aed36c5ec1c750d3418680b0 Cr-Commit-Position: refs/heads/master@{#322935}

Patch Set 1 #

Patch Set 2 : cleanup #

Total comments: 4

Patch Set 3 : lazy load #

Patch Set 4 : cleanup #

Total comments: 24

Patch Set 5 : review feedback #

Unified diffs Side-by-side diffs Delta from patch set Stats (+149 lines, -214 lines) Patch
M chrome/app/chrome_command_ids.h View 1 2 3 4 1 chunk +7 lines, -0 lines 0 comments Download
M chrome/browser/ui/toolbar/wrench_menu_model.h View 1 2 3 4 1 chunk +1 line, -7 lines 0 comments Download
M chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.cc View 1 2 2 chunks +5 lines, -3 lines 0 comments Download
M chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.h View 1 2 3 6 chunks +11 lines, -17 lines 0 comments Download
M chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc View 1 2 3 4 6 chunks +44 lines, -57 lines 0 comments Download
M chrome/browser/ui/views/bookmarks/bookmark_menu_delegate_unittest.cc View 1 2 3 4 2 chunks +71 lines, -113 lines 0 comments Download
M chrome/browser/ui/views/toolbar/wrench_menu.cc View 1 2 3 4 6 chunks +8 lines, -17 lines 0 comments Download
M ui/views/controls/menu/menu_controller.cc View 1 2 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 10 (2 generated)
sky
5 years, 9 months ago (2015-03-25 21:12:57 UTC) #1
Peter Kasting
Did you test to ensure 10,000 doesn't cause noticeable perf issues? Is there a point ...
5 years, 9 months ago (2015-03-25 21:31:29 UTC) #2
sky
I've changed things around substantially. Part of the performance concern previously was we created menus ...
5 years, 8 months ago (2015-03-30 20:46:35 UTC) #3
Peter Kasting
Nice! LGTM https://codereview.chromium.org/1005873012/diff/60001/chrome/app/chrome_command_ids.h File chrome/app/chrome_command_ids.h (right): https://codereview.chromium.org/1005873012/diff/60001/chrome/app/chrome_command_ids.h#newcode365 chrome/app/chrome_command_ids.h:365: // These values are > 0xDFFF as ...
5 years, 8 months ago (2015-03-30 21:35:25 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1005873012/80001
5 years, 8 months ago (2015-03-30 23:20:58 UTC) #7
commit-bot: I haz the power
Committed patchset #5 (id:80001)
5 years, 8 months ago (2015-03-31 01:03:47 UTC) #8
commit-bot: I haz the power
Patchset 5 (id:??) landed as https://crrev.com/80d99738f74feb34aed36c5ec1c750d3418680b0 Cr-Commit-Position: refs/heads/master@{#322935}
5 years, 8 months ago (2015-03-31 01:04:50 UTC) #9
sky
5 years, 8 months ago (2015-03-31 15:17:39 UTC) #10
Message was sent while issue was closed.
I forgot to push my responses before landing yesterday. Sorry.

https://codereview.chromium.org/1005873012/diff/60001/chrome/app/chrome_comma...
File chrome/app/chrome_command_ids.h (right):

https://codereview.chromium.org/1005873012/diff/60001/chrome/app/chrome_comma...
chrome/app/chrome_command_ids.h:365: // These values are > 0xDFFF as the ids are
not exposed to the native system.
On 2015/03/30 21:35:24, Peter Kasting wrote:
> Nit: Maybe this second sentence: "While command IDs passed to Windows
functions
> must not be higher than 0xDFFF, these IDs are not exposed to the native system
> and thus can be in this otherwise-reserved range."

Done.

https://codereview.chromium.org/1005873012/diff/60001/chrome/app/chrome_comma...
chrome/app/chrome_command_ids.h:366: #define IDC_FIRST_BOOKMARK_MENU 0xDFFF + 1
On 2015/03/30 21:35:24, Peter Kasting wrote:
> Nit: "0xE000" seems a bit less obtuse.

Done.

https://codereview.chromium.org/1005873012/diff/60001/chrome/browser/ui/toolb...
File chrome/browser/ui/toolbar/wrench_menu_model.h (right):

https://codereview.chromium.org/1005873012/diff/60001/chrome/browser/ui/toolb...
chrome/browser/ui/toolbar/wrench_menu_model.h:131: // Range of command ID's to
use for the items in the recent tabs submenu.
On 2015/03/30 21:35:24, Peter Kasting wrote:
> Nit: ID's -> IDs (while you're here)

Done.

https://codereview.chromium.org/1005873012/diff/60001/chrome/browser/ui/views...
File chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc (left):

https://codereview.chromium.org/1005873012/diff/60001/chrome/browser/ui/views...
chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc:481: BuildMenu(node,
0, submenu, next_menu_id);
On 2015/03/30 21:35:24, Peter Kasting wrote:
> Just so I'm sure, the removal of this BuildMenu() call is what makes us not
> build the whole nested tree at creation time, right?

That's right.

https://codereview.chromium.org/1005873012/diff/60001/chrome/browser/ui/views...
File chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc (right):

https://codereview.chromium.org/1005873012/diff/60001/chrome/browser/ui/views...
chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc:350: if
(menu_id_to_node_map_.find(command) == menu_id_to_node_map_.end())
On 2015/03/30 21:35:24, Peter Kasting wrote:
> Nit: Shorter and slightly more efficient:
> 
>   auto iter = menu_id_to_node_map_.find(command);
>   if ((iter != menu_id_to_node_map_.end()) && iter->second->child_count() &&
>       !menu->GetSubmenu()->GetMenuItemCount())
>     BuildMenu(iter->second, 0, menu);
> 
> I would also be fine with pulling "iter->second" out into a named temp; I
mostly
> just figured there was no reason to effectively do a find() twice (one
> explicitly and once implicitly).

Done.

https://codereview.chromium.org/1005873012/diff/60001/chrome/browser/ui/views...
chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc:505: const
BookmarkNode* node = parent->GetChild(i);
On 2015/03/30 21:35:24, Peter Kasting wrote:
> Nit: Shorter, avoids violating the "don't handle DCHECK failure" rule, avoids
> any possible "uninitialized variable" warnings:
> 
>     const BookmarkNode* node = parent->GetChild(i);
>     DCHECK(node->is_folder() || node->is_url());
>     const gfx::ImageSkia* icon =
rb->GetImageSkiaNamed(IDR_BOOKMARK_BAR_FOLDER);
>     if (node->is_url()) {
>       const gfx::Image& image = GetBookmarkModel()->GetFavicon(node);
>       icon = image.IsEmpty() ? rb->GetImageSkiaNamed(IDR_DEFAULT_FAVICON)
>                              : image.ToImageSkia();
>     }
>     AddMenuToMaps(
>         menu->AppendSubMenuWithIcon(next_menu_id_++, node->GetTitle(), *icon),
>         node);

The calls to add the menus are slightly different, so this doesn't work. I
removed the else NOTREACHED though and went with the DCHECK.

https://codereview.chromium.org/1005873012/diff/60001/chrome/browser/ui/views...
File chrome/browser/ui/views/bookmarks/bookmark_menu_delegate_unittest.cc
(right):

https://codereview.chromium.org/1005873012/diff/60001/chrome/browser/ui/views...
chrome/browser/ui/views/bookmarks/bookmark_menu_delegate_unittest.cc:70: :
nullptr;
On 2015/03/30 21:35:24, Peter Kasting wrote:
> Nit: Shorter and more efficient (not that it matters):
> 
>     const auto& node_map = bookmark_menu_delegate_->menu_id_to_node_map_;
>     auto iter = node_map.find(menu->GetCommand());
>     return (iter == node_map.end()) ? nullptr : iter->second;

Done.

https://codereview.chromium.org/1005873012/diff/60001/chrome/browser/ui/views...
chrome/browser/ui/views/bookmarks/bookmark_menu_delegate_unittest.cc:146: // f1
should have loaded it's children.
On 2015/03/30 21:35:24, Peter Kasting wrote:
> Nit: its

Done.

https://codereview.chromium.org/1005873012/diff/60001/chrome/browser/ui/views...
chrome/browser/ui/views/bookmarks/bookmark_menu_delegate_unittest.cc:165: // F11
should have loaded it's single child (f11a).
On 2015/03/30 21:35:25, Peter Kasting wrote:
> Nit: its

Done.

https://codereview.chromium.org/1005873012/diff/60001/chrome/browser/ui/views...
File chrome/browser/ui/views/toolbar/wrench_menu.cc (right):

https://codereview.chromium.org/1005873012/diff/60001/chrome/browser/ui/views...
chrome/browser/ui/views/toolbar/wrench_menu.cc:94: return command_id >=
IDC_FIRST_BOOKMARK_MENU;
On 2015/03/30 21:35:25, Peter Kasting wrote:
> You should probably add a comment to where this value is defined saying no
> Wrench menu command IDs may ever be larger.

Done.

https://codereview.chromium.org/1005873012/diff/60001/chrome/browser/ui/views...
chrome/browser/ui/views/toolbar/wrench_menu.cc:1051:
bookmark_menu_delegate_.get()->WillShowMenu(menu);
On 2015/03/30 21:35:25, Peter Kasting wrote:
> Nit: .get() probably unnecessary

Done.

https://codereview.chromium.org/1005873012/diff/60001/chrome/browser/ui/views...
chrome/browser/ui/views/toolbar/wrench_menu.cc:1241: LOG(WARNING) <<
model->bookmark_bar_node()->GetTotalNodeCount();
On 2015/03/30 21:35:25, Peter Kasting wrote:
> Don't commit this

Done.

Powered by Google App Engine
This is Rietveld 408576698