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

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

Issue 7669055: Remove webkit::ppapi::Resource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix self-assignment Created 9 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
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_flash_net_connector_impl.h" 5 #include "webkit/plugins/ppapi/ppb_flash_net_connector_impl.h"
6 6
7 #include "ppapi/c/pp_completion_callback.h" 7 #include "ppapi/c/pp_completion_callback.h"
8 #include "ppapi/c/private/ppb_flash_net_connector.h" 8 #include "ppapi/c/private/ppb_flash_net_connector.h"
9 #include "webkit/plugins/ppapi/common.h" 9 #include "webkit/plugins/ppapi/common.h"
10 #include "webkit/plugins/ppapi/plugin_delegate.h" 10 #include "webkit/plugins/ppapi/plugin_delegate.h"
11 #include "webkit/plugins/ppapi/plugin_module.h" 11 #include "webkit/plugins/ppapi/plugin_module.h"
12 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 12 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
13 #include "webkit/plugins/ppapi/resource_helper.h"
13 14
14 using ::ppapi::thunk::PPB_Flash_NetConnector_API; 15 using ::ppapi::thunk::PPB_Flash_NetConnector_API;
15 16
16 namespace webkit { 17 namespace webkit {
17 namespace ppapi { 18 namespace ppapi {
18 19
19 PPB_Flash_NetConnector_Impl::PPB_Flash_NetConnector_Impl( 20 PPB_Flash_NetConnector_Impl::PPB_Flash_NetConnector_Impl(PP_Instance instance)
20 PluginInstance* instance)
21 : Resource(instance) { 21 : Resource(instance) {
22 } 22 }
23 23
24 PPB_Flash_NetConnector_Impl::~PPB_Flash_NetConnector_Impl() { 24 PPB_Flash_NetConnector_Impl::~PPB_Flash_NetConnector_Impl() {
25 } 25 }
26 26
27 PPB_Flash_NetConnector_API* 27 PPB_Flash_NetConnector_API*
28 PPB_Flash_NetConnector_Impl::AsPPB_Flash_NetConnector_API() { 28 PPB_Flash_NetConnector_Impl::AsPPB_Flash_NetConnector_API() {
29 return this; 29 return this;
30 } 30 }
(...skipping 10 matching lines...) Expand all
41 return PP_ERROR_BADARGUMENT; 41 return PP_ERROR_BADARGUMENT;
42 42
43 if (!callback.func) { 43 if (!callback.func) {
44 NOTIMPLEMENTED(); 44 NOTIMPLEMENTED();
45 return PP_ERROR_BADARGUMENT; 45 return PP_ERROR_BADARGUMENT;
46 } 46 }
47 47
48 if (callback_.get() && !callback_->completed()) 48 if (callback_.get() && !callback_->completed())
49 return PP_ERROR_INPROGRESS; 49 return PP_ERROR_INPROGRESS;
50 50
51 int32_t rv = instance()->delegate()->ConnectTcp(this, host, port); 51 PluginInstance* instance = ResourceHelper::GetPluginInstance(this);
52 int32_t rv = instance->delegate()->ConnectTcp(this, host, port);
52 if (rv == PP_OK_COMPLETIONPENDING) { 53 if (rv == PP_OK_COMPLETIONPENDING) {
53 // Record callback and output buffers. 54 // Record callback and output buffers.
54 callback_ = new TrackedCompletionCallback( 55 callback_ = new TrackedCompletionCallback(
55 instance()->module()->GetCallbackTracker(), pp_resource(), callback); 56 instance->module()->GetCallbackTracker(), pp_resource(), callback);
56 socket_out_ = socket_out; 57 socket_out_ = socket_out;
57 local_addr_out_ = local_addr_out; 58 local_addr_out_ = local_addr_out;
58 remote_addr_out_ = remote_addr_out; 59 remote_addr_out_ = remote_addr_out;
59 } else { 60 } else {
60 // This should never be completed synchronously successfully. 61 // This should never be completed synchronously successfully.
61 DCHECK_NE(rv, PP_OK); 62 DCHECK_NE(rv, PP_OK);
62 } 63 }
63 return rv; 64 return rv;
64 } 65 }
65 66
66 int32_t PPB_Flash_NetConnector_Impl::ConnectTcpAddress( 67 int32_t PPB_Flash_NetConnector_Impl::ConnectTcpAddress(
67 const PP_Flash_NetAddress* addr, 68 const PP_Flash_NetAddress* addr,
68 PP_FileHandle* socket_out, 69 PP_FileHandle* socket_out,
69 PP_Flash_NetAddress* local_addr_out, 70 PP_Flash_NetAddress* local_addr_out,
70 PP_Flash_NetAddress* remote_addr_out, 71 PP_Flash_NetAddress* remote_addr_out,
71 PP_CompletionCallback callback) { 72 PP_CompletionCallback callback) {
72 // |socket_out| is not optional. 73 // |socket_out| is not optional.
73 if (!socket_out) 74 if (!socket_out)
74 return PP_ERROR_BADARGUMENT; 75 return PP_ERROR_BADARGUMENT;
75 76
76 if (!callback.func) { 77 if (!callback.func) {
77 NOTIMPLEMENTED(); 78 NOTIMPLEMENTED();
78 return PP_ERROR_BADARGUMENT; 79 return PP_ERROR_BADARGUMENT;
79 } 80 }
80 81
81 if (callback_.get() && !callback_->completed()) 82 if (callback_.get() && !callback_->completed())
82 return PP_ERROR_INPROGRESS; 83 return PP_ERROR_INPROGRESS;
83 84
84 int32_t rv = instance()->delegate()->ConnectTcpAddress(this, addr); 85 PluginInstance* instance = ResourceHelper::GetPluginInstance(this);
86 int32_t rv = instance->delegate()->ConnectTcpAddress(this, addr);
85 if (rv == PP_OK_COMPLETIONPENDING) { 87 if (rv == PP_OK_COMPLETIONPENDING) {
86 // Record callback and output buffers. 88 // Record callback and output buffers.
87 callback_ = new TrackedCompletionCallback( 89 callback_ = new TrackedCompletionCallback(
88 instance()->module()->GetCallbackTracker(), pp_resource(), callback); 90 instance->module()->GetCallbackTracker(), pp_resource(), callback);
89 socket_out_ = socket_out; 91 socket_out_ = socket_out;
90 local_addr_out_ = local_addr_out; 92 local_addr_out_ = local_addr_out;
91 remote_addr_out_ = remote_addr_out; 93 remote_addr_out_ = remote_addr_out;
92 } else { 94 } else {
93 // This should never be completed synchronously successfully. 95 // This should never be completed synchronously successfully.
94 DCHECK_NE(rv, PP_OK); 96 DCHECK_NE(rv, PP_OK);
95 } 97 }
96 return rv; 98 return rv;
97 } 99 }
98 100
(...skipping 26 matching lines...) Expand all
125 socket_out_ = NULL; 127 socket_out_ = NULL;
126 local_addr_out_ = NULL; 128 local_addr_out_ = NULL;
127 remote_addr_out_ = NULL; 129 remote_addr_out_ = NULL;
128 130
129 callback->Run(rv); // Will complete abortively if necessary. 131 callback->Run(rv); // Will complete abortively if necessary.
130 } 132 }
131 133
132 } // namespace ppapi 134 } // namespace ppapi
133 } // namespace webkit 135 } // namespace webkit
134 136
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698