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

Side by Side Diff: ppapi/proxy/udp_socket_resource_base.cc

Issue 881203002: Fix callback access in Pepper's UDP socket resource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698