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

Side by Side Diff: webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.cc

Issue 20165002: Move webkit/plugins/ppapi to content/renderer/pepper. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: more more clang fun Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.h"
6
7 #include "base/logging.h"
8 #include "webkit/plugins/ppapi/host_globals.h"
9 #include "webkit/plugins/ppapi/plugin_delegate.h"
10 #include "webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h"
11 #include "webkit/plugins/ppapi/resource_helper.h"
12
13 namespace webkit {
14 namespace ppapi {
15
16 PPB_TCPServerSocket_Private_Impl::PPB_TCPServerSocket_Private_Impl(
17 PP_Instance instance)
18 : ::ppapi::PPB_TCPServerSocket_Shared(instance) {
19 }
20
21 PPB_TCPServerSocket_Private_Impl::~PPB_TCPServerSocket_Private_Impl() {
22 StopListening();
23 }
24
25 PP_Resource PPB_TCPServerSocket_Private_Impl::CreateResource(
26 PP_Instance instance) {
27 PPB_TCPServerSocket_Private_Impl* socket =
28 new PPB_TCPServerSocket_Private_Impl(instance);
29 return socket->GetReference();
30 }
31
32 void PPB_TCPServerSocket_Private_Impl::OnAcceptCompleted(
33 bool succeeded,
34 uint32 accepted_socket_id,
35 const PP_NetAddress_Private& local_addr,
36 const PP_NetAddress_Private& remote_addr) {
37 if (!::ppapi::TrackedCallback::IsPending(accept_callback_) ||
38 !tcp_socket_buffer_) {
39 NOTREACHED();
40 return;
41 }
42
43 if (succeeded) {
44 *tcp_socket_buffer_ =
45 PPB_TCPSocket_Private_Impl::CreateConnectedSocket(pp_instance(),
46 accepted_socket_id,
47 local_addr,
48 remote_addr);
49 }
50 tcp_socket_buffer_ = NULL;
51
52 accept_callback_->Run(succeeded ? PP_OK : PP_ERROR_FAILED);
53 }
54
55 void PPB_TCPServerSocket_Private_Impl::SendListen(
56 const PP_NetAddress_Private& addr,
57 int32_t backlog) {
58 PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this);
59 if (!plugin_delegate)
60 return;
61
62 plugin_delegate->TCPServerSocketListen(pp_resource(), addr, backlog);
63 }
64
65 void PPB_TCPServerSocket_Private_Impl::SendAccept() {
66 PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this);
67 if (!plugin_delegate)
68 return;
69
70 plugin_delegate->TCPServerSocketAccept(socket_id_);
71 }
72
73 void PPB_TCPServerSocket_Private_Impl::SendStopListening() {
74 PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this);
75 if (!plugin_delegate)
76 return;
77
78 plugin_delegate->TCPServerSocketStopListening(pp_resource(), socket_id_);
79 }
80
81 } // namespace ppapi
82 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.h ('k') | webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698