Linux: Fix a wide range of crashes resulting from a very bad interaction of our dynamic menu-building code (mostly used by bookmarks, but also by some extension menus) with libdbusmenu-gtk as used in Ubuntu 12.04 for global menu support.
Linux: Fix a wide range of crashes resulting from a very bad interaction of
our dynamic menu-building code (mostly used by bookmarks, but also by some
extension menus) with libdbusmenu-gtk as used in Ubuntu 12.04 for global menu
support.

Basically, the problem is that it loads itself into our address space, and
shows and hides menus in ways that can't be triggered through normal user
interaction. It does this on purpose to get applications that build menus on
demand to do so; unfortunately, it doesn't work very well when the menus are
also torn down when hidden, especially the way we were doing it.

This CL changes how we tear down menus when hidden to avoid getting into loops
where menu changes are detected causing menus to be shown again, and is more
robust in the face of event orderings that don't normally occur.

BUG=131974,124110,128994
Review URL: https://codereview.chromium.org/10966043

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@158316 0039d316-1c4b-4281-b951-d872f2087c98

ondra-novak/chromium.src,Fireblend/chromium-crosswalk,ondra-novak/chromium.src,krieger-od/nwjs_chromium.src,Jonekee/chromium.src,M4sse/chromium.src,junmin-zhu/chromium-rivertrail,pozdnyakov/chromium-crosswalk,hujiajie/pa-chromium,axinging/chromium-crosswalk,anirudhSK/chromium,anirudhSK/chromium,Chilledheart/chromium,patrickm/chromium.src,Jonekee/chromium.src,TheTypoMaster/chromium-crosswalk,Pluto-tv/chromium-crosswalk,markYoungH/chromium.src,timopulkkinen/BubbleFish,axinging/chromium-crosswalk,zcbenz/cefode-chromium,anirudhSK/chromium,hujiajie/pa-chromium,timopulkkinen/BubbleFish,junmin-zhu/chromium-rivertrail,dednal/chromium.src,hujiajie/pa-chromium,hgl888/chromium-crosswalk,bright-sparks/chromium-spacewalk,anirudhSK/chromium,bright-sparks/chromium-spacewalk,dushu1203/chromium.src,mogoweb/chromium-crosswalk,jaruba/chromium.src,hgl888/chromium-crosswalk-efl,patrickm/chromium.src,PeterWangIntel/chromium-crosswalk,nacl-webkit/chrome_deps,PeterWangIntel/chromium-crosswalk,junmin-zhu/chromium-rivertrail,ChromiumWebApps/chromium,dushu1203/chromium.src,Chilledheart/chromium,markYoungH/chromium.src,Pluto-tv/chromium-crosswalk,ondra-novak/chromium.src,dushu1203/chromium.src,krieger-od/nwjs_chromium.src,Pluto-tv/chromium-crosswalk,timopulkkinen/BubbleFish,timopulkkinen/BubbleFish,mogoweb/chromium-crosswalk,pozdnyakov/chromium-crosswalk,krieger-od/nwjs_chromium.src,ltilve/chromium,dushu1203/chromium.src,timopulkkinen/BubbleFish,markYoungH/chromium.src,hgl888/chromium-crosswalk,bright-sparks/chromium-spacewalk,zcbenz/cefode-chromium,ChromiumWebApps/chromium,littlstar/chromium.src,Jonekee/chromium.src,TheTypoMaster/chromium-crosswalk,chuan9/chromium-crosswalk,Chilledheart/chromium,Jonekee/chromium.src,markYoungH/chromium.src,fujunwei/chromium-crosswalk,axinging/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,M4sse/chromium.src,axinging/chromium-crosswalk,junmin-zhu/chromium-rivertrail,ChromiumWebApps/chromium,mohamed--abdel-maksoud/chromium.src,mohamed--abdel-maksoud/chromium.src,mohamed--abdel-maksoud/chromium.src,chuan9/chromium-crosswalk,patrickm/chromium.src,chuan9/chromium-crosswalk,markYoungH/chromium.src,ChromiumWebApps/chromium,Fireblend/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,bright-sparks/chromium-spacewalk,patrickm/chromium.src,bright-sparks/chromium-spacewalk,mogoweb/chromium-crosswalk,pozdnyakov/chromium-crosswalk,hgl888/chromium-crosswalk-efl,jaruba/chromium.src,dushu1203/chromium.src,patrickm/chromium.src,zcbenz/cefode-chromium,krieger-od/nwjs_chromium.src,jaruba/chromium.src,ltilve/chromium,Pluto-tv/chromium-crosswalk,hgl888/chromium-crosswalk-efl,Jonekee/chromium.src,anirudhSK/chromium,bright-sparks/chromium-spacewalk,hgl888/chromium-crosswalk-efl,TheTypoMaster/chromium-crosswalk,dednal/chromium.src,ChromiumWebApps/chromium,axinging/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,zcbenz/cefode-chromium,TheTypoMaster/chromium-crosswalk,hgl888/chromium-crosswalk-efl,PeterWangIntel/chromium-crosswalk,dednal/chromium.src,dednal/chromium.src,ondra-novak/chromium.src,hgl888/chromium-crosswalk,patrickm/chromium.src,dushu1203/chromium.src,littlstar/chromium.src,ChromiumWebApps/chromium,markYoungH/chromium.src,fujunwei/chromium-crosswalk,axinging/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,mohamed--abdel-maksoud/chromium.src,hgl888/chromium-crosswalk-efl,junmin-zhu/chromium-rivertrail,PeterWangIntel/chromium-crosswalk,hgl888/chromium-crosswalk,M4sse/chromium.src,Just-D/chromium-1,krieger-od/nwjs_chromium.src,mohamed--abdel-maksoud/chromium.src,Jonekee/chromium.src,zcbenz/cefode-chromium,axinging/chromium-crosswalk,Chilledheart/chromium,pozdnyakov/chromium-crosswalk,dednal/chromium.src,hgl888/chromium-crosswalk,Pluto-tv/chromium-crosswalk,Jonekee/chromium.src,mogoweb/chromium-crosswalk,axinging/chromium-crosswalk,fujunwei/chromium-crosswalk,ChromiumWebApps/chromium,krieger-od/nwjs_chromium.src,patrickm/chromium.src,krieger-od/nwjs_chromium.src,anirudhSK/chromium,Fireblend/chromium-crosswalk,dushu1203/chromium.src,hgl888/chromium-crosswalk,hgl888/chromium-crosswalk,timopulkkinen/BubbleFish,Chilledheart/chromium,zcbenz/cefode-chromium,TheTypoMaster/chromium-crosswalk,timopulkkinen/BubbleFish,Just-D/chromium-1,M4sse/chromium.src,Just-D/chromium-1,mohamed--abdel-maksoud/chromium.src,mogoweb/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,ChromiumWebApps/chromium,chuan9/chromium-crosswalk,nacl-webkit/chrome_deps,dushu1203/chromium.src,ChromiumWebApps/chromium,crosswalk-project/chromium-crosswalk-efl,crosswalk-project/chromium-crosswalk-efl,dednal/chromium.src,Pluto-tv/chromium-crosswalk,anirudhSK/chromium,zcbenz/cefode-chromium,Pluto-tv/chromium-crosswalk,fujunwei/chromium-crosswalk,markYoungH/chromium.src,nacl-webkit/chrome_deps,dushu1203/chromium.src,chuan9/chromium-crosswalk,krieger-od/nwjs_chromium.src,ltilve/chromium,jaruba/chromium.src,Just-D/chromium-1,ltilve/chromium,Fireblend/chromium-crosswalk,dushu1203/chromium.src,jaruba/chromium.src,mohamed--abdel-maksoud/chromium.src,ltilve/chromium,hgl888/chromium-crosswalk-efl,ltilve/chromium,PeterWangIntel/chromium-crosswalk,pozdnyakov/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,ChromiumWebApps/chromium,bright-sparks/chromium-spacewalk,Fireblend/chromium-crosswalk,markYoungH/chromium.src,crosswalk-project/chromium-crosswalk-efl,mogoweb/chromium-crosswalk,nacl-webkit/chrome_deps,markYoungH/chromium.src,mohamed--abdel-maksoud/chromium.src,Chilledheart/chromium,pozdnyakov/chromium-crosswalk,hgl888/chromium-crosswalk-efl,hujiajie/pa-chromium,M4sse/chromium.src,junmin-zhu/chromium-rivertrail,patrickm/chromium.src,zcbenz/cefode-chromium,junmin-zhu/chromium-rivertrail,krieger-od/nwjs_chromium.src,mohamed--abdel-maksoud/chromium.src,fujunwei/chromium-crosswalk,ChromiumWebApps/chromium,fujunwei/chromium-crosswalk,jaruba/chromium.src,bright-sparks/chromium-spacewalk,Fireblend/chromium-crosswalk,M4sse/chromium.src,markYoungH/chromium.src,Chilledheart/chromium,chuan9/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,fujunwei/chromium-crosswalk,Pluto-tv/chromium-crosswalk,hujiajie/pa-chromium,zcbenz/cefode-chromium,hujiajie/pa-chromium,mogoweb/chromium-crosswalk,ltilve/chromium,Fireblend/chromium-crosswalk,hgl888/chromium-crosswalk-efl,dednal/chromium.src,dednal/chromium.src,Chilledheart/chromium,pozdnyakov/chromium-crosswalk,markYoungH/chromium.src,ChromiumWebApps/chromium,TheTypoMaster/chromium-crosswalk,anirudhSK/chromium,Jonekee/chromium.src,junmin-zhu/chromium-rivertrail,littlstar/chromium.src,junmin-zhu/chromium-rivertrail,nacl-webkit/chrome_deps,ondra-novak/chromium.src,jaruba/chromium.src,patrickm/chromium.src,nacl-webkit/chrome_deps,Jonekee/chromium.src,hujiajie/pa-chromium,mohamed--abdel-maksoud/chromium.src,bright-sparks/chromium-spacewalk,axinging/chromium-crosswalk,fujunwei/chromium-crosswalk,Just-D/chromium-1,pozdnyakov/chromium-crosswalk,anirudhSK/chromium,nacl-webkit/chrome_deps,junmin-zhu/chromium-rivertrail,jaruba/chromium.src,fujunwei/chromium-crosswalk,chuan9/chromium-crosswalk,M4sse/chromium.src,mogoweb/chromium-crosswalk,M4sse/chromium.src,hujiajie/pa-chromium,Fireblend/chromium-crosswalk,Chilledheart/chromium,PeterWangIntel/chromium-crosswalk,timopulkkinen/BubbleFish,littlstar/chromium.src,hujiajie/pa-chromium,littlstar/chromium.src,chuan9/chromium-crosswalk,Fireblend/chromium-crosswalk,zcbenz/cefode-chromium,hgl888/chromium-crosswalk,junmin-zhu/chromium-rivertrail,PeterWangIntel/chromium-crosswalk,M4sse/chromium.src,M4sse/chromium.src,krieger-od/nwjs_chromium.src,ltilve/chromium,anirudhSK/chromium,Just-D/chromium-1,nacl-webkit/chrome_deps,krieger-od/nwjs_chromium.src,TheTypoMaster/chromium-crosswalk,ltilve/chromium,M4sse/chromium.src,Just-D/chromium-1,ondra-novak/chromium.src,jaruba/chromium.src,axinging/chromium-crosswalk,ondra-novak/chromium.src,chuan9/chromium-crosswalk,hujiajie/pa-chromium,crosswalk-project/chromium-crosswalk-efl,ondra-novak/chromium.src,anirudhSK/chromium,timopulkkinen/BubbleFish,dednal/chromium.src,Jonekee/chromium.src,crosswalk-project/chromium-crosswalk-efl,Just-D/chromium-1,timopulkkinen/BubbleFish,pozdnyakov/chromium-crosswalk,pozdnyakov/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,axinging/chromium-crosswalk,dushu1203/chromium.src,dednal/chromium.src,littlstar/chromium.src,nacl-webkit/chrome_deps,anirudhSK/chromium,nacl-webkit/chrome_deps,Pluto-tv/chromium-crosswalk,littlstar/chromium.src,zcbenz/cefode-chromium,Jonekee/chromium.src,timopulkkinen/BubbleFish,jaruba/chromium.src,pozdnyakov/chromium-crosswalk,nacl-webkit/chrome_deps,crosswalk-project/chromium-crosswalk-efl,Just-D/chromium-1,hujiajie/pa-chromium,ondra-novak/chromium.src,hgl888/chromium-crosswalk,jaruba/chromium.src,mogoweb/chromium-crosswalk,dednal/chromium.src,hgl888/chromium-crosswalk-efl,mogoweb/chromium-crosswalk,littlstar/chromium.src