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

Issue 9994005: Separate handler initialization from page initialization (Closed)

Created:
8 years, 8 months ago by Tyler Breisacher (Chromium)
Modified:
8 years, 8 months ago
Reviewers:
Dan Beam, kevers, Evan Stade
CC:
chromium-reviews, arv (Not doing code reviews), achuithb
Visibility:
Public.

Description

Separate handler initialization from page initialization BUG=121741 TEST=no crashes

Patch Set 1 #

Patch Set 2 : take out CHECK()s #

Patch Set 3 : documentation comments #

Total comments: 3

Patch Set 4 : \n nits #

Total comments: 1

Patch Set 5 : estade review #

Total comments: 12

Patch Set 6 : dbeam review #

Total comments: 2

Patch Set 7 : scoped_ptr stuff #

Total comments: 1

Patch Set 8 : fixes for chromeos #

Total comments: 5

Patch Set 9 : rebase #

Patch Set 10 : InitializeHandlers later #

Total comments: 2

Patch Set 11 : document HandleInitializeHandlers #

Total comments: 1

Patch Set 12 : Don't init handlers twice #

Patch Set 13 : move anything that indirectly calls JS to InitializePage #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+66 lines, -122 lines) Patch
M chrome/browser/resources/options2/options_page.js View 1 2 3 4 5 2 chunks +1 line, -14 lines 0 comments Download
M chrome/browser/ui/webui/chromeos/proxy_settings_ui.h View 1 2 3 4 5 6 7 10 11 12 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc View 1 2 3 4 5 6 7 10 11 12 2 chunks +10 lines, -9 lines 0 comments Download
M chrome/browser/ui/webui/options2/autofill_options_handler2.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +4 lines, -4 lines 0 comments Download
M chrome/browser/ui/webui/options2/browser_options_handler2.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +9 lines, -7 lines 0 comments Download
M chrome/browser/ui/webui/options2/chromeos/bluetooth_options_handler2.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/ui/webui/options2/chromeos/core_chromeos_options_handler2.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/ui/webui/options2/chromeos/core_chromeos_options_handler2.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +1 line, -6 lines 0 comments Download
M chrome/browser/ui/webui/options2/content_settings_handler2.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/ui/webui/options2/content_settings_handler2.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +1 line, -3 lines 0 comments Download
M chrome/browser/ui/webui/options2/core_options_handler2.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +4 lines, -5 lines 0 comments Download
M chrome/browser/ui/webui/options2/core_options_handler2.cc View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +5 lines, -8 lines 0 comments Download
M chrome/browser/ui/webui/options2/handler_options_handler2.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/ui/webui/options2/handler_options_handler2.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -4 lines 0 comments Download
M chrome/browser/ui/webui/options2/home_page_overlay_handler2.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/webui/options2/home_page_overlay_handler2.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/webui/options2/import_data_handler2.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/ui/webui/options2/import_data_handler2.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +5 lines, -2 lines 0 comments Download
M chrome/browser/ui/webui/options2/manage_profile_handler2.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/ui/webui/options2/manage_profile_handler2.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -4 lines 0 comments Download
M chrome/browser/ui/webui/options2/options_ui2.h View 1 2 3 4 5 10 11 12 3 chunks +2 lines, -5 lines 0 comments Download
M chrome/browser/ui/webui/options2/options_ui2.cc View 1 2 3 4 5 6 7 8 9 10 11 12 5 chunks +8 lines, -30 lines 1 comment Download
M chrome/browser/ui/webui/options2/password_manager_handler2.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/webui/options2/password_manager_handler2.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/webui/options2/search_engine_manager_handler2.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +1 line, -6 lines 0 comments Download
M chrome/browser/ui/webui/options2/startup_pages_handler2.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +5 lines, -5 lines 0 comments Download

Messages

Total messages: 23 (0 generated)
Tyler Breisacher (Chromium)
See bug for more details.
8 years, 8 months ago (2012-04-05 17:54:04 UTC) #1
Dan Beam
http://codereview.chromium.org/9994005/diff/4001/chrome/browser/resources/options2/options.js File chrome/browser/resources/options2/options.js (right): http://codereview.chromium.org/9994005/diff/4001/chrome/browser/resources/options2/options.js#newcode245 chrome/browser/resources/options2/options.js:245: OptionsPage.reinitializeCore(); nit: no \n, possibly move above adding DOMContentLoaded, ...
8 years, 8 months ago (2012-04-05 17:58:34 UTC) #2
Evan Stade
http://codereview.chromium.org/9994005/diff/4002/chrome/browser/resources/options2/options.js File chrome/browser/resources/options2/options.js (right): http://codereview.chromium.org/9994005/diff/4002/chrome/browser/resources/options2/options.js#newcode245 chrome/browser/resources/options2/options.js:245: OptionsPage.reinitializeCore(); remove, call from C++ as discussed offline
8 years, 8 months ago (2012-04-05 20:41:02 UTC) #3
Tyler Breisacher (Chromium)
https://chromiumcodereview.appspot.com/9994005/diff/4003/chrome/browser/ui/webui/options2/options_ui2.cc File chrome/browser/ui/webui/options2/options_ui2.cc (right): https://chromiumcodereview.appspot.com/9994005/diff/4003/chrome/browser/ui/webui/options2/options_ui2.cc#newcode338 chrome/browser/ui/webui/options2/options_ui2.cc:338: web_ui()->CallJavascriptFunction("OptionsPage.reinitializeCore"); I'm not sure whether we still need this.
8 years, 8 months ago (2012-04-05 20:57:40 UTC) #4
Dan Beam
https://chromiumcodereview.appspot.com/9994005/diff/4003/chrome/browser/resources/options2/options_page.js File chrome/browser/resources/options2/options_page.js (right): https://chromiumcodereview.appspot.com/9994005/diff/4003/chrome/browser/resources/options2/options_page.js#newcode638 chrome/browser/resources/options2/options_page.js:638: OptionsPage.reinitializeCore = function() { And if we remove that ...
8 years, 8 months ago (2012-04-05 21:38:20 UTC) #5
Tyler Breisacher (Chromium)
https://chromiumcodereview.appspot.com/9994005/diff/4003/chrome/browser/ui/webui/options2/options_ui2.cc File chrome/browser/ui/webui/options2/options_ui2.cc (right): https://chromiumcodereview.appspot.com/9994005/diff/4003/chrome/browser/ui/webui/options2/options_ui2.cc#newcode401 chrome/browser/ui/webui/options2/options_ui2.cc:401: web_ui()->AddMessageHandler(handler.release()); On 2012/04/05 21:38:21, Dan Beam wrote: > seeing ...
8 years, 8 months ago (2012-04-05 22:56:16 UTC) #6
Dan Beam
https://chromiumcodereview.appspot.com/9994005/diff/4003/chrome/browser/ui/webui/options2/options_ui2.cc File chrome/browser/ui/webui/options2/options_ui2.cc (right): https://chromiumcodereview.appspot.com/9994005/diff/4003/chrome/browser/ui/webui/options2/options_ui2.cc#newcode401 chrome/browser/ui/webui/options2/options_ui2.cc:401: web_ui()->AddMessageHandler(handler.release()); On 2012/04/05 22:56:16, Tyler Breisacher wrote: > On ...
8 years, 8 months ago (2012-04-06 03:38:16 UTC) #7
Tyler Breisacher (Chromium)
https://chromiumcodereview.appspot.com/9994005/diff/4003/chrome/browser/ui/webui/options2/options_ui2.cc File chrome/browser/ui/webui/options2/options_ui2.cc (right): https://chromiumcodereview.appspot.com/9994005/diff/4003/chrome/browser/ui/webui/options2/options_ui2.cc#newcode401 chrome/browser/ui/webui/options2/options_ui2.cc:401: web_ui()->AddMessageHandler(handler.release()); It *should* jump out at us. We *are* ...
8 years, 8 months ago (2012-04-06 16:59:43 UTC) #8
Evan Stade
http://codereview.chromium.org/9994005/diff/4003/chrome/browser/ui/webui/options2/options_ui2.cc File chrome/browser/ui/webui/options2/options_ui2.cc (right): http://codereview.chromium.org/9994005/diff/4003/chrome/browser/ui/webui/options2/options_ui2.cc#newcode402 chrome/browser/ui/webui/options2/options_ui2.cc:402: handler_raw->GetLocalizedValues(localized_strings); yes, it would be fine to move this ...
8 years, 8 months ago (2012-04-06 22:14:30 UTC) #9
Evan Stade
On 2012/04/06 22:14:30, Evan Stade wrote: > http://codereview.chromium.org/9994005/diff/4003/chrome/browser/ui/webui/options2/options_ui2.cc > File chrome/browser/ui/webui/options2/options_ui2.cc (right): > > http://codereview.chromium.org/9994005/diff/4003/chrome/browser/ui/webui/options2/options_ui2.cc#newcode402 ...
8 years, 8 months ago (2012-04-06 22:16:25 UTC) #10
Evan Stade
lgtm
8 years, 8 months ago (2012-04-06 22:16:34 UTC) #11
Dan Beam
http://codereview.chromium.org/9994005/diff/9007/chrome/browser/ui/webui/options2/options_ui2.cc File chrome/browser/ui/webui/options2/options_ui2.cc (right): http://codereview.chromium.org/9994005/diff/9007/chrome/browser/ui/webui/options2/options_ui2.cc#newcode295 chrome/browser/ui/webui/options2/options_ui2.cc:295: DCHECK(!profile->IsOffTheRecord() || Profile::IsGuestSession()); did you try this on CrOs ...
8 years, 8 months ago (2012-04-06 22:47:06 UTC) #12
Tyler Breisacher (Chromium)
On 2012/04/06 22:47:06, Dan Beam wrote: > http://codereview.chromium.org/9994005/diff/9007/chrome/browser/ui/webui/options2/options_ui2.cc > File chrome/browser/ui/webui/options2/options_ui2.cc (right): > > http://codereview.chromium.org/9994005/diff/9007/chrome/browser/ui/webui/options2/options_ui2.cc#newcode295 ...
8 years, 8 months ago (2012-04-09 17:42:09 UTC) #13
Tyler Breisacher (Chromium)
http://codereview.chromium.org/9994005/diff/14001/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc File chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc (right): http://codereview.chromium.org/9994005/diff/14001/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc#newcode110 chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc:110: proxy_handler_->InitializePage(); If I'm not mistaken, both of these InitializePage() ...
8 years, 8 months ago (2012-04-09 18:19:28 UTC) #14
Dan Beam
> I'm not sure how to get a guest session in ChromeOS, but > I ...
8 years, 8 months ago (2012-04-09 20:02:58 UTC) #15
Dan Beam
http://codereview.chromium.org/9994005/diff/14001/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc File chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc (right): http://codereview.chromium.org/9994005/diff/14001/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc#newcode110 chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc:110: proxy_handler_->InitializePage(); On 2012/04/09 18:19:28, Tyler Breisacher wrote: > If ...
8 years, 8 months ago (2012-04-09 20:04:22 UTC) #16
Dan Beam
http://codereview.chromium.org/9994005/diff/14001/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc File chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc (right): http://codereview.chromium.org/9994005/diff/14001/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc#newcode94 chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc:94: proxy_tracker->UIMakeActiveNetworkCurrent(); If this is doing anything involving the page ...
8 years, 8 months ago (2012-04-09 20:13:24 UTC) #17
Tyler Breisacher (Chromium)
+kevers for chromeos and achuith to CC On 2012/04/09 20:02:58, Dan Beam wrote: > > ...
8 years, 8 months ago (2012-04-09 20:20:56 UTC) #18
Dan Beam
also, explain why you think this fixes the try issues https://chromiumcodereview.appspot.com/9994005/diff/25002/chrome/browser/ui/webui/options2/core_options_handler2.h File chrome/browser/ui/webui/options2/core_options_handler2.h (right): https://chromiumcodereview.appspot.com/9994005/diff/25002/chrome/browser/ui/webui/options2/core_options_handler2.h#newcode101 ...
8 years, 8 months ago (2012-04-10 04:38:43 UTC) #19
Tyler Breisacher (Chromium)
It looks like InitializeHandlers actually does cause the handlers to call some JavaScript functions. Usually ...
8 years, 8 months ago (2012-04-10 17:43:28 UTC) #20
Dan Beam
On 2012/04/10 17:43:28, Tyler Breisacher wrote: > It looks like InitializeHandlers actually does cause the ...
8 years, 8 months ago (2012-04-10 18:00:40 UTC) #21
kevers
http://codereview.chromium.org/9994005/diff/18007/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc File chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc (right): http://codereview.chromium.org/9994005/diff/18007/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc#newcode98 chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc:98: proxy_handler_->SetNetworkName(network_name); SetNetworkName is a no-op that is in the ...
8 years, 8 months ago (2012-04-10 18:06:30 UTC) #22
Tyler Breisacher (Chromium)
8 years, 8 months ago (2012-04-10 22:01:47 UTC) #23
For now, I've just moved everything that indirectly calls JavaScript from
InitializeHandler to InitializePage. As we discussed offline, this might not be
the ideal solution, but I think it's the simplest, and it's more foolproof than
checking whether the page is initialized before every JS call. The only huge
concern I have is that InitializePage may get called multiple times, but maybe
that's actually not a concern anymore:

http://codereview.chromium.org/9994005/diff/30001/chrome/browser/ui/webui/opt...
File chrome/browser/ui/webui/options2/options_ui2.cc (left):

http://codereview.chromium.org/9994005/diff/30001/chrome/browser/ui/webui/opt...
chrome/browser/ui/webui/options2/options_ui2.cc:334: void
OptionsUI::DidBecomeActiveForReusedRenderView() {
Since we took this out, does that mean it's no longer true that InitializePage
might get called multiple times?

Powered by Google App Engine
This is Rietveld 408576698