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

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

Issue 2727093003: Fix ASAN ODR violation in ppapi/proxy in component mode (Closed)
Patch Set: simplify, no export Created 3 years, 9 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 | « ppapi/proxy/BUILD.gn ('k') | ppapi/proxy/tcp_socket_resource_constants.h » ('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 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/tcp_socket_resource_base.h" 5 #include "ppapi/proxy/tcp_socket_resource_base.h"
6 6
7 #include <cstring> 7 #include <cstring>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 if (!buffer || bytes_to_read <= 0) 200 if (!buffer || bytes_to_read <= 0)
201 return PP_ERROR_BADARGUMENT; 201 return PP_ERROR_BADARGUMENT;
202 202
203 if (!state_.IsConnected()) 203 if (!state_.IsConnected())
204 return PP_ERROR_FAILED; 204 return PP_ERROR_FAILED;
205 if (TrackedCallback::IsPending(read_callback_) || 205 if (TrackedCallback::IsPending(read_callback_) ||
206 state_.IsPending(TCPSocketState::SSL_CONNECT)) 206 state_.IsPending(TCPSocketState::SSL_CONNECT))
207 return PP_ERROR_INPROGRESS; 207 return PP_ERROR_INPROGRESS;
208 read_buffer_ = buffer; 208 read_buffer_ = buffer;
209 bytes_to_read_ = 209 bytes_to_read_ =
210 std::min(bytes_to_read, TCPSocketResourceConstants::kMaxReadSize); 210 std::min(bytes_to_read,
211 static_cast<int32_t>(TCPSocketResourceConstants::kMaxReadSize));
211 read_callback_ = callback; 212 read_callback_ = callback;
212 213
213 Call<PpapiPluginMsg_TCPSocket_ReadReply>( 214 Call<PpapiPluginMsg_TCPSocket_ReadReply>(
214 BROWSER, 215 BROWSER,
215 PpapiHostMsg_TCPSocket_Read(bytes_to_read_), 216 PpapiHostMsg_TCPSocket_Read(bytes_to_read_),
216 base::Bind(&TCPSocketResourceBase::OnPluginMsgReadReply, 217 base::Bind(&TCPSocketResourceBase::OnPluginMsgReadReply,
217 base::Unretained(this)), 218 base::Unretained(this)),
218 callback); 219 callback);
219 return PP_OK_COMPLETIONPENDING; 220 return PP_OK_COMPLETIONPENDING;
220 } 221 }
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 } 500 }
500 501
501 void TCPSocketResourceBase::RunCallback(scoped_refptr<TrackedCallback> callback, 502 void TCPSocketResourceBase::RunCallback(scoped_refptr<TrackedCallback> callback,
502 int32_t pp_result) { 503 int32_t pp_result) {
503 callback->Run(ConvertNetworkAPIErrorForCompatibility( 504 callback->Run(ConvertNetworkAPIErrorForCompatibility(
504 pp_result, version_ == TCP_SOCKET_VERSION_PRIVATE)); 505 pp_result, version_ == TCP_SOCKET_VERSION_PRIVATE));
505 } 506 }
506 507
507 } // namespace ppapi 508 } // namespace ppapi
508 } // namespace proxy 509 } // namespace proxy
OLDNEW
« no previous file with comments | « ppapi/proxy/BUILD.gn ('k') | ppapi/proxy/tcp_socket_resource_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698