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

Issue 4162002: Reduce CPU usage for input method switching. (Closed)

Created:
10 years, 1 month ago by Yusuke Sato
Modified:
9 years, 7 months ago
Reviewers:
satorux1
CC:
chromium-reviews, nkostylev+cc_chromium.org, davemoore+watch_chromium.org, ben+cc_chromium.org
Visibility:
Public.

Description

Reduce CPU usage for input method switching. - Move GetNumActiveInputMethods call from input_method_menu_button.cc to input_method_library.cc so that the IBus function is called only once even when multiple Chrome windows are available. - Improved InputMethodMenu::InputMethodChanged so that only the first input method button would update Preferences. - Remove ImePropertiesChanged callback. It's obsolete. BUG=chromium-os:8553 TEST=manually. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=67973

Patch Set 1 #

Patch Set 2 : review #

Patch Set 3 : Removed IsFirstObserver based on a discussion with satoru #

Patch Set 4 : rebase #

Total comments: 10

Patch Set 5 : review fix #

Total comments: 4

Patch Set 6 : review fix #

Unified diffs Side-by-side diffs Delta from patch set Stats (+117 lines, -46 lines) Patch
M chrome/browser/chromeos/cros/input_method_library.h View 1 2 3 1 chunk +15 lines, -6 lines 0 comments Download
M chrome/browser/chromeos/cros/input_method_library.cc View 1 2 3 4 5 4 chunks +24 lines, -4 lines 0 comments Download
M chrome/browser/chromeos/login/keyboard_switch_menu.h View 1 2 3 4 1 chunk +4 lines, -2 lines 0 comments Download
M chrome/browser/chromeos/login/keyboard_switch_menu.cc View 1 2 3 4 1 chunk +4 lines, -2 lines 0 comments Download
M chrome/browser/chromeos/status/input_method_menu.h View 1 2 3 4 3 chunks +19 lines, -6 lines 0 comments Download
M chrome/browser/chromeos/status/input_method_menu.cc View 1 2 3 2 chunks +20 lines, -15 lines 0 comments Download
M chrome/browser/chromeos/status/input_method_menu_button.h View 1 2 3 4 1 chunk +4 lines, -2 lines 0 comments Download
M chrome/browser/chromeos/status/input_method_menu_button.cc View 1 2 3 4 4 chunks +27 lines, -9 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
Yusuke Sato
10 years, 1 month ago (2010-11-04 02:30:41 UTC) #1
Yusuke Sato
Satoru, can you review this?
10 years ago (2010-11-30 05:43:34 UTC) #2
satorux1
sorry for the belated response. http://codereview.chromium.org/4162002/diff/10001/chrome/browser/chromeos/cros/input_method_library.cc File chrome/browser/chromeos/cros/input_method_library.cc (right): http://codereview.chromium.org/4162002/diff/10001/chrome/browser/chromeos/cros/input_method_library.cc#newcode25 chrome/browser/chromeos/cros/input_method_library.cc:25: #define NOTIFY_FIRST_OBSERVER(ObserverType, observer_list, func) ...
10 years ago (2010-12-01 06:40:18 UTC) #3
Yusuke Sato
http://codereview.chromium.org/4162002/diff/10001/chrome/browser/chromeos/cros/input_method_library.cc File chrome/browser/chromeos/cros/input_method_library.cc (right): http://codereview.chromium.org/4162002/diff/10001/chrome/browser/chromeos/cros/input_method_library.cc#newcode25 chrome/browser/chromeos/cros/input_method_library.cc:25: #define NOTIFY_FIRST_OBSERVER(ObserverType, observer_list, func) \ On 2010/12/01 06:40:18, satorux1 ...
10 years ago (2010-12-01 07:36:41 UTC) #4
satorux1
LGTM http://codereview.chromium.org/4162002/diff/19001/chrome/browser/chromeos/cros/input_method_library.cc File chrome/browser/chromeos/cros/input_method_library.cc (right): http://codereview.chromium.org/4162002/diff/19001/chrome/browser/chromeos/cros/input_method_library.cc#newcode402 chrome/browser/chromeos/cros/input_method_library.cc:402: // observers to do so for performance reasons. ...
10 years ago (2010-12-01 07:56:47 UTC) #5
Yusuke Sato
10 years ago (2010-12-01 09:21:25 UTC) #6
http://codereview.chromium.org/4162002/diff/19001/chrome/browser/chromeos/cro...
File chrome/browser/chromeos/cros/input_method_library.cc (right):

http://codereview.chromium.org/4162002/diff/19001/chrome/browser/chromeos/cro...
chrome/browser/chromeos/cros/input_method_library.cc:402: // observers to do so
for performance reasons.
On 2010/12/01 07:56:47, satorux1 wrote:
> You could elaborate a bit more:
> 
> Ask the first observer to update preferences. We should not ask every observer
> to do so. Otherwise, we'll end up updating preferences many times, when many
> observers are attached (ex. many windows are opened), which is unnecessary and
> expensive.

Done.

http://codereview.chromium.org/4162002/diff/19001/chrome/browser/chromeos/cro...
chrome/browser/chromeos/cros/input_method_library.cc:404: Observer*
first_observer;
On 2010/12/01 07:56:47, satorux1 wrote:
> Uninitialized pointers annoy me. :) The following would be a bit nicer.
> 
> Observer* first_observer = it.GetNext();
> if (first_observer != NULL) {
>   ...

Done.

Powered by Google App Engine
This is Rietveld 408576698