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

Side by Side Diff: components/spellcheck/browser/spellchecker_session_bridge_android.cc

Issue 2457873002: [Android] spellcheck: add latency UMA. (Closed)
Patch Set: Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/spellcheck/browser/spellchecker_session_bridge_android.h" 5 #include "components/spellcheck/browser/spellchecker_session_bridge_android.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
11 #include "base/android/jni_string.h" 11 #include "base/android/jni_string.h"
12 #include "base/metrics/histogram_macros.h"
13 #include "base/time/time.h"
12 #include "components/spellcheck/common/spellcheck_messages.h" 14 #include "components/spellcheck/common/spellcheck_messages.h"
13 #include "components/spellcheck/common/spellcheck_result.h" 15 #include "components/spellcheck/common/spellcheck_result.h"
14 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
15 #include "content/public/browser/render_process_host.h" 17 #include "content/public/browser/render_process_host.h"
16 #include "jni/SpellCheckerSessionBridge_jni.h" 18 #include "jni/SpellCheckerSessionBridge_jni.h"
17 19
18 using base::android::JavaParamRef; 20 using base::android::JavaParamRef;
19 21
20 SpellCheckerSessionBridge::SpellCheckerSessionBridge(int render_process_id) 22 SpellCheckerSessionBridge::SpellCheckerSessionBridge(int render_process_id)
21 : render_process_id_(render_process_id), 23 : render_process_id_(render_process_id),
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 active_request_.reset(); 117 active_request_.reset();
116 pending_request_.reset(); 118 pending_request_.reset();
117 119
118 if (!java_object_.is_null()) { 120 if (!java_object_.is_null()) {
119 Java_SpellCheckerSessionBridge_disconnect( 121 Java_SpellCheckerSessionBridge_disconnect(
120 base::android::AttachCurrentThread(), java_object_); 122 base::android::AttachCurrentThread(), java_object_);
121 java_object_.Reset(); 123 java_object_.Reset();
122 } 124 }
123 } 125 }
124 126
127 void SpellCheckerSessionBridge::RecordLatencyUMA(
128 JNIEnv* env,
129 const JavaParamRef<jobject>& jobj,
130 long latencyMs) {
131 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
132 DCHECK(latencyMs >= 0);
133 UMA_HISTOGRAM_TIMES("SpellCheck.Android.Latency",
134 base::TimeDelta::FromMilliseconds(latencyMs));
Ilya Sherman 2016/10/28 18:53:54 Hmm, why are you adding a native call for recordin
timvolodine 2016/11/01 17:14:23 yeey it does! (didn't realize it is available now,
135 }
136
125 SpellCheckerSessionBridge::SpellingRequest::SpellingRequest( 137 SpellCheckerSessionBridge::SpellingRequest::SpellingRequest(
126 int route_id, 138 int route_id,
127 int identifier, 139 int identifier,
128 const base::string16& text) 140 const base::string16& text)
129 : route_id(route_id), identifier(identifier), text(text) {} 141 : route_id(route_id), identifier(identifier), text(text) {}
130 142
131 SpellCheckerSessionBridge::SpellingRequest::~SpellingRequest() {} 143 SpellCheckerSessionBridge::SpellingRequest::~SpellingRequest() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698