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

Unified Diff: remoting/client/plugin/chromoting_scriptable_object.cc

Issue 6736009: Measure bandwidth for chromoting video channel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: done Created 9 years, 9 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 | « remoting/client/plugin/chromoting_scriptable_object.h ('k') | remoting/remoting.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/plugin/chromoting_scriptable_object.cc
diff --git a/remoting/client/plugin/chromoting_scriptable_object.cc b/remoting/client/plugin/chromoting_scriptable_object.cc
index 9a3e2c08e4e738a870566c3d30c416218909532c..64d6cd5761f4dd7de46b53be66e2e735b951a136 100644
--- a/remoting/client/plugin/chromoting_scriptable_object.cc
+++ b/remoting/client/plugin/chromoting_scriptable_object.cc
@@ -8,6 +8,7 @@
#include "base/stringprintf.h"
#include "ppapi/cpp/var.h"
#include "remoting/client/client_config.h"
+#include "remoting/client/chromoting_stats.h"
#include "remoting/client/plugin/chromoting_instance.h"
#include "remoting/client/plugin/pepper_xmpp_proxy.h"
@@ -26,6 +27,7 @@ const char kLoginChallenge[] = "loginChallenge";
const char kSendIq[] = "sendIq";
const char kQualityAttribute[] = "quality";
const char kStatusAttribute[] = "status";
+const char kVideoBandwidthAttribute[] = "videoBandwidth";
} // namespace
@@ -69,6 +71,9 @@ void ChromotingScriptableObject::Init() {
AddAttribute(kDesktopWidth, Var(0));
AddAttribute(kDesktopHeight, Var(0));
+ // Statistics.
+ AddAttribute(kVideoBandwidthAttribute, Var());
+
AddMethod("connect", &ChromotingScriptableObject::DoConnect);
AddMethod("connectSandboxed",
&ChromotingScriptableObject::DoConnectSandboxed);
@@ -126,6 +131,12 @@ Var ChromotingScriptableObject::GetProperty(const Var& name, Var* exception) {
return ScriptableObject::GetProperty(name, exception);
}
+ // If this is a statistics attribute then return the value from
+ // ChromotingStats structure.
+ if (name.AsString() == kVideoBandwidthAttribute) {
+ return instance_->GetStats()->video_bandwidth()->Rate();
+ }
+
// TODO(ajwong): This incorrectly return a null object if a function
// property is requested.
return properties_[iter->second].attribute;
« no previous file with comments | « remoting/client/plugin/chromoting_scriptable_object.h ('k') | remoting/remoting.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698