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

Issue 7120004: Do not execute two or more setxkbmap commands in parallel. (Closed)

Created:
9 years, 6 months ago by Yusuke Sato
Modified:
9 years, 6 months ago
Reviewers:
satorux1, Daniel Kurtz
CC:
chromium-reviews, davemoore+watch_chromium.org
Visibility:
Public.

Description

Do not execute two or more setxkbmap commands in parallel. BUG=chromium-os:15516 TEST=checked the chrome log using --vmodule=xkeyboard=1. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=88104

Patch Set 1 #

Total comments: 4

Patch Set 2 : review fix, improved error handling #

Total comments: 4

Patch Set 3 : add more comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+42 lines, -12 lines) Patch
M chrome/browser/chromeos/input_method/xkeyboard.cc View 1 2 5 chunks +42 lines, -12 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
Yusuke Sato
9 years, 6 months ago (2011-06-07 02:19:54 UTC) #1
satorux1
http://codereview.chromium.org/7120004/diff/1/chrome/browser/chromeos/input_method/xkeyboard.cc File chrome/browser/chromeos/input_method/xkeyboard.cc (right): http://codereview.chromium.org/7120004/diff/1/chrome/browser/chromeos/input_method/xkeyboard.cc#newcode258 chrome/browser/chromeos/input_method/xkeyboard.cc:258: if (execute_queue_.size() == 1) { Checking the size here ...
9 years, 6 months ago (2011-06-07 03:19:27 UTC) #2
Daniel Kurtz
LGTM w/ tiny nit. http://codereview.chromium.org/7120004/diff/1/chrome/browser/chromeos/input_method/xkeyboard.cc File chrome/browser/chromeos/input_method/xkeyboard.cc (right): http://codereview.chromium.org/7120004/diff/1/chrome/browser/chromeos/input_method/xkeyboard.cc#newcode257 chrome/browser/chromeos/input_method/xkeyboard.cc:257: execute_queue_.push(layouts_to_set); Is layouts_to_set a collection ...
9 years, 6 months ago (2011-06-07 03:19:38 UTC) #3
Yusuke Sato
Added error handling code (for base::LaunchApp failure) as well. http://codereview.chromium.org/7120004/diff/1/chrome/browser/chromeos/input_method/xkeyboard.cc File chrome/browser/chromeos/input_method/xkeyboard.cc (right): http://codereview.chromium.org/7120004/diff/1/chrome/browser/chromeos/input_method/xkeyboard.cc#newcode257 chrome/browser/chromeos/input_method/xkeyboard.cc:257: ...
9 years, 6 months ago (2011-06-07 04:54:58 UTC) #4
Daniel Kurtz
LGTM. Please add to R12 and R13
9 years, 6 months ago (2011-06-07 05:15:26 UTC) #5
satorux1
http://codereview.chromium.org/7120004/diff/1002/chrome/browser/chromeos/input_method/xkeyboard.cc File chrome/browser/chromeos/input_method/xkeyboard.cc (right): http://codereview.chromium.org/7120004/diff/1002/chrome/browser/chromeos/input_method/xkeyboard.cc#newcode260 chrome/browser/chromeos/input_method/xkeyboard.cc:260: if (start_execution) { I thought we could move the ...
9 years, 6 months ago (2011-06-07 05:41:29 UTC) #6
Yusuke Sato
http://codereview.chromium.org/7120004/diff/1002/chrome/browser/chromeos/input_method/xkeyboard.cc File chrome/browser/chromeos/input_method/xkeyboard.cc (right): http://codereview.chromium.org/7120004/diff/1002/chrome/browser/chromeos/input_method/xkeyboard.cc#newcode260 chrome/browser/chromeos/input_method/xkeyboard.cc:260: if (start_execution) { I think it will not work ...
9 years, 6 months ago (2011-06-07 05:51:43 UTC) #7
satorux1
LGTM http://codereview.chromium.org/7120004/diff/1002/chrome/browser/chromeos/input_method/xkeyboard.cc File chrome/browser/chromeos/input_method/xkeyboard.cc (right): http://codereview.chromium.org/7120004/diff/1002/chrome/browser/chromeos/input_method/xkeyboard.cc#newcode260 chrome/browser/chromeos/input_method/xkeyboard.cc:260: if (start_execution) { Thank you for the explanation. ...
9 years, 6 months ago (2011-06-07 05:59:13 UTC) #8
Yusuke Sato
9 years, 6 months ago (2011-06-07 06:53:28 UTC) #9
submitting..

http://codereview.chromium.org/7120004/diff/1002/chrome/browser/chromeos/inpu...
File chrome/browser/chromeos/input_method/xkeyboard.cc (right):

http://codereview.chromium.org/7120004/diff/1002/chrome/browser/chromeos/inpu...
chrome/browser/chromeos/input_method/xkeyboard.cc:260: if (start_execution) {
On 2011/06/07 05:59:13, satorux1 wrote:
> Thank you for the explanation. The code wasn't obvious to me. Would be nice to
> add a comment why you are doing this here.
> 
> 
> On 2011/06/07 05:51:43, Yusuke Sato wrote:
> > I think it will not work if SetLayout() is rapidly called more than 3 times.
> > 
> > SetLayout(A);  // queue.size() == 1, call setxkbmap
> > SetLayout(B);  // queue.size() == 2, do not call setxkbmap since the size !=
1
> > SetLayout(C);  // queue.size() == 3, do not call setxkbmap since the size !=
1
> > OnSetLayoutFinish() for A; // queue.pop() is called first and queue.size()
> > becomes 2, the next setxkbmap will NOT be called since the size != 1
> > 
> > On 2011/06/07 05:41:29, satorux1 wrote:
> > > I thought we could move the queue management logic to
> > > MaybeExecuteSetLayoutCommand();
> > > 
> > > Something like below may be a bit cleaner.
> > > 
> > >   execute_queue_.push(layout_to_set);
> > >   MaybeExecuteSetLayoutCommand();
> > > 
> > > 
> > > void MaybeExecuteSetLayoutCommand() {
> > >   // We execute the setxkbmap command one at a time.
> > >   // OnSetLayoutFinish() dequeues and retries as needed.
> > >   if (execute_queue_.size() != 1)
> > >     return;
> > 
> 

Done.

Powered by Google App Engine
This is Rietveld 408576698