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

Side by Side Diff: remoting/host/ipc_host_event_logger.cc

Issue 2911893003: Deprecate NonThreadSafe in remoting in favor of SequenceChecker. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « remoting/host/ipc_host_event_logger.h ('k') | remoting/host/local_input_monitor_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/host/ipc_host_event_logger.h" 5 #include "remoting/host/ipc_host_event_logger.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ipc/ipc_sender.h" 8 #include "ipc/ipc_sender.h"
9 #include "net/base/ip_endpoint.h" 9 #include "net/base/ip_endpoint.h"
10 #include "remoting/host/chromoting_messages.h" 10 #include "remoting/host/chromoting_messages.h"
11 #include "remoting/host/host_status_monitor.h" 11 #include "remoting/host/host_status_monitor.h"
12 #include "remoting/protocol/transport.h" 12 #include "remoting/protocol/transport.h"
13 13
14 namespace remoting { 14 namespace remoting {
15 15
16 IpcHostEventLogger::IpcHostEventLogger(base::WeakPtr<HostStatusMonitor> monitor, 16 IpcHostEventLogger::IpcHostEventLogger(base::WeakPtr<HostStatusMonitor> monitor,
17 IPC::Sender* daemon_channel) 17 IPC::Sender* daemon_channel)
18 : daemon_channel_(daemon_channel), 18 : daemon_channel_(daemon_channel),
19 monitor_(monitor) { 19 monitor_(monitor) {
20 monitor_->AddStatusObserver(this); 20 monitor_->AddStatusObserver(this);
21 } 21 }
22 22
23 IpcHostEventLogger::~IpcHostEventLogger() { 23 IpcHostEventLogger::~IpcHostEventLogger() {
24 DCHECK(CalledOnValidThread()); 24 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
25 25
26 if (monitor_.get()) 26 if (monitor_.get())
27 monitor_->RemoveStatusObserver(this); 27 monitor_->RemoveStatusObserver(this);
28 } 28 }
29 29
30 void IpcHostEventLogger::OnAccessDenied(const std::string& jid) { 30 void IpcHostEventLogger::OnAccessDenied(const std::string& jid) {
31 DCHECK(CalledOnValidThread()); 31 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
32 32
33 daemon_channel_->Send(new ChromotingNetworkDaemonMsg_AccessDenied(jid)); 33 daemon_channel_->Send(new ChromotingNetworkDaemonMsg_AccessDenied(jid));
34 } 34 }
35 35
36 void IpcHostEventLogger::OnClientAuthenticated(const std::string& jid) { 36 void IpcHostEventLogger::OnClientAuthenticated(const std::string& jid) {
37 DCHECK(CalledOnValidThread()); 37 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
38 38
39 daemon_channel_->Send( 39 daemon_channel_->Send(
40 new ChromotingNetworkDaemonMsg_ClientAuthenticated(jid)); 40 new ChromotingNetworkDaemonMsg_ClientAuthenticated(jid));
41 } 41 }
42 42
43 void IpcHostEventLogger::OnClientConnected(const std::string& jid) { 43 void IpcHostEventLogger::OnClientConnected(const std::string& jid) {
44 DCHECK(CalledOnValidThread()); 44 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
45 45
46 daemon_channel_->Send(new ChromotingNetworkDaemonMsg_ClientConnected(jid)); 46 daemon_channel_->Send(new ChromotingNetworkDaemonMsg_ClientConnected(jid));
47 } 47 }
48 48
49 void IpcHostEventLogger::OnClientDisconnected(const std::string& jid) { 49 void IpcHostEventLogger::OnClientDisconnected(const std::string& jid) {
50 DCHECK(CalledOnValidThread()); 50 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
51 51
52 daemon_channel_->Send(new ChromotingNetworkDaemonMsg_ClientDisconnected(jid)); 52 daemon_channel_->Send(new ChromotingNetworkDaemonMsg_ClientDisconnected(jid));
53 } 53 }
54 54
55 void IpcHostEventLogger::OnClientRouteChange( 55 void IpcHostEventLogger::OnClientRouteChange(
56 const std::string& jid, 56 const std::string& jid,
57 const std::string& channel_name, 57 const std::string& channel_name,
58 const protocol::TransportRoute& route) { 58 const protocol::TransportRoute& route) {
59 DCHECK(CalledOnValidThread()); 59 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
60 60
61 SerializedTransportRoute serialized_route; 61 SerializedTransportRoute serialized_route;
62 serialized_route.type = route.type; 62 serialized_route.type = route.type;
63 serialized_route.remote_ip = 63 serialized_route.remote_ip =
64 route.remote_address.address().CopyBytesToVector(); 64 route.remote_address.address().CopyBytesToVector();
65 serialized_route.remote_port = route.remote_address.port(); 65 serialized_route.remote_port = route.remote_address.port();
66 serialized_route.local_ip = route.local_address.address().CopyBytesToVector(); 66 serialized_route.local_ip = route.local_address.address().CopyBytesToVector();
67 serialized_route.local_port = route.local_address.port(); 67 serialized_route.local_port = route.local_address.port();
68 daemon_channel_->Send(new ChromotingNetworkDaemonMsg_ClientRouteChange( 68 daemon_channel_->Send(new ChromotingNetworkDaemonMsg_ClientRouteChange(
69 jid, channel_name, serialized_route)); 69 jid, channel_name, serialized_route));
70 } 70 }
71 71
72 void IpcHostEventLogger::OnShutdown() { 72 void IpcHostEventLogger::OnShutdown() {
73 DCHECK(CalledOnValidThread()); 73 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
74 74
75 daemon_channel_->Send(new ChromotingNetworkDaemonMsg_HostShutdown()); 75 daemon_channel_->Send(new ChromotingNetworkDaemonMsg_HostShutdown());
76 } 76 }
77 77
78 void IpcHostEventLogger::OnStart(const std::string& xmpp_login) { 78 void IpcHostEventLogger::OnStart(const std::string& xmpp_login) {
79 DCHECK(CalledOnValidThread()); 79 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
80 80
81 daemon_channel_->Send(new ChromotingNetworkDaemonMsg_HostStarted(xmpp_login)); 81 daemon_channel_->Send(new ChromotingNetworkDaemonMsg_HostStarted(xmpp_login));
82 } 82 }
83 83
84 } // namespace remoting 84 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/ipc_host_event_logger.h ('k') | remoting/host/local_input_monitor_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698