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

Unified Diff: ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h

Issue 817983002: ozone: xkb: Load keymaps on worker thread & cache them (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h
diff --git a/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h b/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h
index d7a98545d3a435c884854f069798f9b72bcc1b4d..6a3006ec963681663a07848e3dbd8a7668c01aeb 100644
--- a/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h
+++ b/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h
@@ -5,9 +5,11 @@
#ifndef UI_EVENTS_OZONE_LAYOUT_XKB_XKB_KEYBOARD_LAYOUT_ENGINE_H_
#define UI_EVENTS_OZONE_LAYOUT_XKB_XKB_KEYBOARD_LAYOUT_ENGINE_H_
+#include <map>
#include <xkbcommon/xkbcommon.h>
#include "base/containers/hash_tables.h"
+#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/string16.h"
#include "ui/events/ozone/layout/events_ozone_layout_export.h"
@@ -86,6 +88,26 @@ class EVENTS_OZONE_LAYOUT_EXPORT XkbKeyboardLayoutEngine
// so we need to trigger its cleanup.
scoped_ptr<xkb_context, XkbContextDeleter> xkb_context_;
scoped_ptr<xkb_state, XkbStateDeleter> xkb_state_;
+ std::map<std::string, xkb_keymap*> xkb_keymaps_;
+
+ // The class is used to load keymap files.
+ class XkbKeymapLoader : public base::RefCountedThreadSafe<XkbKeymapLoader> {
Shu Chen 2014/12/24 02:24:21 Usually we put inner class definition as the first
FengYuan 2014/12/26 02:42:20 Done.
+ public:
+ explicit XkbKeymapLoader(XkbKeyboardLayoutEngine* layout_engine);
+ void loadKeymap(const std::string& layout_name);
+
+ private:
+ friend class base::RefCountedThreadSafe<XkbKeymapLoader>;
+ ~XkbKeymapLoader() {}
+ XkbKeyboardLayoutEngine* layout_engine_;
+ struct xkb_rule_names* names;
+ // Uses xkb_keymap_new_from_names from libxkbcommon to load keymap file,
+ // And pushes this keymap file load into FILE thread.
+ void startLoadKeymap(const std::string& layout_name,
+ xkb_rule_names* names);
+ };
+
+ XkbKeymapLoader* keymap_loader_;
Shu Chen 2014/12/24 02:24:21 Use scoped_ptr
FengYuan 2014/12/26 02:42:20 Done.
};
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698