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 #include "remoting/signaling/log_to_server.h" | 5 #include "remoting/signaling/log_to_server.h" |
6 | 6 |
7 #include "remoting/base/constants.h" | 7 #include "remoting/base/constants.h" |
8 #include "remoting/signaling/iq_sender.h" | 8 #include "remoting/signaling/iq_sender.h" |
9 #include "remoting/signaling/signal_strategy.h" | 9 #include "remoting/signaling/signal_strategy.h" |
10 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" | 10 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 const buzz::XmlElement* stanza) { | 43 const buzz::XmlElement* stanza) { |
44 return false; | 44 return false; |
45 } | 45 } |
46 | 46 |
47 void LogToServer::Log(const ServerLogEntry& entry) { | 47 void LogToServer::Log(const ServerLogEntry& entry) { |
48 pending_entries_.push_back(entry); | 48 pending_entries_.push_back(entry); |
49 SendPendingEntries(); | 49 SendPendingEntries(); |
50 } | 50 } |
51 | 51 |
52 void LogToServer::SendPendingEntries() { | 52 void LogToServer::SendPendingEntries() { |
53 if (iq_sender_ == NULL) { | 53 if (iq_sender_ == nullptr) { |
54 return; | 54 return; |
55 } | 55 } |
56 if (pending_entries_.empty()) { | 56 if (pending_entries_.empty()) { |
57 return; | 57 return; |
58 } | 58 } |
59 // Make one stanza containing all the pending entries. | 59 // Make one stanza containing all the pending entries. |
60 scoped_ptr<XmlElement> stanza(ServerLogEntry::MakeStanza()); | 60 scoped_ptr<XmlElement> stanza(ServerLogEntry::MakeStanza()); |
61 while (!pending_entries_.empty()) { | 61 while (!pending_entries_.empty()) { |
62 ServerLogEntry& entry = pending_entries_.front(); | 62 ServerLogEntry& entry = pending_entries_.front(); |
63 stanza->AddElement(entry.ToStanza().release()); | 63 stanza->AddElement(entry.ToStanza().release()); |
64 pending_entries_.pop_front(); | 64 pending_entries_.pop_front(); |
65 } | 65 } |
66 // Send the stanza to the server. | 66 // Send the stanza to the server. |
67 scoped_ptr<IqRequest> req = iq_sender_->SendIq( | 67 scoped_ptr<IqRequest> req = iq_sender_->SendIq( |
68 buzz::STR_SET, directory_bot_jid_, stanza.Pass(), | 68 buzz::STR_SET, directory_bot_jid_, stanza.Pass(), |
69 IqSender::ReplyCallback()); | 69 IqSender::ReplyCallback()); |
70 // We ignore any response, so let the IqRequest be destroyed. | 70 // We ignore any response, so let the IqRequest be destroyed. |
71 return; | 71 return; |
72 } | 72 } |
73 | 73 |
74 } // namespace remoting | 74 } // namespace remoting |
OLD | NEW |