| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "blimp/net/blimp_connection.h" | 5 #include "blimp/net/blimp_connection.h" |
| 6 | 6 |
| 7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 | 57 |
| 58 BlimpMessageSender::~BlimpMessageSender() { | 58 BlimpMessageSender::~BlimpMessageSender() { |
| 59 DVLOG(1) << "BlimpMessageSender destroyed."; | 59 DVLOG(1) << "BlimpMessageSender destroyed."; |
| 60 } | 60 } |
| 61 | 61 |
| 62 void BlimpMessageSender::ProcessMessage( | 62 void BlimpMessageSender::ProcessMessage( |
| 63 scoped_ptr<BlimpMessage> message, | 63 scoped_ptr<BlimpMessage> message, |
| 64 const net::CompletionCallback& callback) { | 64 const net::CompletionCallback& callback) { |
| 65 DCHECK(error_observer_); | 65 DCHECK(error_observer_); |
| 66 DVLOG(2) << "Sender::ProcessMessage " << *message; | 66 VLOG(1) << "Sending " << *message; |
| 67 | 67 |
| 68 if (message->ByteSize() > static_cast<int>(kMaxPacketPayloadSizeBytes)) { | 68 if (message->ByteSize() > static_cast<int>(kMaxPacketPayloadSizeBytes)) { |
| 69 DLOG(ERROR) << "Message rejected (too large): " << *message; | 69 DLOG(ERROR) << "Message rejected (too large): " << *message; |
| 70 callback.Run(net::ERR_MSG_TOO_BIG); | 70 callback.Run(net::ERR_MSG_TOO_BIG); |
| 71 return; | 71 return; |
| 72 } | 72 } |
| 73 | 73 |
| 74 if (!message->SerializeToArray(buffer_->data(), message->GetCachedSize())) { | 74 if (!message->SerializeToArray(buffer_->data(), message->GetCachedSize())) { |
| 75 DLOG(ERROR) << "Failed to serialize message."; | 75 DLOG(ERROR) << "Failed to serialize message."; |
| 76 callback.Run(net::ERR_INVALID_ARGUMENT); | 76 callback.Run(net::ERR_INVALID_ARGUMENT); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 | 142 |
| 143 void BlimpConnection::OnConnectionError(int error) { | 143 void BlimpConnection::OnConnectionError(int error) { |
| 144 VLOG(1) << "OnConnectionError, error=" << error; | 144 VLOG(1) << "OnConnectionError, error=" << error; |
| 145 | 145 |
| 146 // Propagate the error to all observers. | 146 // Propagate the error to all observers. |
| 147 FOR_EACH_OBSERVER(ConnectionErrorObserver, error_observers_, | 147 FOR_EACH_OBSERVER(ConnectionErrorObserver, error_observers_, |
| 148 OnConnectionError(error)); | 148 OnConnectionError(error)); |
| 149 } | 149 } |
| 150 | 150 |
| 151 } // namespace blimp | 151 } // namespace blimp |
| OLD | NEW |