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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 return PP_ERROR_FAILED; | 274 return PP_ERROR_FAILED; |
275 | 275 |
276 if (next_address_callback_.get() && !next_address_callback_->completed()) | 276 if (next_address_callback_.get() && !next_address_callback_->completed()) |
277 return PP_ERROR_INPROGRESS; | 277 return PP_ERROR_INPROGRESS; |
278 | 278 |
279 PluginModule* plugin_module = ResourceHelper::GetPluginModule(this); | 279 PluginModule* plugin_module = ResourceHelper::GetPluginModule(this); |
280 if (!plugin_module) | 280 if (!plugin_module) |
281 return PP_ERROR_FAILED; | 281 return PP_ERROR_FAILED; |
282 | 282 |
283 if (!local_candidates_.empty()) { | 283 if (!local_candidates_.empty()) { |
284 *address = StringVar::StringToPPVar(plugin_module->pp_module(), | 284 *address = StringVar::StringToPPVar(local_candidates_.front()); |
285 local_candidates_.front()); | |
286 local_candidates_.pop_front(); | 285 local_candidates_.pop_front(); |
287 return PP_OK; | 286 return PP_OK; |
288 } | 287 } |
289 | 288 |
290 next_address_callback_ = new TrackedCompletionCallback( | 289 next_address_callback_ = new TrackedCompletionCallback( |
291 plugin_module->GetCallbackTracker(), pp_resource(), callback); | 290 plugin_module->GetCallbackTracker(), pp_resource(), callback); |
292 return PP_OK_COMPLETIONPENDING; | 291 return PP_OK_COMPLETIONPENDING; |
293 } | 292 } |
294 | 293 |
295 int32_t PPB_Transport_Impl::ReceiveRemoteAddress(PP_Var address) { | 294 int32_t PPB_Transport_Impl::ReceiveRemoteAddress(PP_Var address) { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 void PPB_Transport_Impl::OnWritten(int result) { | 414 void PPB_Transport_Impl::OnWritten(int result) { |
416 DCHECK(send_callback_.get() && !send_callback_->completed()); | 415 DCHECK(send_callback_.get() && !send_callback_->completed()); |
417 | 416 |
418 scoped_refptr<TrackedCompletionCallback> callback; | 417 scoped_refptr<TrackedCompletionCallback> callback; |
419 callback.swap(send_callback_); | 418 callback.swap(send_callback_); |
420 callback->Run(MapNetError(result)); | 419 callback->Run(MapNetError(result)); |
421 } | 420 } |
422 | 421 |
423 } // namespace ppapi | 422 } // namespace ppapi |
424 } // namespace webkit | 423 } // namespace webkit |
OLD | NEW |