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

Unified Diff: remoting/client/log_to_server.cc

Issue 282063005: Pull out common code from client and host versions of ServerLogEntry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
Index: remoting/client/log_to_server.cc
diff --git a/remoting/client/log_to_server.cc b/remoting/client/log_to_server.cc
index c45ad386cb265294af42c52a783c18e60264d57c..a7f6e056870c942654692848bd25b0dd4ef699db 100644
--- a/remoting/client/log_to_server.cc
+++ b/remoting/client/log_to_server.cc
@@ -8,6 +8,7 @@
#include "base/rand_util.h"
#include "remoting/base/constants.h"
#include "remoting/client/chromoting_stats.h"
+#include "remoting/client/server_log_entry_client.h"
#include "remoting/jingle_glue/iq_sender.h"
#include "remoting/jingle_glue/signal_strategy.h"
#include "third_party/libjingle/source/talk/xmllite/xmlelement.h"
@@ -16,6 +17,7 @@
using buzz::QName;
using buzz::XmlElement;
using remoting::protocol::ConnectionToHost;
+using remoting::protocol::ServerLogEntry;
namespace {
@@ -69,8 +71,8 @@ void LogToServer::LogSessionStateChange(
DCHECK(CalledOnValidThread());
scoped_ptr<ServerLogEntry> entry(
- ServerLogEntry::MakeForSessionStateChange(state, error));
- entry->AddClientFields();
+ MakeLogEntryForSessionStateChange(state, error));
+ AddClientFieldsToLogEntry(entry.get());
entry->AddModeField(mode_);
MaybeExpireSessionId();
@@ -85,12 +87,13 @@ void LogToServer::LogSessionStateChange(
}
if (!session_id_.empty()) {
- entry->AddSessionId(session_id_);
+ AddSessionIdToLogEntry(entry.get(), session_id_);
}
// Maybe clear the session start time and log the session duration.
if (ShouldAddDuration(state) && !session_start_time_.is_null()) {
- entry->AddSessionDuration(base::TimeTicks::Now() - session_start_time_);
+ AddSessionDurationToLogEntry(entry.get(),
+ base::TimeTicks::Now() - session_start_time_);
}
if (IsEndOfSession(state)) {
@@ -106,11 +109,10 @@ void LogToServer::LogStatistics(ChromotingStats* statistics) {
MaybeExpireSessionId();
- scoped_ptr<ServerLogEntry> entry(
- ServerLogEntry::MakeForStatistics(statistics));
- entry->AddClientFields();
+ scoped_ptr<ServerLogEntry> entry(MakeLogEntryForStatistics(statistics));
+ AddClientFieldsToLogEntry(entry.get());
entry->AddModeField(mode_);
- entry->AddSessionId(session_id_);
+ AddSessionIdToLogEntry(entry.get(), session_id_);
Log(*entry.get());
}
@@ -174,8 +176,7 @@ void LogToServer::MaybeExpireSessionId() {
base::TimeDelta max_age = base::TimeDelta::FromDays(kMaxSessionIdAgeDays);
if (base::TimeTicks::Now() - session_id_generation_time_ > max_age) {
// Log the old session ID.
- scoped_ptr<ServerLogEntry> entry(
- ServerLogEntry::MakeForSessionIdOld(session_id_));
+ scoped_ptr<ServerLogEntry> entry(MakeLogEntryForSessionIdOld(session_id_));
entry->AddModeField(mode_);
Log(*entry.get());
@@ -183,7 +184,7 @@ void LogToServer::MaybeExpireSessionId() {
GenerateSessionId();
// Log the new session ID.
- entry = ServerLogEntry::MakeForSessionIdNew(session_id_);
+ entry = MakeLogEntryForSessionIdNew(session_id_);
entry->AddModeField(mode_);
Log(*entry.get());
}

Powered by Google App Engine
This is Rietveld 408576698