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

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: 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/strings/string_number_conversions.h"
12
13 namespace ui {
14
15 InputMethodLogCollector::InputMethodLogCollector() {}
16
17 InputMethodLogCollector::~InputMethodLogCollector() {}
18
19 void InputMethodLogCollector::AddString(const char* str_val) {
20 if (logs_.size() >= 50)
eroman 2016/01/14 19:44:13 I suggest making 50 a constant, since it is re-use
Shu Chen 2016/01/16 04:15:45 Done.
21 logs_.erase(logs_.begin());
22 logs_.push_back(str_val);
23 }
24
25 void InputMethodLogCollector::AddBoolean(bool bool_val) {
26 AddString(bool_val ? "true" : "false");
27 }
28
29 void InputMethodLogCollector::AddNumber(int num_val) {
eroman 2016/01/14 19:44:13 AddNumber() is unused as far as I can tell, why in
Shu Chen 2016/01/16 04:15:45 Done. I've removed it.
30 number_strings_.push_back(base::IntToString(num_val));
31 AddString(number_strings_.back().c_str());
eroman 2016/01/14 19:44:13 This wouldn't really work since the backing memory
Shu Chen 2016/01/16 04:15:45 Thanks. I've removed the AddNumber method.
32 }
33
34 void InputMethodLogCollector::DumpLogs() {
35 static int dump_times = 0;
36 if (dump_times > 5) {
37 ClearLogs();
38 return;
39 }
40 const char* logs_copy[50];
41 size_t log_count = logs_.size();
42 for (size_t i = 0; i < log_count; ++i)
eroman 2016/01/14 19:44:13 To be extra safe I suggest writing it as "i < log_
Shu Chen 2016/01/16 04:15:46 Done.
43 logs_copy[i] = logs_[i];
44 base::debug::Alias(&log_count);
45 base::debug::Alias(&logs_copy);
46 base::debug::DumpWithoutCrashing();
47 dump_times++;
48 ClearLogs();
49 }
50
51 void InputMethodLogCollector::ClearLogs() {
52 number_strings_.clear();
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