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

Side by Side Diff: ui/base/ime/input_method_log_collector.cc

Issue 1566083002: Makes sure the keyboard typing isn't blocked when InputMethod::OnFocus() is not correctly called. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remote_input_method_win.cc is gone again. Created 4 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
« no previous file with comments | « ui/base/ime/input_method_log_collector.h ('k') | ui/base/ime/input_method_win.cc » ('j') | 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 2016 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 "ui/base/ime/input_method_log_collector.h"
6
7 #include <string.h>
8
9 #include "base/debug/alias.h"
10 #include "base/debug/dump_without_crashing.h"
11 #include "base/macros.h"
12
13 namespace {
14
15 const size_t kMaxLogCount = 50;
16
17 }
18
19 namespace ui {
20
21 InputMethodLogCollector::InputMethodLogCollector() {}
22
23 InputMethodLogCollector::~InputMethodLogCollector() {}
24
25 void InputMethodLogCollector::AddString(const char* str_val) {
26 if (logs_.size() >= kMaxLogCount)
27 logs_.erase(logs_.begin());
28 logs_.push_back(str_val);
29 }
30
31 void InputMethodLogCollector::AddBoolean(bool bool_val) {
32 AddString(bool_val ? "true" : "false");
33 }
34
35 void InputMethodLogCollector::DumpLogs() {
36 static int dump_times = 0;
37 if (dump_times > 5) {
38 ClearLogs();
39 return;
40 }
41 const char* logs_copy[kMaxLogCount];
42 size_t log_count = logs_.size();
43 for (size_t i = 0; i < log_count && i < arraysize(logs_copy); ++i)
44 logs_copy[i] = logs_[i];
45 base::debug::Alias(&log_count);
46 base::debug::Alias(&logs_copy);
47 base::debug::DumpWithoutCrashing();
48 dump_times++;
49 ClearLogs();
50 }
51
52 void InputMethodLogCollector::ClearLogs() {
53 logs_.clear();
54 }
55
56 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/ime/input_method_log_collector.h ('k') | ui/base/ime/input_method_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698