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

Side by Side Diff: chromeos/ime/ibus_bridge.cc

Issue 11956041: Introduce IBusBridge for ibus-less implementation. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 11 months 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 unified diff | Download patch
« chromeos/ime/ibus_bridge.h ('K') | « chromeos/ime/ibus_bridge.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chromeos/ime/ibus_bridge.h"
6
7 #include "base/logging.h"
8 #include "base/threading/thread_local_storage.h"
9
10 namespace chromeos {
11
12 namespace {
13
14 // Thread local storage for IBusBridge.
15 base::ThreadLocalStorage::StaticSlot tls_ibus_bridge = TLS_INITIALIZER;
16
17 // Handles TLS finalization.
18 void Finalize(void* data) {
19 IBusBridge* bridge = static_cast<IBusBridge*>(data);
20 delete bridge;
21 }
22
23 } // namespace
24
25 ///////////////////////////////////////////////////////////////////////////////
26 // IBusBridge
27
28 IBusBridge::IBusBridge()
29 : input_context_handler_(NULL),
30 engine_handler_(NULL),
31 candidate_window_handler_(NULL),
32 panel_handler_(NULL) {
33 }
34
35 // static
36 void IBusBridge::Initialize() {
37 tls_ibus_bridge.Initialize(Finalize);
38 IBusBridge* bridge = new IBusBridge();
39 tls_ibus_bridge.Set(bridge);
40 }
41
42 // static
43 IBusBridge* GetInstance() {
44 if (!tls_ibus_bridge.initialized())
45 return NULL;
46 return static_cast<IBusBridge*>(tls_ibus_bridge.Get());
47 }
48
49 } // namespace chromeos
OLDNEW
« chromeos/ime/ibus_bridge.h ('K') | « chromeos/ime/ibus_bridge.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698