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

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: Moved FriendlyString to errors.h and connection_to_host.h. Cleaned up connection_time_observer_unit… 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
« no previous file with comments | « no previous file | remoting/protocol/errors.h » ('j') | remoting/protocol/errors.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
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.
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // is set to false some data sent by the peers may be 62 // is set to false some data sent by the peers may be
58 // delayed. This is used to indicate in the UI when connection is 63 // delayed. This is used to indicate in the UI when connection is
59 // temporarily broken. 64 // temporarily broken.
60 virtual void OnConnectionReady(bool ready) = 0; 65 virtual void OnConnectionReady(bool ready) = 0;
61 66
62 // Called when the route type (direct vs. STUN vs. proxied) changes. 67 // Called when the route type (direct vs. STUN vs. proxied) changes.
63 virtual void OnRouteChanged(const std::string& channel_name, 68 virtual void OnRouteChanged(const std::string& channel_name,
64 const protocol::TransportRoute& route) = 0; 69 const protocol::TransportRoute& route) = 0;
65 }; 70 };
66 71
72 static const char* ConnectionStateToFriendlyString(State state) {
73 switch (state) {
74 RETURN_STRING_LITERAL(INITIALIZING);
75 RETURN_STRING_LITERAL(CONNECTING);
76 RETURN_STRING_LITERAL(AUTHENTICATED);
77 RETURN_STRING_LITERAL(CONNECTED);
78 RETURN_STRING_LITERAL(CLOSED);
79 RETURN_STRING_LITERAL(FAILED);
80 default:
81 LOG(ERROR) << "Unknown connection state: '" << state << "'";
82 return "UNKNOWN";
83 }
84 }
85
67 virtual ~ConnectionToHost() {} 86 virtual ~ConnectionToHost() {}
68 87
69 // Allows to set a custom protocol configuration (e.g. for tests). Cannot be 88 // Allows to set a custom protocol configuration (e.g. for tests). Cannot be
70 // called after Connect(). 89 // called after Connect().
71 virtual void set_candidate_config( 90 virtual void set_candidate_config(
72 scoped_ptr<CandidateSessionConfig> config) = 0; 91 scoped_ptr<CandidateSessionConfig> config) = 0;
73 92
74 // Set the stubs which will handle messages from the host. 93 // Set the stubs which will handle messages from the host.
75 // The caller must ensure that stubs out-live the connection. 94 // The caller must ensure that stubs out-live the connection.
76 // Unless otherwise specified, all stubs must be set before Connect() 95 // Unless otherwise specified, all stubs must be set before Connect()
(...skipping 26 matching lines...) Expand all
103 virtual InputStub* input_stub() = 0; 122 virtual InputStub* input_stub() = 0;
104 123
105 // Return the current state of ConnectionToHost. 124 // Return the current state of ConnectionToHost.
106 virtual State state() const = 0; 125 virtual State state() const = 0;
107 }; 126 };
108 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
« 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