| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/ppb_transport_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_transport_impl.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 next_address_callback_ = new TrackedCompletionCallback( | 136 next_address_callback_ = new TrackedCompletionCallback( |
| 137 instance()->module()->GetCallbackTracker(), pp_resource(), callback); | 137 instance()->module()->GetCallbackTracker(), pp_resource(), callback); |
| 138 return PP_OK_COMPLETIONPENDING; | 138 return PP_OK_COMPLETIONPENDING; |
| 139 } | 139 } |
| 140 | 140 |
| 141 int32_t PPB_Transport_Impl::ReceiveRemoteAddress(PP_Var address) { | 141 int32_t PPB_Transport_Impl::ReceiveRemoteAddress(PP_Var address) { |
| 142 if (!p2p_transport_.get()) | 142 if (!p2p_transport_.get()) |
| 143 return PP_ERROR_FAILED; | 143 return PP_ERROR_FAILED; |
| 144 | 144 |
| 145 scoped_refptr<StringVar> address_str = StringVar::FromPPVar(address); | 145 StringVar* address_str = StringVar::FromPPVar(address); |
| 146 if (!address_str) | 146 if (!address_str) |
| 147 return PP_ERROR_BADARGUMENT; | 147 return PP_ERROR_BADARGUMENT; |
| 148 | 148 |
| 149 return p2p_transport_->AddRemoteCandidate(address_str->value()) ? | 149 return p2p_transport_->AddRemoteCandidate(address_str->value()) ? |
| 150 PP_OK : PP_ERROR_FAILED; | 150 PP_OK : PP_ERROR_FAILED; |
| 151 } | 151 } |
| 152 | 152 |
| 153 int32_t PPB_Transport_Impl::Recv(void* data, uint32_t len, | 153 int32_t PPB_Transport_Impl::Recv(void* data, uint32_t len, |
| 154 PP_CompletionCallback callback) { | 154 PP_CompletionCallback callback) { |
| 155 if (!p2p_transport_.get()) | 155 if (!p2p_transport_.get()) |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 void PPB_Transport_Impl::OnWritten(int result) { | 246 void PPB_Transport_Impl::OnWritten(int result) { |
| 247 DCHECK(send_callback_.get() && !send_callback_->completed()); | 247 DCHECK(send_callback_.get() && !send_callback_->completed()); |
| 248 | 248 |
| 249 scoped_refptr<TrackedCompletionCallback> callback; | 249 scoped_refptr<TrackedCompletionCallback> callback; |
| 250 callback.swap(send_callback_); | 250 callback.swap(send_callback_); |
| 251 callback->Run(MapNetError(result)); | 251 callback->Run(MapNetError(result)); |
| 252 } | 252 } |
| 253 | 253 |
| 254 } // namespace ppapi | 254 } // namespace ppapi |
| 255 } // namespace webkit | 255 } // namespace webkit |
| OLD | NEW |