OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ppapi/proxy/udp_socket_resource_base.h" | 5 #include "ppapi/proxy/udp_socket_resource_base.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cstring> | 8 #include <cstring> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
313 read_buffer_ = NULL; | 313 read_buffer_ = NULL; |
314 bytes_to_read_ = -1; | 314 bytes_to_read_ = -1; |
315 recvfrom_addr_resource_ = NULL; | 315 recvfrom_addr_resource_ = NULL; |
316 | 316 |
317 RunCallback(recvfrom_callback_, result); | 317 RunCallback(recvfrom_callback_, result); |
318 } | 318 } |
319 | 319 |
320 void UDPSocketResourceBase::OnPluginMsgSendToReply( | 320 void UDPSocketResourceBase::OnPluginMsgSendToReply( |
321 const ResourceMessageReplyParams& params, | 321 const ResourceMessageReplyParams& params, |
322 int32_t bytes_written) { | 322 int32_t bytes_written) { |
323 if (sendto_callbacks_.empty()) | |
bbudge
2015/01/28 18:07:31
Add a comment that this could happen when the sock
| |
324 return; | |
325 | |
323 scoped_refptr<TrackedCallback> callback = sendto_callbacks_.front(); | 326 scoped_refptr<TrackedCallback> callback = sendto_callbacks_.front(); |
324 sendto_callbacks_.pop(); | 327 sendto_callbacks_.pop(); |
325 if (!TrackedCallback::IsPending(callback)) | 328 if (!TrackedCallback::IsPending(callback)) |
326 return; | 329 return; |
327 | 330 |
328 if (params.result() == PP_OK) | 331 if (params.result() == PP_OK) |
329 RunCallback(callback, bytes_written); | 332 RunCallback(callback, bytes_written); |
330 else | 333 else |
331 RunCallback(callback, params.result()); | 334 RunCallback(callback, params.result()); |
332 } | 335 } |
(...skipping 27 matching lines...) Expand all Loading... | |
360 if (result == PP_OK && !data.empty()) | 363 if (result == PP_OK && !data.empty()) |
361 memcpy(output_buffer, data.c_str(), data.size()); | 364 memcpy(output_buffer, data.c_str(), data.size()); |
362 | 365 |
363 recvfrom_addr_ = addr; | 366 recvfrom_addr_ = addr; |
364 | 367 |
365 return result == PP_OK ? static_cast<int32_t>(data.size()) : result; | 368 return result == PP_OK ? static_cast<int32_t>(data.size()) : result; |
366 } | 369 } |
367 | 370 |
368 } // namespace proxy | 371 } // namespace proxy |
369 } // namespace ppapi | 372 } // namespace ppapi |
OLD | NEW |