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

Unified Diff: remoting/protocol/connection_to_host.h

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 FriendlyString to errors.h and connection_to_host.h. Cleaned up connection_time_observer_unit… 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
« no previous file with comments | « no previous file | remoting/protocol/errors.h » ('j') | remoting/protocol/errors.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/connection_to_host.h
diff --git a/remoting/protocol/connection_to_host.h b/remoting/protocol/connection_to_host.h
index a20bd22605986474c53152c975dc089c8bd99b20..a5b08bc544aacf4f9d8df7f68c73ff39753ba508 100644
--- a/remoting/protocol/connection_to_host.h
+++ b/remoting/protocol/connection_to_host.h
@@ -8,10 +8,15 @@
#include <string>
#include "base/callback_forward.h"
+#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "remoting/protocol/errors.h"
+#define RETURN_STRING_LITERAL(x) \
+case x: \
+return #x;
joedow 2015/07/29 17:07:02 I'm personally not a fan of macros like this for a
tonychun 2015/07/29 18:30:33 Done.
+
namespace remoting {
class SignalStrategy;
@@ -64,6 +69,20 @@ class ConnectionToHost {
const protocol::TransportRoute& route) = 0;
};
+ static const char* ConnectionStateToFriendlyString(State state) {
+ switch (state) {
+ RETURN_STRING_LITERAL(INITIALIZING);
+ RETURN_STRING_LITERAL(CONNECTING);
+ RETURN_STRING_LITERAL(AUTHENTICATED);
+ RETURN_STRING_LITERAL(CONNECTED);
+ RETURN_STRING_LITERAL(CLOSED);
+ RETURN_STRING_LITERAL(FAILED);
+ default:
+ LOG(ERROR) << "Unknown connection state: '" << state << "'";
+ return "UNKNOWN";
+ }
+ }
+
virtual ~ConnectionToHost() {}
// Allows to set a custom protocol configuration (e.g. for tests). Cannot be
« no previous file with comments | « no previous file | remoting/protocol/errors.h » ('j') | remoting/protocol/errors.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698