Chromium Code Reviews| Index: third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp |
| diff --git a/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp b/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp |
| index e6f33b1706fda173d0eed478d76ae41fc286d48b..1ab0b971d1ff769da0cfeec239519f229a66471e 100644 |
| --- a/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp |
| +++ b/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp |
| @@ -34,6 +34,7 @@ |
| #include "core/frame/LocalFrame.h" |
| #include "core/frame/Settings.h" |
| #include "core/html/TextControlElement.h" |
| +#include "platform/Histogram.h" |
| #include "platform/text/TextCheckerClient.h" |
| namespace blink { |
| @@ -125,6 +126,7 @@ SpellCheckRequester::SpellCheckRequester(LocalFrame& frame) |
| : frame_(&frame), |
| last_request_sequence_(0), |
| last_processed_sequence_(0), |
| + last_request_time_(0.0), |
| timer_to_process_queued_request_( |
| TaskRunnerHelper::Get(TaskType::kUnspecedTimer, &frame), |
| this, |
| @@ -154,6 +156,16 @@ void SpellCheckRequester::RequestCheckingFor(const EphemeralRange& range, |
| if (!request) |
| return; |
| + DEFINE_STATIC_LOCAL(CustomCountHistogram, |
| + spell_checker_request_interval_histogram, |
| + ("WebCore.SpellChecker.RequestInterval", 0, 10000, 50)); |
| + double current_request_time = MonotonicallyIncreasingTime(); |
|
yosin_UTC9
2017/05/12 04:33:34
nit: s/double/const double/
Xiaocheng
2017/05/12 18:35:14
Done.
|
| + if (request_num == 0 && last_request_time_ > 0) { |
| + double interval_ms = (current_request_time - last_request_time_) * 1000.0; |
|
yosin_UTC9
2017/05/12 04:33:34
nit: s/double/const double/
Xiaocheng
2017/05/12 18:35:14
Done.
|
| + spell_checker_request_interval_histogram.Count(interval_ms); |
| + } |
| + last_request_time_ = current_request_time; |
| + |
| DCHECK_EQ(request->Data().Sequence(), kUnrequestedTextCheckingSequence); |
| int sequence = ++last_request_sequence_; |
| if (sequence == kUnrequestedTextCheckingSequence) |