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

Side by Side 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: Made ToString methods into functions. Made code more readable and removed multiple defines in chromoting_instance.cc Created 5 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ 5 #ifndef REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_
6 #define REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ 6 #define REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/logging.h"
11 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
13 #include "remoting/protocol/errors.h" 14 #include "remoting/protocol/errors.h"
14 15
16 #define RETURN_STRING_LITERAL(x) \
17 case x: \
18 return #x;
19
15 namespace remoting { 20 namespace remoting {
16 21
17 class SignalStrategy; 22 class SignalStrategy;
18 23
19 namespace protocol { 24 namespace protocol {
20 25
21 class AudioStub; 26 class AudioStub;
22 class Authenticator; 27 class Authenticator;
23 class CandidateSessionConfig; 28 class CandidateSessionConfig;
24 class ClientStub; 29 class ClientStub;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 104
100 // Stubs for sending data to the host. 105 // Stubs for sending data to the host.
101 virtual ClipboardStub* clipboard_forwarder() = 0; 106 virtual ClipboardStub* clipboard_forwarder() = 0;
102 virtual HostStub* host_stub() = 0; 107 virtual HostStub* host_stub() = 0;
103 virtual InputStub* input_stub() = 0; 108 virtual InputStub* input_stub() = 0;
104 109
105 // Return the current state of ConnectionToHost. 110 // Return the current state of ConnectionToHost.
106 virtual State state() const = 0; 111 virtual State state() const = 0;
107 }; 112 };
108 113
114 inline const char* ConnectionStateToString(ConnectionToHost::State state) {
joedow 2015/07/29 20:09:31 I'd remove the inline here. This function is call
115 switch (state) {
116 RETURN_STRING_LITERAL(ConnectionToHost::INITIALIZING);
117 RETURN_STRING_LITERAL(ConnectionToHost::CONNECTING);
118 RETURN_STRING_LITERAL(ConnectionToHost::AUTHENTICATED);
119 RETURN_STRING_LITERAL(ConnectionToHost::CONNECTED);
120 RETURN_STRING_LITERAL(ConnectionToHost::CLOSED);
121 RETURN_STRING_LITERAL(ConnectionToHost::FAILED);
122 default:
123 LOG(ERROR) << "Unknown connection state: '" << state << "'";
124 return "ConnectionToHost::UNKNOWN";
125 }
126 }
127
109 } // namespace protocol 128 } // namespace protocol
110 } // namespace remoting 129 } // namespace remoting
111 130
112 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ 131 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698