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

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

Issue 6902011: Cope gracefully with scripts querying stats before client has started. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nit-picked. Created 9 years, 8 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_instance.cc ('k') | no next file » | 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 e2b5fe9b10c966809b251f9d8b7575fb00409613..e2c4126a8b890eb13b1d2411b815c468f98a4b48 100644
--- a/remoting/client/plugin/chromoting_scriptable_object.cc
+++ b/remoting/client/plugin/chromoting_scriptable_object.cc
@@ -142,16 +142,17 @@ Var ChromotingScriptableObject::GetProperty(const Var& name, Var* exception) {
// If this is a statistics attribute then return the value from
// ChromotingStats structure.
+ ChromotingStats* stats = instance_->GetStats();
if (name.AsString() == kVideoBandwidthAttribute)
- return instance_->GetStats()->video_bandwidth()->Rate();
+ return stats ? stats->video_bandwidth()->Rate() : Var();
if (name.AsString() == kVideoCaptureLatencyAttribute)
- return instance_->GetStats()->video_capture_ms()->Average();
+ return stats ? stats->video_capture_ms()->Average() : Var();
if (name.AsString() == kVideoEncodeLatencyAttribute)
- return instance_->GetStats()->video_encode_ms()->Average();
+ return stats ? stats->video_encode_ms()->Average() : Var();
if (name.AsString() == kVideoDecodeLatencyAttribute)
- return instance_->GetStats()->video_decode_ms()->Average();
+ return stats ? stats->video_decode_ms()->Average() : Var();
if (name.AsString() == kVideoRenderLatencyAttribute)
- return instance_->GetStats()->video_paint_ms()->Average();
+ return stats ? stats->video_paint_ms()->Average() : Var();
// TODO(ajwong): This incorrectly return a null object if a function
// property is requested.
« no previous file with comments | « remoting/client/plugin/chromoting_instance.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698