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

Issue 817983002: ozone: xkb: Load keymaps on worker thread & cache them (Closed)

Created:
6 years ago by FengYuan
Modified:
5 years, 11 months ago
Reviewers:
Shu Chen, kpschoedel, spang
CC:
chromium-reviews, kalyank, tdresser+watch_chromium.org, jdduke+watch_chromium.org, ozone-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

ozone: xkb: Load keymaps on worker thread & cache them 1. Free xkb keymaps in the destructor. 2. Moves kemap load into another worker thread. 3. Adds keymap caching. BUG=430194 Committed: https://crrev.com/f0b38f78f146cedf336ac9ad0236f681833c7263 Cr-Commit-Position: refs/heads/master@{#309928}

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Total comments: 8

Patch Set 5 : #

Patch Set 6 : #

Patch Set 7 : #

Patch Set 8 : #

Patch Set 9 : Rebase #

Total comments: 10

Patch Set 10 : #

Patch Set 11 : #

Patch Set 12 : #

Patch Set 13 : #

Patch Set 14 : Adds unittests #

Total comments: 20

Patch Set 15 : Figured out Michael's comments #

Total comments: 15

Patch Set 16 : #

Total comments: 2

Patch Set 17 : #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+163 lines, -15 lines) Patch
M ui/events/ozone/layout/xkb/scoped_xkb.h View 1 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +4 lines, -0 lines 0 comments Download
M ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 4 chunks +22 lines, -0 lines 0 comments Download
M ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 7 chunks +66 lines, -15 lines 1 comment Download
M ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +71 lines, -0 lines 0 comments Download

Messages

Total messages: 28 (3 generated)
FengYuan
6 years ago (2014-12-23 08:16:01 UTC) #2
Shu Chen
https://codereview.chromium.org/817983002/diff/60001/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc File ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc (right): https://codereview.chromium.org/817983002/diff/60001/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc#newcode655 ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc:655: base::Unretained(this), base::Owned(this) https://codereview.chromium.org/817983002/diff/60001/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc#newcode662 ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc:662: const std::string& layout_name, xkb_rule_names* names) ...
6 years ago (2014-12-23 08:46:49 UTC) #3
FengYuan
https://codereview.chromium.org/817983002/diff/60001/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc File ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc (right): https://codereview.chromium.org/817983002/diff/60001/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc#newcode655 ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc:655: base::Unretained(this), On 2014/12/23 08:46:49, Shu Chen wrote: > base::Owned(this) ...
6 years ago (2014-12-23 15:24:58 UTC) #5
Shu Chen
https://codereview.chromium.org/817983002/diff/160001/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc File ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc (right): https://codereview.chromium.org/817983002/diff/160001/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc#newcode840 ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc:840: if (keymap) { Please move the below block to ...
6 years ago (2014-12-24 02:18:45 UTC) #6
Shu Chen
https://codereview.chromium.org/817983002/diff/160001/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h File ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h (right): https://codereview.chromium.org/817983002/diff/160001/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h#newcode94 ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h:94: class XkbKeymapLoader : public base::RefCountedThreadSafe<XkbKeymapLoader> { Usually we put ...
6 years ago (2014-12-24 02:24:21 UTC) #7
FengYuan
PTAL. https://codereview.chromium.org/817983002/diff/160001/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc File ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc (right): https://codereview.chromium.org/817983002/diff/160001/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc#newcode840 ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc:840: if (keymap) { On 2014/12/24 02:18:45, Shu Chen ...
5 years, 12 months ago (2014-12-26 02:42:20 UTC) #8
Shu Chen
lgtm Please update the CL description to reflect the changes.
5 years, 12 months ago (2014-12-26 02:50:26 UTC) #9
spang
We may want to look into shipping these as a resource bundle. https://codereview.chromium.org/817983002/diff/260001/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc File ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc ...
5 years, 11 months ago (2015-01-02 20:16:35 UTC) #10
FengYuan
Thanks for your review, PTAL :) https://codereview.chromium.org/817983002/diff/260001/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc File ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc (right): https://codereview.chromium.org/817983002/diff/260001/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc#newcode31 ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc:31: const char* us_keymap ...
5 years, 11 months ago (2015-01-03 17:57:04 UTC) #11
Shu Chen
Sorry, found the latest patch could be further improved. So not lgtm yet. https://codereview.chromium.org/817983002/diff/260001/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc File ...
5 years, 11 months ago (2015-01-04 01:43:17 UTC) #12
FengYuan
https://codereview.chromium.org/817983002/diff/260001/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc File ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc (right): https://codereview.chromium.org/817983002/diff/260001/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc#newcode31 ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc:31: const char* us_keymap = On 2015/01/04 01:43:16, Shu Chen ...
5 years, 11 months ago (2015-01-04 02:25:22 UTC) #13
Shu Chen
https://codereview.chromium.org/817983002/diff/140002/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc File ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc (right): https://codereview.chromium.org/817983002/diff/140002/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc#newcode726 ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc:726: xkb_keymaps_.push_back(entry); On 2015/01/04 02:25:22, FengYuan wrote: > On 2015/01/04 ...
5 years, 11 months ago (2015-01-04 02:30:59 UTC) #14
Shu Chen
https://codereview.chromium.org/817983002/diff/290001/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc File ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc (right): https://codereview.chromium.org/817983002/diff/290001/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc#newcode725 ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc:725: XkbKeymapEntry entry = {layout_name, keymap.get()}; This is potentially a ...
5 years, 11 months ago (2015-01-04 02:43:39 UTC) #15
FengYuan
Thanks for your review, PTAL :) https://codereview.chromium.org/817983002/diff/140002/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc File ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc (right): https://codereview.chromium.org/817983002/diff/140002/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc#newcode726 ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc:726: xkb_keymaps_.push_back(entry); On 2015/01/04 ...
5 years, 11 months ago (2015-01-04 02:58:42 UTC) #16
Shu Chen
lgtm
5 years, 11 months ago (2015-01-04 03:14:33 UTC) #17
Shu Chen
nit: the #4 of CL description should be removed.
5 years, 11 months ago (2015-01-04 03:54:33 UTC) #18
FengYuan
5 years, 11 months ago (2015-01-04 14:05:39 UTC) #19
spang
lgtm
5 years, 11 months ago (2015-01-05 17:56:26 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/817983002/310001
5 years, 11 months ago (2015-01-05 17:57:19 UTC) #22
spang
https://codereview.chromium.org/817983002/diff/140002/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc File ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc (right): https://codereview.chromium.org/817983002/diff/140002/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc#newcode676 ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc:676: for (const auto& entry : xkb_keymaps_) { On 2015/01/04 ...
5 years, 11 months ago (2015-01-05 18:17:21 UTC) #23
commit-bot: I haz the power
Committed patchset #17 (id:310001)
5 years, 11 months ago (2015-01-05 19:15:49 UTC) #24
commit-bot: I haz the power
Patchset 17 (id:??) landed as https://crrev.com/f0b38f78f146cedf336ac9ad0236f681833c7263 Cr-Commit-Position: refs/heads/master@{#309928}
5 years, 11 months ago (2015-01-05 19:16:40 UTC) #25
spang
https://codereview.chromium.org/817983002/diff/310001/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc File ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc (right): https://codereview.chromium.org/817983002/diff/310001/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc#newcode688 ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc:688: base::Unretained(xkb_context_.get()), ..oh dear I didn't look at this closely ...
5 years, 11 months ago (2015-01-06 17:35:50 UTC) #26
spang
A revert of this CL (patchset #17 id:310001) has been created in https://codereview.chromium.org/823633003/ by spang@chromium.org. ...
5 years, 11 months ago (2015-01-06 17:38:07 UTC) #27
kpschoedel
5 years, 11 months ago (2015-01-06 18:44:37 UTC) #28
Message was sent while issue was closed.
On 2015/01/06 17:35:50, spang wrote:
>
https://codereview.chromium.org/817983002/diff/310001/ui/events/ozone/layout/...
> File ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc (right):
> 
>
https://codereview.chromium.org/817983002/diff/310001/ui/events/ozone/layout/...
> ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc:688:
> base::Unretained(xkb_context_.get()),
> ..oh dear
>  
> I didn't look at this closely enough. It doesn't look like xkb_context is
thread
> safe. Even if it was, posting it to to the WorkerPool inside base::Unretained
is
> definitely not safe.

Maybe the way to go (based on the comments in <xkbcommon/xkbcommon.h>) is:
- loading thread creates its own xkb_context and loads the files
- loading thread calls xkb_keymap_get_as_string() and returns the string
- IO thread calls xkb_keymap_new_from_string()

Powered by Google App Engine
This is Rietveld 408576698