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

Unified Diff: remoting/client/jni/chromoting_jni_runtime.cc

Issue 2643483003: [Remoting Android] Refactor ClientTelemetryLogger (Closed)
Patch Set: PTAL Created 3 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 | « remoting/client/jni/chromoting_jni_runtime.h ('k') | remoting/client/jni/connect_to_host_info.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/jni/chromoting_jni_runtime.cc
diff --git a/remoting/client/jni/chromoting_jni_runtime.cc b/remoting/client/jni/chromoting_jni_runtime.cc
index 4ebbaf6dd3524fcaa9bc0d073674026ea157fb7c..1505e441aeba54c9e7dfe49bb957f38b6af6b0dc 100644
--- a/remoting/client/jni/chromoting_jni_runtime.cc
+++ b/remoting/client/jni/chromoting_jni_runtime.cc
@@ -49,7 +49,7 @@ static void LoadNative(JNIEnv* env, const JavaParamRef<jclass>& clazz) {
static void HandleAuthTokenOnNetworkThread(const std::string& token) {
ChromotingJniRuntime* runtime = remoting::ChromotingJniRuntime::GetInstance();
DCHECK(runtime->network_task_runner()->BelongsToCurrentThread());
- runtime->logger()->SetAuthToken(token);
+ runtime->GetLogWriter()->SetAuthToken(token);
}
static void OnAuthTokenFetched(JNIEnv* env,
@@ -110,6 +110,11 @@ ChromotingJniRuntime::~ChromotingJniRuntime() {
base::android::DetachFromVM();
}
+TelemetryLogWriter* ChromotingJniRuntime::GetLogWriter() {
+ DCHECK(runtime_->network_task_runner()->BelongsToCurrentThread());
+ return log_writer_.get();
+}
+
void ChromotingJniRuntime::FetchAuthToken() {
if (!ui_task_runner()->BelongsToCurrentThread()) {
ui_task_runner()->PostTask(
@@ -129,11 +134,10 @@ void ChromotingJniRuntime::DetachFromVmAndSignal(base::WaitableEvent* waiter) {
void ChromotingJniRuntime::StartLoggerOnNetworkThread() {
DCHECK(network_task_runner()->BelongsToCurrentThread());
- logger_.reset(new ClientTelemetryLogger(ChromotingEvent::Mode::ME2ME));
- logger_->Start(
- base::MakeUnique<ChromiumUrlRequestFactory>(runtime_->url_requester()),
- kTelemetryBaseUrl);
- logger_->SetAuthClosure(
+ log_writer_.reset(new TelemetryLogWriter(
+ kTelemetryBaseUrl,
+ base::MakeUnique<ChromiumUrlRequestFactory>(runtime_->url_requester())));
+ log_writer_->SetAuthClosure(
base::Bind(&ChromotingJniRuntime::FetchAuthToken,
base::Unretained(this)));
}
« no previous file with comments | « remoting/client/jni/chromoting_jni_runtime.h ('k') | remoting/client/jni/connect_to_host_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698