OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef REMOTING_HOST_HOST_STATUS_LOGGER_H_ | 5 #ifndef REMOTING_HOST_HOST_STATUS_LOGGER_H_ |
6 #define REMOTING_HOST_HOST_STATUS_LOGGER_H_ | 6 #define REMOTING_HOST_HOST_STATUS_LOGGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/threading/non_thread_safe.h" | 12 #include "base/sequence_checker.h" |
13 #include "remoting/host/host_status_observer.h" | 13 #include "remoting/host/host_status_observer.h" |
14 #include "remoting/protocol/transport.h" | 14 #include "remoting/protocol/transport.h" |
15 #include "remoting/signaling/log_to_server.h" | 15 #include "remoting/signaling/log_to_server.h" |
16 | 16 |
17 namespace remoting { | 17 namespace remoting { |
18 | 18 |
19 class HostStatusMonitor; | 19 class HostStatusMonitor; |
20 | 20 |
21 // HostStatusLogger sends host log entries to a server. | 21 // HostStatusLogger sends host log entries to a server. |
22 // The contents of the log entries are described in server_log_entry_host.cc. | 22 // The contents of the log entries are described in server_log_entry_host.cc. |
23 // They do not contain any personally identifiable information. | 23 // They do not contain any personally identifiable information. |
24 class HostStatusLogger : public HostStatusObserver, | 24 class HostStatusLogger : public HostStatusObserver { |
25 public base::NonThreadSafe { | |
26 public: | 25 public: |
27 HostStatusLogger(base::WeakPtr<HostStatusMonitor> monitor, | 26 HostStatusLogger(base::WeakPtr<HostStatusMonitor> monitor, |
28 ServerLogEntry::Mode mode, | 27 ServerLogEntry::Mode mode, |
29 SignalStrategy* signal_strategy, | 28 SignalStrategy* signal_strategy, |
30 const std::string& directory_bot_jid); | 29 const std::string& directory_bot_jid); |
31 ~HostStatusLogger() override; | 30 ~HostStatusLogger() override; |
32 | 31 |
33 // Logs a session state change. Currently, this is either | 32 // Logs a session state change. Currently, this is either |
34 // connection or disconnection. | 33 // connection or disconnection. |
35 void LogSessionStateChange(const std::string& jid, bool connected); | 34 void LogSessionStateChange(const std::string& jid, bool connected); |
(...skipping 11 matching lines...) Expand all Loading... |
47 private: | 46 private: |
48 LogToServer log_to_server_; | 47 LogToServer log_to_server_; |
49 | 48 |
50 base::WeakPtr<HostStatusMonitor> monitor_; | 49 base::WeakPtr<HostStatusMonitor> monitor_; |
51 | 50 |
52 // A map from client JID to the route type of that client's connection to | 51 // A map from client JID to the route type of that client's connection to |
53 // this host. | 52 // this host. |
54 std::map<std::string, protocol::TransportRoute::RouteType> | 53 std::map<std::string, protocol::TransportRoute::RouteType> |
55 connection_route_type_; | 54 connection_route_type_; |
56 | 55 |
| 56 SEQUENCE_CHECKER(sequence_checker_); |
| 57 |
57 DISALLOW_COPY_AND_ASSIGN(HostStatusLogger); | 58 DISALLOW_COPY_AND_ASSIGN(HostStatusLogger); |
58 }; | 59 }; |
59 | 60 |
60 } // namespace remoting | 61 } // namespace remoting |
61 | 62 |
62 #endif // REMOTING_HOST_HOST_STATUS_LOGGER_H_ | 63 #endif // REMOTING_HOST_HOST_STATUS_LOGGER_H_ |
OLD | NEW |