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

Side by Side Diff: remoting/base/chromoting_event.cc

Issue 1972793002: TelemetryLogWriter cleanups (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: client_telemetry_logger_unittest: remove unused includes Created 4 years, 7 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 unified diff | Download patch
OLDNEW
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/signaling/chromoting_event.h" 5 #include "remoting/base/chromoting_event.h"
6 6
7 #include "base/sys_info.h" 7 #include "base/sys_info.h"
8 8
9 namespace remoting { 9 namespace remoting {
10 10
11 const char ChromotingEvent::kCaptureLatencyKey[] = "capture_latency"; 11 const char ChromotingEvent::kCaptureLatencyKey[] = "capture_latency";
12 const char ChromotingEvent::kConnectionErrorKey[] = "connection_error"; 12 const char ChromotingEvent::kConnectionErrorKey[] = "connection_error";
13 const char ChromotingEvent::kCpuKey[] = "cpu"; 13 const char ChromotingEvent::kCpuKey[] = "cpu";
14 const char ChromotingEvent::kDecodeLatencyKey[] = "decode_latency"; 14 const char ChromotingEvent::kDecodeLatencyKey[] = "decode_latency";
15 const char ChromotingEvent::kEncodeLatencyKey[] = "encode_latency"; 15 const char ChromotingEvent::kEncodeLatencyKey[] = "encode_latency";
(...skipping 14 matching lines...) Expand all
30 const char ChromotingEvent::kTypeKey[] = "type"; 30 const char ChromotingEvent::kTypeKey[] = "type";
31 const char ChromotingEvent::kVideoBandwidthKey[] = "video_bandwidth"; 31 const char ChromotingEvent::kVideoBandwidthKey[] = "video_bandwidth";
32 32
33 ChromotingEvent::ChromotingEvent() : values_map_(new base::DictionaryValue()) {} 33 ChromotingEvent::ChromotingEvent() : values_map_(new base::DictionaryValue()) {}
34 34
35 ChromotingEvent::ChromotingEvent(Type type) : ChromotingEvent() { 35 ChromotingEvent::ChromotingEvent(Type type) : ChromotingEvent() {
36 SetEnum(kTypeKey, type); 36 SetEnum(kTypeKey, type);
37 } 37 }
38 38
39 ChromotingEvent::ChromotingEvent(const ChromotingEvent& other) { 39 ChromotingEvent::ChromotingEvent(const ChromotingEvent& other) {
40 try_count_ = other.try_count_; 40 send_attempts_ = other.send_attempts_;
41 values_map_ = other.values_map_->CreateDeepCopy(); 41 values_map_ = other.values_map_->CreateDeepCopy();
42 } 42 }
43 43
44 ChromotingEvent::ChromotingEvent(ChromotingEvent&& other) { 44 ChromotingEvent::ChromotingEvent(ChromotingEvent&& other) {
45 try_count_ = other.try_count_; 45 send_attempts_ = other.send_attempts_;
46 values_map_ = std::move(other.values_map_); 46 values_map_ = std::move(other.values_map_);
47 } 47 }
48 48
49 ChromotingEvent::~ChromotingEvent() {} 49 ChromotingEvent::~ChromotingEvent() {}
50 50
51 ChromotingEvent& ChromotingEvent::operator=(const ChromotingEvent& other) { 51 ChromotingEvent& ChromotingEvent::operator=(const ChromotingEvent& other) {
52 if (this != &other) { 52 if (this != &other) {
53 try_count_ = other.try_count_; 53 send_attempts_ = other.send_attempts_;
54 values_map_ = other.values_map_->CreateDeepCopy(); 54 values_map_ = other.values_map_->CreateDeepCopy();
55 } 55 }
56 return *this; 56 return *this;
57 } 57 }
58 58
59 ChromotingEvent& ChromotingEvent::operator=(ChromotingEvent&& other) { 59 ChromotingEvent& ChromotingEvent::operator=(ChromotingEvent&& other) {
60 try_count_ = other.try_count_; 60 send_attempts_ = other.send_attempts_;
61 values_map_ = std::move(other.values_map_); 61 values_map_ = std::move(other.values_map_);
62 return *this; 62 return *this;
63 } 63 }
64 64
65 void ChromotingEvent::SetString(const std::string& key, 65 void ChromotingEvent::SetString(const std::string& key,
66 const std::string& value) { 66 const std::string& value) {
67 values_map_->SetString(key, value); 67 values_map_->SetString(key, value);
68 } 68 }
69 69
70 void ChromotingEvent::SetInteger(const std::string& key, int value) { 70 void ChromotingEvent::SetInteger(const std::string& key, int value) {
(...skipping 23 matching lines...) Expand all
94 #elif defined(OS_ANDROID) 94 #elif defined(OS_ANDROID)
95 Os os = Os::CHROMOTING_ANDROID; 95 Os os = Os::CHROMOTING_ANDROID;
96 #elif defined(OS_IOS) 96 #elif defined(OS_IOS)
97 Os os = Os::CHROMOTING_IOS; 97 Os os = Os::CHROMOTING_IOS;
98 #else 98 #else
99 Os os = Os::OTHER; 99 Os os = Os::OTHER;
100 #endif 100 #endif
101 SetEnum(kOsKey, os); 101 SetEnum(kOsKey, os);
102 } 102 }
103 103
104 void ChromotingEvent::IncrementTryCount() { 104 void ChromotingEvent::IncrementSendAttempts() {
105 try_count_++; 105 send_attempts_++;
106 } 106 }
107 107
108 std::unique_ptr<base::DictionaryValue> ChromotingEvent::CopyDictionaryValue() 108 std::unique_ptr<base::DictionaryValue> ChromotingEvent::CopyDictionaryValue()
109 const { 109 const {
110 return values_map_->CreateDeepCopy(); 110 return values_map_->CreateDeepCopy();
111 } 111 }
112 112
113 // static 113 // static
114 bool ChromotingEvent::IsEndOfSession(SessionState state) { 114 bool ChromotingEvent::IsEndOfSession(SessionState state) {
115 return state == SessionState::CLOSED || 115 return state == SessionState::CLOSED ||
116 state == SessionState::CONNECTION_DROPPED || 116 state == SessionState::CONNECTION_DROPPED ||
117 state == SessionState::CONNECTION_FAILED || 117 state == SessionState::CONNECTION_FAILED ||
118 state == SessionState::CONNECTION_CANCELED; 118 state == SessionState::CONNECTION_CANCELED;
119 } 119 }
120 120
121 } // namespace remoting 121 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698