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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/ime/input_method_log_collector.cc
diff --git a/ui/base/ime/input_method_log_collector.cc b/ui/base/ime/input_method_log_collector.cc
new file mode 100644
index 0000000000000000000000000000000000000000..daa3396fc0c1abdca3c0a9748eeff9e2a08255a3
--- /dev/null
+++ b/ui/base/ime/input_method_log_collector.cc
@@ -0,0 +1,56 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/base/ime/input_method_log_collector.h"
+
+#include <string.h>
+
+#include "base/debug/alias.h"
+#include "base/debug/dump_without_crashing.h"
+#include "base/macros.h"
+
+namespace {
+
+const size_t kMaxLogCount = 50;
+
+}
+
+namespace ui {
+
+InputMethodLogCollector::InputMethodLogCollector() {}
+
+InputMethodLogCollector::~InputMethodLogCollector() {}
+
+void InputMethodLogCollector::AddString(const char* str_val) {
+ if (logs_.size() >= kMaxLogCount)
+ logs_.erase(logs_.begin());
+ logs_.push_back(str_val);
+}
+
+void InputMethodLogCollector::AddBoolean(bool bool_val) {
+ AddString(bool_val ? "true" : "false");
+}
+
+void InputMethodLogCollector::DumpLogs() {
+ static int dump_times = 0;
+ if (dump_times > 5) {
+ ClearLogs();
+ return;
+ }
+ const char* logs_copy[kMaxLogCount];
+ size_t log_count = logs_.size();
+ for (size_t i = 0; i < log_count && i < arraysize(logs_copy); ++i)
+ logs_copy[i] = logs_[i];
+ base::debug::Alias(&log_count);
+ base::debug::Alias(&logs_copy);
+ base::debug::DumpWithoutCrashing();
+ dump_times++;
+ ClearLogs();
+}
+
+void InputMethodLogCollector::ClearLogs() {
+ logs_.clear();
+}
+
+} // namespace ui
« 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