OLD | NEW |
---|---|
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 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * Functions related to the 'client screen' for Chromoting. | 7 * Functions related to the 'client screen' for Chromoting. |
8 */ | 8 */ |
9 | 9 |
10 'use strict'; | 10 'use strict'; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 if (error == null) { | 88 if (error == null) { |
89 error = remoting.Error.UNEXPECTED; | 89 error = remoting.Error.UNEXPECTED; |
90 } | 90 } |
91 remoting.app.onError(error); | 91 remoting.app.onError(error); |
92 break; | 92 break; |
93 | 93 |
94 default: | 94 default: |
95 console.error('Unexpected client plugin state: ' + state.current); | 95 console.error('Unexpected client plugin state: ' + state.current); |
96 // This should only happen if the web-app and client plugin get out of | 96 // This should only happen if the web-app and client plugin get out of |
97 // sync, so MISSING_PLUGIN is a suitable error. | 97 // sync, so MISSING_PLUGIN is a suitable error. |
98 remoting.app.onError(remoting.Error.MISSING_PLUGIN); | 98 remoting.app.onError( |
99 remoting.Error.MISSING_PLUGIN); | |
Jamie
2015/03/02 18:28:09
No need for a new line here.
John Williams
2015/03/02 22:01:36
Done.
| |
99 break; | 100 break; |
100 } | 101 } |
101 | 102 |
102 remoting.clientSession.removeEventListener('stateChanged', | 103 remoting.clientSession.removeEventListener('stateChanged', |
103 onClientStateChange_); | 104 onClientStateChange_); |
104 remoting.clientSession.cleanup(); | 105 remoting.clientSession.cleanup(); |
105 remoting.clientSession = null; | 106 remoting.clientSession = null; |
106 remoting.desktopConnectedView = null; | 107 remoting.desktopConnectedView = null; |
107 } | 108 } |
108 | 109 |
109 /** | 110 /** |
110 * Timer callback to update the statistics panel. | 111 * Timer callback to update the statistics panel. |
111 */ | 112 */ |
112 function updateStatistics_() { | 113 function updateStatistics_() { |
113 if (!remoting.clientSession || | 114 if (!remoting.clientSession || |
114 remoting.clientSession.getState() != | 115 remoting.clientSession.getState() != |
115 remoting.ClientSession.State.CONNECTED) { | 116 remoting.ClientSession.State.CONNECTED) { |
116 return; | 117 return; |
117 } | 118 } |
118 var perfstats = remoting.clientSession.getPerfStats(); | 119 var perfstats = remoting.clientSession.getPerfStats(); |
119 remoting.stats.update(perfstats); | 120 remoting.stats.update(perfstats); |
120 remoting.clientSession.logStatistics(perfstats); | 121 remoting.clientSession.logStatistics(perfstats); |
121 // Update the stats once per second. | 122 // Update the stats once per second. |
122 window.setTimeout(updateStatistics_, 1000); | 123 window.setTimeout(updateStatistics_, 1000); |
123 } | 124 } |
OLD | NEW |