| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/base/chromoting_event.h" | 5 #include "remoting/base/chromoting_event.h" |
| 6 | 6 |
| 7 #include "base/strings/stringize_macros.h" |
| 7 #include "base/sys_info.h" | 8 #include "base/sys_info.h" |
| 8 | 9 |
| 9 namespace remoting { | 10 namespace remoting { |
| 10 | 11 |
| 11 const char ChromotingEvent::kCaptureLatencyKey[] = "capture_latency"; | 12 const char ChromotingEvent::kCaptureLatencyKey[] = "capture_latency"; |
| 12 const char ChromotingEvent::kConnectionErrorKey[] = "connection_error"; | 13 const char ChromotingEvent::kConnectionErrorKey[] = "connection_error"; |
| 13 const char ChromotingEvent::kCpuKey[] = "cpu"; | 14 const char ChromotingEvent::kCpuKey[] = "cpu"; |
| 14 const char ChromotingEvent::kDecodeLatencyKey[] = "decode_latency"; | 15 const char ChromotingEvent::kDecodeLatencyKey[] = "decode_latency"; |
| 15 const char ChromotingEvent::kEncodeLatencyKey[] = "encode_latency"; | 16 const char ChromotingEvent::kEncodeLatencyKey[] = "encode_latency"; |
| 16 const char ChromotingEvent::kMaxCaptureLatencyKey[] = "max_capture_latency"; | 17 const char ChromotingEvent::kMaxCaptureLatencyKey[] = "max_capture_latency"; |
| 17 const char ChromotingEvent::kMaxDecodeLatencyKey[] = "max_decode_latency"; | 18 const char ChromotingEvent::kMaxDecodeLatencyKey[] = "max_decode_latency"; |
| 18 const char ChromotingEvent::kMaxEncodeLatencyKey[] = "max_encode_latency"; | 19 const char ChromotingEvent::kMaxEncodeLatencyKey[] = "max_encode_latency"; |
| 19 const char ChromotingEvent::kMaxRenderLatencyKey[] = "max_render_latency"; | 20 const char ChromotingEvent::kMaxRenderLatencyKey[] = "max_render_latency"; |
| 20 const char ChromotingEvent::kMaxRoundtripLatencyKey[] = "max_roundtrip_latency"; | 21 const char ChromotingEvent::kMaxRoundtripLatencyKey[] = "max_roundtrip_latency"; |
| 21 const char ChromotingEvent::kModeKey[] = "mode"; | 22 const char ChromotingEvent::kModeKey[] = "mode"; |
| 22 const char ChromotingEvent::kOsKey[] = "os"; | 23 const char ChromotingEvent::kOsKey[] = "os"; |
| 23 const char ChromotingEvent::kOsVersionKey[] = "os_version"; | 24 const char ChromotingEvent::kOsVersionKey[] = "os_version"; |
| 24 const char ChromotingEvent::kRenderLatencyKey[] = "render_latency"; | 25 const char ChromotingEvent::kRenderLatencyKey[] = "render_latency"; |
| 25 const char ChromotingEvent::kRoleKey[] = "role"; | 26 const char ChromotingEvent::kRoleKey[] = "role"; |
| 26 const char ChromotingEvent::kRoundtripLatencyKey[] = "roundtrip_latency"; | 27 const char ChromotingEvent::kRoundtripLatencyKey[] = "roundtrip_latency"; |
| 27 const char ChromotingEvent::kSessionDurationKey[] = "session_duration"; | 28 const char ChromotingEvent::kSessionDurationKey[] = "session_duration"; |
| 28 const char ChromotingEvent::kSessionIdKey[] = "session_id"; | 29 const char ChromotingEvent::kSessionIdKey[] = "session_id"; |
| 29 const char ChromotingEvent::kSessionStateKey[] = "session_state"; | 30 const char ChromotingEvent::kSessionStateKey[] = "session_state"; |
| 30 const char ChromotingEvent::kTypeKey[] = "type"; | 31 const char ChromotingEvent::kTypeKey[] = "type"; |
| 31 const char ChromotingEvent::kVideoBandwidthKey[] = "video_bandwidth"; | 32 const char ChromotingEvent::kVideoBandwidthKey[] = "video_bandwidth"; |
| 33 const char ChromotingEvent::kWebAppVersionKey[] = "webapp_version"; |
| 32 | 34 |
| 33 ChromotingEvent::ChromotingEvent() : values_map_(new base::DictionaryValue()) {} | 35 ChromotingEvent::ChromotingEvent() : values_map_(new base::DictionaryValue()) {} |
| 34 | 36 |
| 35 ChromotingEvent::ChromotingEvent(Type type) : ChromotingEvent() { | 37 ChromotingEvent::ChromotingEvent(Type type) : ChromotingEvent() { |
| 36 SetEnum(kTypeKey, type); | 38 SetEnum(kTypeKey, type); |
| 37 } | 39 } |
| 38 | 40 |
| 39 ChromotingEvent::ChromotingEvent(const ChromotingEvent& other) { | 41 ChromotingEvent::ChromotingEvent(const ChromotingEvent& other) { |
| 40 send_attempts_ = other.send_attempts_; | 42 send_attempts_ = other.send_attempts_; |
| 41 values_map_ = other.values_map_->CreateDeepCopy(); | 43 values_map_ = other.values_map_->CreateDeepCopy(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 values_map_->SetBoolean(key, value); | 77 values_map_->SetBoolean(key, value); |
| 76 } | 78 } |
| 77 | 79 |
| 78 void ChromotingEvent::SetDouble(const std::string& key, double value) { | 80 void ChromotingEvent::SetDouble(const std::string& key, double value) { |
| 79 values_map_->SetDouble(key, value); | 81 values_map_->SetDouble(key, value); |
| 80 } | 82 } |
| 81 | 83 |
| 82 void ChromotingEvent::AddSystemInfo() { | 84 void ChromotingEvent::AddSystemInfo() { |
| 83 SetString(kCpuKey, base::SysInfo::OperatingSystemArchitecture()); | 85 SetString(kCpuKey, base::SysInfo::OperatingSystemArchitecture()); |
| 84 SetString(kOsVersionKey, base::SysInfo::OperatingSystemVersion()); | 86 SetString(kOsVersionKey, base::SysInfo::OperatingSystemVersion()); |
| 85 std::string osName = base::SysInfo::OperatingSystemName(); | 87 SetString(kWebAppVersionKey, STRINGIZE(VERSION)); |
| 86 #if defined(OS_LINUX) | 88 #if defined(OS_LINUX) |
| 87 Os os = Os::CHROMOTING_LINUX; | 89 Os os = Os::CHROMOTING_LINUX; |
| 88 #elif defined(OS_CHROMEOS) | 90 #elif defined(OS_CHROMEOS) |
| 89 Os os = Os::CHROMOTING_CHROMEOS; | 91 Os os = Os::CHROMOTING_CHROMEOS; |
| 90 #elif defined(OS_MACOSX) | 92 #elif defined(OS_MACOSX) |
| 91 Os os = Os::CHROMOTING_MAC; | 93 Os os = Os::CHROMOTING_MAC; |
| 92 #elif defined(OS_WIN) | 94 #elif defined(OS_WIN) |
| 93 Os os = Os::CHROMOTING_WINDOWS; | 95 Os os = Os::CHROMOTING_WINDOWS; |
| 94 #elif defined(OS_ANDROID) | 96 #elif defined(OS_ANDROID) |
| 95 Os os = Os::CHROMOTING_ANDROID; | 97 Os os = Os::CHROMOTING_ANDROID; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 112 | 114 |
| 113 // static | 115 // static |
| 114 bool ChromotingEvent::IsEndOfSession(SessionState state) { | 116 bool ChromotingEvent::IsEndOfSession(SessionState state) { |
| 115 return state == SessionState::CLOSED || | 117 return state == SessionState::CLOSED || |
| 116 state == SessionState::CONNECTION_DROPPED || | 118 state == SessionState::CONNECTION_DROPPED || |
| 117 state == SessionState::CONNECTION_FAILED || | 119 state == SessionState::CONNECTION_FAILED || |
| 118 state == SessionState::CONNECTION_CANCELED; | 120 state == SessionState::CONNECTION_CANCELED; |
| 119 } | 121 } |
| 120 | 122 |
| 121 } // namespace remoting | 123 } // namespace remoting |
| OLD | NEW |