OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "remoting/client/plugin/chromoting_scriptable_object.h" | 5 #include "remoting/client/plugin/chromoting_scriptable_object.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
9 // TODO(wez): Remove this when crbug.com/86353 is complete. | 9 // TODO(wez): Remove this when crbug.com/86353 is complete. |
10 #include "ppapi/cpp/private/var_private.h" | 10 #include "ppapi/cpp/private/var_private.h" |
(...skipping 15 matching lines...) Expand all Loading... | |
26 const char kConnectionInfoUpdate[] = "connectionInfoUpdate"; | 26 const char kConnectionInfoUpdate[] = "connectionInfoUpdate"; |
27 const char kDebugInfo[] = "debugInfo"; | 27 const char kDebugInfo[] = "debugInfo"; |
28 const char kDesktopHeight[] = "desktopHeight"; | 28 const char kDesktopHeight[] = "desktopHeight"; |
29 const char kDesktopWidth[] = "desktopWidth"; | 29 const char kDesktopWidth[] = "desktopWidth"; |
30 const char kDesktopSizeUpdate[] = "desktopSizeUpdate"; | 30 const char kDesktopSizeUpdate[] = "desktopSizeUpdate"; |
31 const char kLoginChallenge[] = "loginChallenge"; | 31 const char kLoginChallenge[] = "loginChallenge"; |
32 const char kSendIq[] = "sendIq"; | 32 const char kSendIq[] = "sendIq"; |
33 const char kStatusAttribute[] = "status"; | 33 const char kStatusAttribute[] = "status"; |
34 const char kErrorAttribute[] = "error"; | 34 const char kErrorAttribute[] = "error"; |
35 const char kVideoBandwidthAttribute[] = "videoBandwidth"; | 35 const char kVideoBandwidthAttribute[] = "videoBandwidth"; |
36 const char kVideoFramerateAttribute[] = "videoFramerate"; | |
Wez
2011/10/21 18:01:43
videoFramerate -> videoFrameRate
| |
36 const char kVideoCaptureLatencyAttribute[] = "videoCaptureLatency"; | 37 const char kVideoCaptureLatencyAttribute[] = "videoCaptureLatency"; |
37 const char kVideoEncodeLatencyAttribute[] = "videoEncodeLatency"; | 38 const char kVideoEncodeLatencyAttribute[] = "videoEncodeLatency"; |
38 const char kVideoDecodeLatencyAttribute[] = "videoDecodeLatency"; | 39 const char kVideoDecodeLatencyAttribute[] = "videoDecodeLatency"; |
39 const char kVideoRenderLatencyAttribute[] = "videoRenderLatency"; | 40 const char kVideoRenderLatencyAttribute[] = "videoRenderLatency"; |
40 const char kRoundTripLatencyAttribute[] = "roundTripLatency"; | 41 const char kRoundTripLatencyAttribute[] = "roundTripLatency"; |
41 | 42 |
42 } // namespace | 43 } // namespace |
43 | 44 |
44 ChromotingScriptableObject::ChromotingScriptableObject( | 45 ChromotingScriptableObject::ChromotingScriptableObject( |
45 ChromotingInstance* instance, base::MessageLoopProxy* plugin_message_loop) | 46 ChromotingInstance* instance, base::MessageLoopProxy* plugin_message_loop) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 AddAttribute(kConnectionInfoUpdate, Var()); | 89 AddAttribute(kConnectionInfoUpdate, Var()); |
89 AddAttribute(kDebugInfo, Var()); | 90 AddAttribute(kDebugInfo, Var()); |
90 AddAttribute(kDesktopSizeUpdate, Var()); | 91 AddAttribute(kDesktopSizeUpdate, Var()); |
91 AddAttribute(kLoginChallenge, Var()); | 92 AddAttribute(kLoginChallenge, Var()); |
92 AddAttribute(kSendIq, Var()); | 93 AddAttribute(kSendIq, Var()); |
93 AddAttribute(kDesktopWidth, Var(0)); | 94 AddAttribute(kDesktopWidth, Var(0)); |
94 AddAttribute(kDesktopHeight, Var(0)); | 95 AddAttribute(kDesktopHeight, Var(0)); |
95 | 96 |
96 // Statistics. | 97 // Statistics. |
97 AddAttribute(kVideoBandwidthAttribute, Var()); | 98 AddAttribute(kVideoBandwidthAttribute, Var()); |
99 AddAttribute(kVideoFramerateAttribute, Var()); | |
98 AddAttribute(kVideoCaptureLatencyAttribute, Var()); | 100 AddAttribute(kVideoCaptureLatencyAttribute, Var()); |
99 AddAttribute(kVideoEncodeLatencyAttribute, Var()); | 101 AddAttribute(kVideoEncodeLatencyAttribute, Var()); |
100 AddAttribute(kVideoDecodeLatencyAttribute, Var()); | 102 AddAttribute(kVideoDecodeLatencyAttribute, Var()); |
101 AddAttribute(kVideoRenderLatencyAttribute, Var()); | 103 AddAttribute(kVideoRenderLatencyAttribute, Var()); |
102 AddAttribute(kRoundTripLatencyAttribute, Var()); | 104 AddAttribute(kRoundTripLatencyAttribute, Var()); |
103 | 105 |
104 AddMethod("connect", &ChromotingScriptableObject::DoConnect); | 106 AddMethod("connect", &ChromotingScriptableObject::DoConnect); |
105 AddMethod("disconnect", &ChromotingScriptableObject::DoDisconnect); | 107 AddMethod("disconnect", &ChromotingScriptableObject::DoDisconnect); |
106 AddMethod("submitLoginInfo", &ChromotingScriptableObject::DoSubmitLogin); | 108 AddMethod("submitLoginInfo", &ChromotingScriptableObject::DoSubmitLogin); |
107 AddMethod("setScaleToFit", &ChromotingScriptableObject::DoSetScaleToFit); | 109 AddMethod("setScaleToFit", &ChromotingScriptableObject::DoSetScaleToFit); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 // No property found. | 158 // No property found. |
157 if (iter == property_names_.end()) { | 159 if (iter == property_names_.end()) { |
158 return ScriptableObject::GetProperty(name, exception); | 160 return ScriptableObject::GetProperty(name, exception); |
159 } | 161 } |
160 | 162 |
161 // If this is a statistics attribute then return the value from | 163 // If this is a statistics attribute then return the value from |
162 // ChromotingStats structure. | 164 // ChromotingStats structure. |
163 ChromotingStats* stats = instance_->GetStats(); | 165 ChromotingStats* stats = instance_->GetStats(); |
164 if (name.AsString() == kVideoBandwidthAttribute) | 166 if (name.AsString() == kVideoBandwidthAttribute) |
165 return stats ? stats->video_bandwidth()->Rate() : Var(); | 167 return stats ? stats->video_bandwidth()->Rate() : Var(); |
168 if (name.AsString() == kVideoFramerateAttribute) | |
169 return stats ? stats->video_frame_rate()->Rate() : Var(); | |
166 if (name.AsString() == kVideoCaptureLatencyAttribute) | 170 if (name.AsString() == kVideoCaptureLatencyAttribute) |
167 return stats ? stats->video_capture_ms()->Average() : Var(); | 171 return stats ? stats->video_capture_ms()->Average() : Var(); |
168 if (name.AsString() == kVideoEncodeLatencyAttribute) | 172 if (name.AsString() == kVideoEncodeLatencyAttribute) |
169 return stats ? stats->video_encode_ms()->Average() : Var(); | 173 return stats ? stats->video_encode_ms()->Average() : Var(); |
170 if (name.AsString() == kVideoDecodeLatencyAttribute) | 174 if (name.AsString() == kVideoDecodeLatencyAttribute) |
171 return stats ? stats->video_decode_ms()->Average() : Var(); | 175 return stats ? stats->video_decode_ms()->Average() : Var(); |
172 if (name.AsString() == kVideoRenderLatencyAttribute) | 176 if (name.AsString() == kVideoRenderLatencyAttribute) |
173 return stats ? stats->video_paint_ms()->Average() : Var(); | 177 return stats ? stats->video_paint_ms()->Average() : Var(); |
174 if (name.AsString() == kRoundTripLatencyAttribute) | 178 if (name.AsString() == kRoundTripLatencyAttribute) |
175 return stats ? stats->round_trip_ms()->Average() : Var(); | 179 return stats ? stats->round_trip_ms()->Average() : Var(); |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
486 const std::vector<pp::Var>& args, pp::Var* exception) { | 490 const std::vector<pp::Var>& args, pp::Var* exception) { |
487 if (args.size() != 0) { | 491 if (args.size() != 0) { |
488 *exception = Var("Usage: DoReleaseAllKeys()"); | 492 *exception = Var("Usage: DoReleaseAllKeys()"); |
489 return Var(); | 493 return Var(); |
490 } | 494 } |
491 instance_->ReleaseAllKeys(); | 495 instance_->ReleaseAllKeys(); |
492 return Var(); | 496 return Var(); |
493 } | 497 } |
494 | 498 |
495 } // namespace remoting | 499 } // namespace remoting |
OLD | NEW |