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

Unified Diff: remoting/protocol/connection_to_host_impl.cc

Issue 1238343002: Added ConnectionTimeObserver to calculate the times to authenticate and connect. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved ConnectionStateToFriendlyString to ConnectionToHostImpl and Added environment class to main. Created 5 years, 5 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/protocol/connection_to_host_impl.cc
diff --git a/remoting/protocol/connection_to_host_impl.cc b/remoting/protocol/connection_to_host_impl.cc
index f4cef0c125c8554833cd9af19595f8ff2681f9a8..aae5a31eacc70fc8f4111ccd0eddfcc66a247daf 100644
--- a/remoting/protocol/connection_to_host_impl.cc
+++ b/remoting/protocol/connection_to_host_impl.cc
@@ -25,6 +25,72 @@
namespace remoting {
namespace protocol {
+const char* ConnectionStateToFriendlyString(
+ remoting::protocol::ConnectionToHost::State state) {
+ switch (state) {
+ case remoting::protocol::ConnectionToHost::INITIALIZING:
Sergey Ulanov 2015/07/29 00:56:23 You can use macro like this to make this code shor
tonychun 2015/07/29 16:10:13 Done.
+ return "INITIALIZING";
+
+ case remoting::protocol::ConnectionToHost::CONNECTING:
+ return "CONNECTING";
+
+ case remoting::protocol::ConnectionToHost::AUTHENTICATED:
+ return "AUTHENTICATED";
+
+ case remoting::protocol::ConnectionToHost::CONNECTED:
+ return "CONNECTED";
+
+ case remoting::protocol::ConnectionToHost::CLOSED:
+ return "CLOSED";
+
+ case remoting::protocol::ConnectionToHost::FAILED:
+ return "FAILED";
+
+ default:
+ LOG(ERROR) << "Unknown connection state: '" << state << "'";
+ return "UNKNOWN";
+ }
+}
+
+const char* ProtocolErrorToFriendlyString(
+ remoting::protocol::ErrorCode error_code) {
+ switch (error_code) {
+ case remoting::protocol::OK:
+ return "NONE";
+
+ case remoting::protocol::PEER_IS_OFFLINE:
+ return "PEER_IS_OFFLINE";
+
+ case remoting::protocol::SESSION_REJECTED:
+ return "SESSION_REJECTED";
+
+ case remoting::protocol::AUTHENTICATION_FAILED:
+ return "AUTHENTICATION_FAILED";
+
+ case remoting::protocol::INCOMPATIBLE_PROTOCOL:
+ return "INCOMPATIBLE_PROTOCOL";
+
+ case remoting::protocol::HOST_OVERLOAD:
+ return "HOST_OVERLOAD";
+
+ case remoting::protocol::CHANNEL_CONNECTION_ERROR:
+ return "CHANNEL_CONNECTION_ERROR";
+
+ case remoting::protocol::SIGNALING_ERROR:
+ return "SIGNALING_ERROR";
+
+ case remoting::protocol::SIGNALING_TIMEOUT:
+ return "SIGNALING_TIMEOUT";
+
+ case remoting::protocol::UNKNOWN_ERROR:
+ return "UNKNOWN_ERROR";
+
+ default:
+ LOG(ERROR) << "Unrecognized error code: '" << error_code << "'";
+ return "UNKNOWN_ERROR";
+ }
+}
+
ConnectionToHostImpl::ConnectionToHostImpl()
: event_callback_(nullptr),
client_stub_(nullptr),

Powered by Google App Engine
This is Rietveld 408576698