summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-30 22:44:53 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-30 22:44:53 +0000
commit4fb0f20f7cd1e2b82eb7295f62dc6cb31bb262c5 (patch)
tree50be96f44d854af30b3c1d10ad0b7658da2e1155
parentb5b1563868c6771a52110ab93fa0c12ce6c545ec (diff)
downloadchromium_src-4fb0f20f7cd1e2b82eb7295f62dc6cb31bb262c5.zip
chromium_src-4fb0f20f7cd1e2b82eb7295f62dc6cb31bb262c5.tar.gz
chromium_src-4fb0f20f7cd1e2b82eb7295f62dc6cb31bb262c5.tar.bz2
Remove PPB_Transport_Dev API.
BUG=109630 Review URL: https://chromiumcodereview.appspot.com/10454058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139660 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--build/common.gypi8
-rw-r--r--chrome/test/ui/ppapi_uitest.cc11
-rw-r--r--content/browser/renderer_host/render_process_host_impl.cc2
-rw-r--r--content/content_browser.gypi2
-rw-r--r--content/content_renderer.gypi32
-rw-r--r--content/content_tests.gypi14
-rw-r--r--content/renderer/p2p/port_allocator.cc1
-rw-r--r--content/renderer/pepper/pepper_plugin_delegate_impl.cc4
-rw-r--r--content/renderer/render_view_impl.cc9
-rw-r--r--ppapi/api/dev/ppb_transport_dev.idl183
-rw-r--r--ppapi/c/dev/ppb_transport_dev.h186
-rw-r--r--ppapi/cpp/dev/transport_dev.cc94
-rw-r--r--ppapi/cpp/dev/transport_dev.h37
-rw-r--r--ppapi/ppapi_proxy_untrusted.gypi1
-rw-r--r--ppapi/ppapi_shared.gypi2
-rw-r--r--ppapi/ppapi_sources.gypi13
-rw-r--r--ppapi/ppapi_tests.gypi6
-rw-r--r--ppapi/proxy/resource_creation_proxy.cc7
-rw-r--r--ppapi/proxy/resource_creation_proxy.h3
-rw-r--r--ppapi/shared_impl/resource.h1
-rw-r--r--ppapi/tests/all_c_includes.h1
-rw-r--r--ppapi/tests/all_cpp_includes.h1
-rw-r--r--ppapi/tests/test_transport.cc373
-rw-r--r--ppapi/tests/test_transport.h51
-rw-r--r--ppapi/thunk/interfaces_ppb_public_dev.h3
-rw-r--r--ppapi/thunk/ppb_transport_api.h33
-rw-r--r--ppapi/thunk/ppb_transport_thunk.cc112
-rw-r--r--ppapi/thunk/resource_creation_api.h4
-rw-r--r--webkit/glue/webkit_glue.gypi6
-rw-r--r--webkit/plugins/ppapi/plugin_module.cc1
-rw-r--r--webkit/plugins/ppapi/ppb_transport_impl.cc404
-rw-r--r--webkit/plugins/ppapi/ppb_transport_impl.h82
-rw-r--r--webkit/plugins/ppapi/resource_creation_impl.cc11
-rw-r--r--webkit/plugins/ppapi/resource_creation_impl.h3
34 files changed, 25 insertions, 1676 deletions
diff --git a/build/common.gypi b/build/common.gypi
index 62dad147..d401d1a 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -203,10 +203,6 @@
# Remoting compilation is enabled by default. Set to 0 to disable.
'remoting%': 1,
- # P2P APIs are compiled in by default. Set to 0 to disable.
- # Also note that this should be enabled for remoting to compile.
- 'p2p_apis%': 1,
-
# Configuration policy is enabled by default. Set to 0 to disable.
'configuration_policy%': 1,
@@ -549,7 +545,6 @@
'enable_one_click_signin%': '<(enable_one_click_signin)',
'enable_webrtc%': '<(enable_webrtc)',
'chromium_win_pch%': '<(chromium_win_pch)',
- 'p2p_apis%': '<(p2p_apis)',
'configuration_policy%': '<(configuration_policy)',
'safe_browsing%': '<(safe_browsing)',
'input_speech%': '<(input_speech)',
@@ -1339,9 +1334,6 @@
['enable_webrtc==1', {
'defines': ['ENABLE_WEBRTC=1'],
}],
- ['p2p_apis==1', {
- 'defines': ['ENABLE_P2P_APIS=1'],
- }],
['proprietary_codecs==1', {
'defines': ['USE_PROPRIETARY_CODECS'],
}],
diff --git a/chrome/test/ui/ppapi_uitest.cc b/chrome/test/ui/ppapi_uitest.cc
index fa60e22..d64176a 100644
--- a/chrome/test/ui/ppapi_uitest.cc
+++ b/chrome/test/ui/ppapi_uitest.cc
@@ -867,17 +867,6 @@ IN_PROC_BROWSER_TEST_F(PPAPITest, MAYBE_DirectoryReader) {
RunTestViaHTTP("DirectoryReader");
}
-#if defined(ENABLE_P2P_APIS)
-// Flaky. http://crbug.com/84294
-IN_PROC_BROWSER_TEST_F(PPAPITest, DISABLED_Transport) {
- RunTest("Transport");
-}
-// http://crbug.com/89961
-IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, DISABLED_Transport) {
- RunTestViaHTTP("Transport");
-}
-#endif // ENABLE_P2P_APIS
-
// There is no proxy. This is used for PDF metrics reporting, and PDF only
// runs in process, so there's currently no need for a proxy.
TEST_PPAPI_IN_PROCESS(UMA)
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index dd6dfdb..15e3246 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -532,7 +532,7 @@ void RenderProcessHostImpl::CreateMessageFilters() {
base::Bind(&RenderWidgetHelper::GetNextRoutingID,
base::Unretained(widget_helper_.get()))));
-#if defined(ENABLE_P2P_APIS)
+#if defined(ENABLE_WEBRTC)
channel_->AddFilter(new content::P2PSocketDispatcherHost(resource_context));
#endif
diff --git a/content/content_browser.gypi b/content/content_browser.gypi
index 1d5c9e2..d3b37fe 100644
--- a/content/content_browser.gypi
+++ b/content/content_browser.gypi
@@ -777,7 +777,7 @@
'browser/gamepad/platform_data_fetcher.cc',
]
}],
- ['p2p_apis==1', {
+ ['enable_webrtc==1', {
'sources': [
'browser/renderer_host/p2p/socket_host.cc',
'browser/renderer_host/p2p/socket_host.h',
diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi
index 161a48a..df4530e 100644
--- a/content/content_renderer.gypi
+++ b/content/content_renderer.gypi
@@ -222,24 +222,6 @@
'renderer/websharedworkerrepository_impl.h',
],
'conditions': [
- ['p2p_apis==1', {
- 'sources': [
- 'renderer/p2p/host_address_request.cc',
- 'renderer/p2p/host_address_request.h',
- 'renderer/p2p/ipc_network_manager.cc',
- 'renderer/p2p/ipc_network_manager.h',
- 'renderer/p2p/ipc_socket_factory.cc',
- 'renderer/p2p/ipc_socket_factory.h',
- 'renderer/p2p/p2p_transport_impl.cc',
- 'renderer/p2p/p2p_transport_impl.h',
- 'renderer/p2p/port_allocator.cc',
- 'renderer/p2p/port_allocator.h',
- 'renderer/p2p/socket_client.cc',
- 'renderer/p2p/socket_client.h',
- 'renderer/p2p/socket_dispatcher.cc',
- 'renderer/p2p/socket_dispatcher.h',
- ],
- }],
['toolkit_uses_gtk == 1', {
'conditions': [
['input_speech==0', {
@@ -307,6 +289,20 @@
'renderer/media/video_capture_module_impl.h',
'renderer/media/webrtc_audio_device_impl.cc',
'renderer/media/webrtc_audio_device_impl.h',
+ 'renderer/p2p/host_address_request.cc',
+ 'renderer/p2p/host_address_request.h',
+ 'renderer/p2p/ipc_network_manager.cc',
+ 'renderer/p2p/ipc_network_manager.h',
+ 'renderer/p2p/ipc_socket_factory.cc',
+ 'renderer/p2p/ipc_socket_factory.h',
+ 'renderer/p2p/p2p_transport_impl.cc',
+ 'renderer/p2p/p2p_transport_impl.h',
+ 'renderer/p2p/port_allocator.cc',
+ 'renderer/p2p/port_allocator.h',
+ 'renderer/p2p/socket_client.cc',
+ 'renderer/p2p/socket_client.h',
+ 'renderer/p2p/socket_dispatcher.cc',
+ 'renderer/p2p/socket_dispatcher.h',
],
}],
['java_bridge==1', {
diff --git a/content/content_tests.gypi b/content/content_tests.gypi
index 0649023..fd4eb5c 100644
--- a/content/content_tests.gypi
+++ b/content/content_tests.gypi
@@ -320,12 +320,17 @@
'conditions': [
['enable_webrtc==1', {
'sources': [
+ 'browser/renderer_host/p2p/socket_host_test_utils.h',
+ 'browser/renderer_host/p2p/socket_host_tcp_unittest.cc',
+ 'browser/renderer_host/p2p/socket_host_tcp_server_unittest.cc',
+ 'browser/renderer_host/p2p/socket_host_udp_unittest.cc',
'renderer/media/media_stream_dispatcher_unittest.cc',
'renderer/media/media_stream_impl_unittest.cc',
'renderer/media/peer_connection_handler_jsep_unittest.cc',
'renderer/media/peer_connection_handler_unittest.cc',
'renderer/media/rtc_video_decoder_unittest.cc',
'renderer/media/webrtc_audio_device_unittest.cc',
+ 'renderer/p2p/p2p_transport_impl_unittest.cc',
],
'dependencies': [
'../third_party/libjingle/libjingle.gyp:libjingle_peerconnection',
@@ -353,15 +358,6 @@
'renderer/active_notification_tracker_unittest.cc',
],
}],
- ['p2p_apis==1', {
- 'sources': [
- 'browser/renderer_host/p2p/socket_host_test_utils.h',
- 'browser/renderer_host/p2p/socket_host_tcp_unittest.cc',
- 'browser/renderer_host/p2p/socket_host_tcp_server_unittest.cc',
- 'browser/renderer_host/p2p/socket_host_udp_unittest.cc',
- 'renderer/p2p/p2p_transport_impl_unittest.cc',
- ],
- }],
['use_x11 == 1', {
'dependencies': [
'../build/linux/system.gyp:dbus',
diff --git a/content/renderer/p2p/port_allocator.cc b/content/renderer/p2p/port_allocator.cc
index 756e0ac..4a0615e 100644
--- a/content/renderer/p2p/port_allocator.cc
+++ b/content/renderer/p2p/port_allocator.cc
@@ -12,7 +12,6 @@
#include "jingle/glue/utils.h"
#include "net/base/escape.h"
#include "net/base/ip_endpoint.h"
-#include "ppapi/c/dev/ppb_transport_dev.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLError.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLLoader.h"
diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.cc b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
index d6a80c4..630dc78 100644
--- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
@@ -1159,7 +1159,7 @@ void PepperPluginDelegateImpl::UnregisterHostResolver(uint32 host_resolver_id) {
bool PepperPluginDelegateImpl::AddNetworkListObserver(
webkit_glue::NetworkListObserver* observer) {
-#if defined(ENABLE_P2P_APIS)
+#if defined(ENABLE_WEBRTC)
P2PSocketDispatcher* socket_dispatcher =
render_view_->p2p_socket_dispatcher();
if (!socket_dispatcher) {
@@ -1174,7 +1174,7 @@ bool PepperPluginDelegateImpl::AddNetworkListObserver(
void PepperPluginDelegateImpl::RemoveNetworkListObserver(
webkit_glue::NetworkListObserver* observer) {
-#if defined(ENABLE_P2P_APIS)
+#if defined(ENABLE_WEBRTC)
P2PSocketDispatcher* socket_dispatcher =
render_view_->p2p_socket_dispatcher();
if (socket_dispatcher)
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index b31576c..f37da15 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -599,12 +599,9 @@ RenderViewImpl::RenderViewImpl(
host_window_ = parent_hwnd;
-#if defined(ENABLE_P2P_APIS)
+#if defined(ENABLE_WEBRTC)
if (!p2p_socket_dispatcher_)
p2p_socket_dispatcher_ = new content::P2PSocketDispatcher(this);
-#endif
-
-#if defined(ENABLE_WEBRTC)
if (!media_stream_dispatcher_)
media_stream_dispatcher_ = new MediaStreamDispatcher(this);
#endif
@@ -3442,12 +3439,10 @@ void RenderViewImpl::EnsureMediaStreamImpl() {
if (!RenderThreadImpl::current()) // Will be NULL during unit tests.
return;
-#if defined(ENABLE_P2P_APIS)
+#if defined(ENABLE_WEBRTC)
if (!p2p_socket_dispatcher_)
p2p_socket_dispatcher_ = new content::P2PSocketDispatcher(this);
-#endif
-#if defined(ENABLE_WEBRTC)
if (!media_stream_dispatcher_)
media_stream_dispatcher_ = new MediaStreamDispatcher(this);
diff --git a/ppapi/api/dev/ppb_transport_dev.idl b/ppapi/api/dev/ppb_transport_dev.idl
deleted file mode 100644
index 24d552e..0000000
--- a/ppapi/api/dev/ppb_transport_dev.idl
+++ /dev/null
@@ -1,183 +0,0 @@
-/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/**
- * This file defines the <code>PPB_Transport_Dev</code> interface.
- */
-label Chrome {
- M14 = 0.7
-};
-
-[assert_size(4)]
-enum PP_TransportType {
- PP_TRANSPORTTYPE_DATAGRAM = 0,
- PP_TRANSPORTTYPE_STREAM = 1
-};
-
-[assert_size(4)]
-enum PP_TransportProperty {
- /**
- * STUN server address and port, e.g "stun.example.com:19302".
- */
- PP_TRANSPORTPROPERTY_STUN_SERVER = 0,
-
- /**
- * Relay server address and port, e.g. "relay.example.com:12344".
- */
- PP_TRANSPORTPROPERTY_RELAY_SERVER = 1,
-
- /**
- * Username for the relay server.
- */
- PP_TRANSPORTPROPERTY_RELAY_USERNAME = 2,
-
- /**
- * Password for the relay server.
- */
- PP_TRANSPORTPROPERTY_RELAY_PASSWORD = 3,
-
- /**
- * Type of Relay server. Must be one of the PP_TransportRelayMode values. By
- * default is set to PP_TRANSPORTRELAYMODE_TURN.
- */
- PP_TRANSPORTPROPERTY_RELAY_MODE = 4,
-
- /**
- * TCP receive window in bytes. Takes effect only for PseudoTCP connections.
- */
- PP_TRANSPORTPROPERTY_TCP_RECEIVE_WINDOW = 5,
-
- /**
- * TCP send window in bytes. Takes effect only for PseudoTCP connections.
- */
- PP_TRANSPORTPROPERTY_TCP_SEND_WINDOW = 6,
-
- /**
- * Boolean value that disables Neagle's algorithm when set to true. When
- * Neagle's algorithm is disabled, all outgoing packets are sent as soon as
- * possible. When set to false (by default) data may be buffered until there
- * is a sufficient amount to send.
- */
- PP_TRANSPORTPROPERTY_TCP_NO_DELAY = 7,
-
- /**
- * Delay for ACK packets in milliseconds. By default set to 100ms.
- */
- PP_TRANSPORTPROPERTY_TCP_ACK_DELAY = 8,
-
- /**
- * Boolean value that disables TCP-based transports when set to true. By
- * default set to false.
- */
- PP_TRANSPORTPROPERTY_DISABLE_TCP_TRANSPORT = 9
-};
-
-[assert_size(4)]
-enum PP_TransportRelayMode {
- /**
- * RFC5766 compliant relay server.
- */
- PP_TRANSPORTRELAYMODE_TURN = 0,
-
- /**
- * Legacy Google relay server.
- */
- PP_TRANSPORTRELAYMODE_GOOGLE = 1
-};
-
-/**
- * The transport interface provides peer-to-peer communication.
- *
- * TODO(juberti): other getters/setters
- * connect state
- * connect type, protocol
- * RTT
- */
-interface PPB_Transport_Dev {
- /**
- * Creates a new transport object with the specified name using the
- * specified protocol.
- */
- PP_Resource CreateTransport(
- [in] PP_Instance instance,
- [in] str_t name,
- [in] PP_TransportType type);
-
- /**
- * Returns PP_TRUE if resource is a Transport, PP_FALSE otherwise.
- */
- PP_Bool IsTransport(
- [in] PP_Resource resource);
-
- /**
- * Returns PP_TRUE if the transport is currently writable (i.e. can
- * send data to the remote peer), PP_FALSE otherwise.
- */
- PP_Bool IsWritable(
- [in] PP_Resource transport);
-
- /**
- * Sets various configuration properties of the transport.
- */
- int32_t SetProperty(
- [in] PP_Resource transport,
- [in] PP_TransportProperty property,
- [in] PP_Var value);
-
- /**
- * Establishes a connection to the remote peer. Returns
- * PP_OK_COMPLETIONPENDING and notifies on |cb| when connectivity is
- * established (or timeout occurs).
- */
- int32_t Connect(
- [in] PP_Resource transport,
- [in] PP_CompletionCallback cb);
-
- /**
- * Obtains another ICE candidate address to be provided to the
- * remote peer. Returns PP_OK_COMPLETIONPENDING if there are no more
- * addresses to be sent. After the callback is called
- * GetNextAddress() must be called again to get the address.
- */
- int32_t GetNextAddress(
- [in] PP_Resource transport,
- [out] PP_Var address,
- [in] PP_CompletionCallback cb);
-
- /**
- * Provides an ICE candidate address that was received from the remote peer.
- */
- int32_t ReceiveRemoteAddress(
- [in] PP_Resource transport,
- [in] PP_Var address);
-
- /**
- * Like recv(), receives data. Returns PP_OK_COMPLETIONPENDING if there is
- * currently no data to receive. In that case, the |data| pointer should
- * remain valid until the callback is called.
- */
- int32_t Recv(
- [in] PP_Resource transport,
- [out] mem_t data,
- [in] uint32_t len,
- [in] PP_CompletionCallback cb);
-
- /**
- * Like send(), sends data. Returns PP_OK_COMPLETIONPENDING if the socket is
- * currently flow-controlled. In that case, the |data| pointer should remain
- * valid until the callback is called.
- */
- int32_t Send(
- [in] PP_Resource transport,
- [in] mem_t data,
- [in] uint32_t len,
- [in] PP_CompletionCallback cb);
-
- /**
- * Disconnects from the remote peer.
- */
- int32_t Close(
- [in] PP_Resource transport);
-};
diff --git a/ppapi/c/dev/ppb_transport_dev.h b/ppapi/c/dev/ppb_transport_dev.h
deleted file mode 100644
index 47c4f3c..0000000
--- a/ppapi/c/dev/ppb_transport_dev.h
+++ /dev/null
@@ -1,186 +0,0 @@
-/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* From dev/ppb_transport_dev.idl modified Wed Oct 5 14:06:02 2011. */
-
-#ifndef PPAPI_C_DEV_PPB_TRANSPORT_DEV_H_
-#define PPAPI_C_DEV_PPB_TRANSPORT_DEV_H_
-
-#include "ppapi/c/pp_bool.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_macros.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/pp_stdint.h"
-#include "ppapi/c/pp_var.h"
-
-#define PPB_TRANSPORT_DEV_INTERFACE_0_7 "PPB_Transport(Dev);0.7"
-#define PPB_TRANSPORT_DEV_INTERFACE PPB_TRANSPORT_DEV_INTERFACE_0_7
-
-/**
- * @file
- * This file defines the <code>PPB_Transport_Dev</code> interface.
- */
-
-
-/**
- * @addtogroup Enums
- * @{
- */
-typedef enum {
- PP_TRANSPORTTYPE_DATAGRAM = 0,
- PP_TRANSPORTTYPE_STREAM = 1
-} PP_TransportType;
-PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TransportType, 4);
-
-typedef enum {
- /**
- * STUN server address and port, e.g "stun.example.com:19302".
- */
- PP_TRANSPORTPROPERTY_STUN_SERVER = 0,
- /**
- * Relay server address and port, e.g. "relay.example.com:12344".
- */
- PP_TRANSPORTPROPERTY_RELAY_SERVER = 1,
- /**
- * Username for the relay server.
- */
- PP_TRANSPORTPROPERTY_RELAY_USERNAME = 2,
- /**
- * Password for the relay server.
- */
- PP_TRANSPORTPROPERTY_RELAY_PASSWORD = 3,
- /**
- * Type of Relay server. Must be one of the PP_TransportRelayMode values. By
- * default is set to PP_TRANSPORTRELAYMODE_TURN.
- */
- PP_TRANSPORTPROPERTY_RELAY_MODE = 4,
- /**
- * TCP receive window in bytes. Takes effect only for PseudoTCP connections.
- */
- PP_TRANSPORTPROPERTY_TCP_RECEIVE_WINDOW = 5,
- /**
- * TCP send window in bytes. Takes effect only for PseudoTCP connections.
- */
- PP_TRANSPORTPROPERTY_TCP_SEND_WINDOW = 6,
- /**
- * Boolean value that disables Neagle's algorithm when set to true. When
- * Neagle's algorithm is disabled, all outgoing packets are sent as soon as
- * possible. When set to false (by default) data may be buffered until there
- * is a sufficient amount to send.
- */
- PP_TRANSPORTPROPERTY_TCP_NO_DELAY = 7,
- /**
- * Delay for ACK packets in milliseconds. By default set to 100ms.
- */
- PP_TRANSPORTPROPERTY_TCP_ACK_DELAY = 8,
- /**
- * Boolean value that disables TCP-based transports when set to true. By
- * default set to false.
- */
- PP_TRANSPORTPROPERTY_DISABLE_TCP_TRANSPORT = 9
-} PP_TransportProperty;
-PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TransportProperty, 4);
-
-typedef enum {
- /**
- * RFC5766 compliant relay server.
- */
- PP_TRANSPORTRELAYMODE_TURN = 0,
- /**
- * Legacy Google relay server.
- */
- PP_TRANSPORTRELAYMODE_GOOGLE = 1
-} PP_TransportRelayMode;
-PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TransportRelayMode, 4);
-/**
- * @}
- */
-
-/**
- * @addtogroup Interfaces
- * @{
- */
-/**
- * The transport interface provides peer-to-peer communication.
- *
- * TODO(juberti): other getters/setters
- * connect state
- * connect type, protocol
- * RTT
- */
-struct PPB_Transport_Dev_0_7 {
- /**
- * Creates a new transport object with the specified name using the
- * specified protocol.
- */
- PP_Resource (*CreateTransport)(PP_Instance instance,
- const char* name,
- PP_TransportType type);
- /**
- * Returns PP_TRUE if resource is a Transport, PP_FALSE otherwise.
- */
- PP_Bool (*IsTransport)(PP_Resource resource);
- /**
- * Returns PP_TRUE if the transport is currently writable (i.e. can
- * send data to the remote peer), PP_FALSE otherwise.
- */
- PP_Bool (*IsWritable)(PP_Resource transport);
- /**
- * Sets various configuration properties of the transport.
- */
- int32_t (*SetProperty)(PP_Resource transport,
- PP_TransportProperty property,
- struct PP_Var value);
- /**
- * Establishes a connection to the remote peer. Returns
- * PP_OK_COMPLETIONPENDING and notifies on |cb| when connectivity is
- * established (or timeout occurs).
- */
- int32_t (*Connect)(PP_Resource transport, struct PP_CompletionCallback cb);
- /**
- * Obtains another ICE candidate address to be provided to the
- * remote peer. Returns PP_OK_COMPLETIONPENDING if there are no more
- * addresses to be sent. After the callback is called
- * GetNextAddress() must be called again to get the address.
- */
- int32_t (*GetNextAddress)(PP_Resource transport,
- struct PP_Var* address,
- struct PP_CompletionCallback cb);
- /**
- * Provides an ICE candidate address that was received from the remote peer.
- */
- int32_t (*ReceiveRemoteAddress)(PP_Resource transport, struct PP_Var address);
- /**
- * Like recv(), receives data. Returns PP_OK_COMPLETIONPENDING if there is
- * currently no data to receive. In that case, the |data| pointer should
- * remain valid until the callback is called.
- */
- int32_t (*Recv)(PP_Resource transport,
- void* data,
- uint32_t len,
- struct PP_CompletionCallback cb);
- /**
- * Like send(), sends data. Returns PP_OK_COMPLETIONPENDING if the socket is
- * currently flow-controlled. In that case, the |data| pointer should remain
- * valid until the callback is called.
- */
- int32_t (*Send)(PP_Resource transport,
- const void* data,
- uint32_t len,
- struct PP_CompletionCallback cb);
- /**
- * Disconnects from the remote peer.
- */
- int32_t (*Close)(PP_Resource transport);
-};
-
-typedef struct PPB_Transport_Dev_0_7 PPB_Transport_Dev;
-/**
- * @}
- */
-
-#endif /* PPAPI_C_DEV_PPB_TRANSPORT_DEV_H_ */
-
diff --git a/ppapi/cpp/dev/transport_dev.cc b/ppapi/cpp/dev/transport_dev.cc
deleted file mode 100644
index c1153b8..0000000
--- a/ppapi/cpp/dev/transport_dev.cc
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ppapi/cpp/dev/transport_dev.h"
-
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/cpp/instance_handle.h"
-#include "ppapi/cpp/resource.h"
-#include "ppapi/cpp/module.h"
-#include "ppapi/cpp/module_impl.h"
-#include "ppapi/cpp/var.h"
-
-namespace pp {
-
-namespace {
-
-template <> const char* interface_name<PPB_Transport_Dev>() {
- return PPB_TRANSPORT_DEV_INTERFACE;
-}
-
-} // namespace
-
-Transport_Dev::Transport_Dev(const InstanceHandle& instance,
- const char* name,
- PP_TransportType type) {
- if (has_interface<PPB_Transport_Dev>())
- PassRefFromConstructor(get_interface<PPB_Transport_Dev>()->CreateTransport(
- instance.pp_instance(), name, type));
-}
-
-bool Transport_Dev::IsWritable() {
- if (!has_interface<PPB_Transport_Dev>())
- return false;
- return PP_ToBool(
- get_interface<PPB_Transport_Dev>()->IsWritable(pp_resource()));
-}
-
-int32_t Transport_Dev::SetProperty(PP_TransportProperty property,
- const Var& value) {
- if (!has_interface<PPB_Transport_Dev>())
- return PP_ERROR_NOINTERFACE;
- return get_interface<PPB_Transport_Dev>()->SetProperty(
- pp_resource(), property, value.pp_var());
-}
-
-int32_t Transport_Dev::Connect(const CompletionCallback& cc) {
- if (!has_interface<PPB_Transport_Dev>())
- return cc.MayForce(PP_ERROR_NOINTERFACE);
- return get_interface<PPB_Transport_Dev>()->Connect(
- pp_resource(), cc.pp_completion_callback());
-}
-
-int32_t Transport_Dev::GetNextAddress(Var* address,
- const CompletionCallback& cc) {
- if (!has_interface<PPB_Transport_Dev>())
- return cc.MayForce(PP_ERROR_NOINTERFACE);
- PP_Var temp_address = PP_MakeUndefined();
- int32_t ret_val = get_interface<PPB_Transport_Dev>()->GetNextAddress(
- pp_resource(), &temp_address, cc.pp_completion_callback());
- *address = Var(PASS_REF, temp_address);
- return ret_val;
-}
-
-int32_t Transport_Dev::ReceiveRemoteAddress(const pp::Var& address) {
- if (!has_interface<PPB_Transport_Dev>())
- return PP_ERROR_NOINTERFACE;
- return get_interface<PPB_Transport_Dev>()->ReceiveRemoteAddress(
- pp_resource(), address.pp_var());
-}
-
-int32_t Transport_Dev::Recv(void* data, uint32_t len,
- const CompletionCallback& cc) {
- if (!has_interface<PPB_Transport_Dev>())
- return cc.MayForce(PP_ERROR_NOINTERFACE);
- return get_interface<PPB_Transport_Dev>()->Recv(
- pp_resource(), data, len, cc.pp_completion_callback());
-}
-
-int32_t Transport_Dev::Send(const void* data, uint32_t len,
- const CompletionCallback& cc) {
- if (!has_interface<PPB_Transport_Dev>())
- return cc.MayForce(PP_ERROR_NOINTERFACE);
- return get_interface<PPB_Transport_Dev>()->Send(
- pp_resource(), data, len, cc.pp_completion_callback());
-}
-
-int32_t Transport_Dev::Close() {
- if (!has_interface<PPB_Transport_Dev>())
- return PP_ERROR_NOINTERFACE;
- return get_interface<PPB_Transport_Dev>()->Close(pp_resource());
-}
-
-} // namespace pp
diff --git a/ppapi/cpp/dev/transport_dev.h b/ppapi/cpp/dev/transport_dev.h
deleted file mode 100644
index 8545583..0000000
--- a/ppapi/cpp/dev/transport_dev.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef PPAPI_CPP_DEV_TRANSPORT_DEV_H_
-#define PPAPI_CPP_DEV_TRANSPORT_DEV_H_
-
-#include "ppapi/c/dev/ppb_transport_dev.h"
-#include "ppapi/cpp/completion_callback.h"
-#include "ppapi/cpp/resource.h"
-
-namespace pp {
-
-class InstanceHandle;
-class Var;
-
-class Transport_Dev : public Resource {
- public:
- Transport_Dev(const InstanceHandle& instance,
- const char* name,
- PP_TransportType type);
-
- bool IsWritable();
- int32_t SetProperty(PP_TransportProperty property, const Var& value);
- int32_t Connect(const CompletionCallback& cc);
- int32_t GetNextAddress(pp::Var* address, const CompletionCallback& cc);
- int32_t ReceiveRemoteAddress(const pp::Var& address);
- int32_t Recv(void* data, uint32_t len,
- const CompletionCallback& cc);
- int32_t Send(const void* data, uint32_t len,
- const CompletionCallback& cb);
- int32_t Close();
-};
-
-} // namespace pp
-
-#endif // PPAPI_CPP_DEV_TRANSPORT_DEV_H_
diff --git a/ppapi/ppapi_proxy_untrusted.gypi b/ppapi/ppapi_proxy_untrusted.gypi
index c6d117a..4f86d63 100644
--- a/ppapi/ppapi_proxy_untrusted.gypi
+++ b/ppapi/ppapi_proxy_untrusted.gypi
@@ -323,7 +323,6 @@
# 'thunk/ppb_tcp_server_socket_private_thunk.cc',
# 'thunk/ppb_tcp_socket_private_thunk.cc',
'thunk/ppb_text_input_thunk.cc',
-# 'thunk/ppb_transport_thunk.cc',
# 'thunk/ppb_udp_socket_private_thunk.cc',
'thunk/ppb_url_loader_thunk.cc',
'thunk/ppb_url_request_info_thunk.cc',
diff --git a/ppapi/ppapi_shared.gypi b/ppapi/ppapi_shared.gypi
index f04a0c6..d9d0140 100644
--- a/ppapi/ppapi_shared.gypi
+++ b/ppapi/ppapi_shared.gypi
@@ -231,8 +231,6 @@
'thunk/ppb_tcp_socket_private_api.h',
'thunk/ppb_tcp_socket_private_thunk.cc',
'thunk/ppb_text_input_thunk.cc',
- 'thunk/ppb_transport_api.h',
- 'thunk/ppb_transport_thunk.cc',
'thunk/ppb_udp_socket_private_api.h',
'thunk/ppb_udp_socket_private_thunk.cc',
'thunk/ppb_url_loader_api.h',
diff --git a/ppapi/ppapi_sources.gypi b/ppapi/ppapi_sources.gypi
index 6e6d617..6b14eaf 100644
--- a/ppapi/ppapi_sources.gypi
+++ b/ppapi/ppapi_sources.gypi
@@ -443,17 +443,4 @@
'tests/test_var_deprecated.h',
],
},
- 'conditions': [
- ['p2p_apis==1', {
- 'variables': {
- 'c_source_files': [
- 'c/dev/ppb_transport_dev.h',
- ],
- 'cpp_source_files': [
- 'cpp/dev/transport_dev.cc',
- 'cpp/dev/transport_dev.h',
- ],
- },
- }],
- ],
}
diff --git a/ppapi/ppapi_tests.gypi b/ppapi/ppapi_tests.gypi
index 10f30e6..9956c66 100644
--- a/ppapi/ppapi_tests.gypi
+++ b/ppapi/ppapi_tests.gypi
@@ -94,12 +94,6 @@
'product_name': 'ppapi_tests',
'product_extension': 'plugin',
}],
- ['p2p_apis==1', {
- 'sources': [
- 'tests/test_transport.cc',
- 'tests/test_transport.h',
- ],
- }],
],
# TODO(dmichael): Figure out what is wrong with the script on Windows and add
# it as an automated action.
diff --git a/ppapi/proxy/resource_creation_proxy.cc b/ppapi/proxy/resource_creation_proxy.cc
index 41a6c7c..f25d9de 100644
--- a/ppapi/proxy/resource_creation_proxy.cc
+++ b/ppapi/proxy/resource_creation_proxy.cc
@@ -296,13 +296,6 @@ PP_Resource ResourceCreationProxy::CreateTCPSocketPrivate(
return PPB_TCPSocket_Private_Proxy::CreateProxyResource(instance);
}
-PP_Resource ResourceCreationProxy::CreateTransport(PP_Instance instance,
- const char* name,
- PP_TransportType type) {
- NOTIMPLEMENTED(); // Not proxied yet.
- return 0;
-}
-
PP_Resource ResourceCreationProxy::CreateUDPSocketPrivate(
PP_Instance instance) {
return PPB_UDPSocket_Private_Proxy::CreateProxyResource(instance);
diff --git a/ppapi/proxy/resource_creation_proxy.h b/ppapi/proxy/resource_creation_proxy.h
index d6a2e76..9c18f27 100644
--- a/ppapi/proxy/resource_creation_proxy.h
+++ b/ppapi/proxy/resource_creation_proxy.h
@@ -135,9 +135,6 @@ class ResourceCreationProxy : public InterfaceProxy,
virtual PP_Resource CreateTCPServerSocketPrivate(
PP_Instance instance) OVERRIDE;
virtual PP_Resource CreateTCPSocketPrivate(PP_Instance instance) OVERRIDE;
- virtual PP_Resource CreateTransport(PP_Instance instance,
- const char* name,
- PP_TransportType type) OVERRIDE;
virtual PP_Resource CreateUDPSocketPrivate(PP_Instance instance) OVERRIDE;
virtual PP_Resource CreateVideoCapture(PP_Instance instance) OVERRIDE;
virtual PP_Resource CreateVideoDecoder(
diff --git a/ppapi/shared_impl/resource.h b/ppapi/shared_impl/resource.h
index 5b03f53..f920262 100644
--- a/ppapi/shared_impl/resource.h
+++ b/ppapi/shared_impl/resource.h
@@ -52,7 +52,6 @@
F(PPB_Talk_Private_API) \
F(PPB_TCPServerSocket_Private_API) \
F(PPB_TCPSocket_Private_API) \
- F(PPB_Transport_API) \
F(PPB_UDPSocket_Private_API) \
F(PPB_URLLoader_API) \
F(PPB_URLRequestInfo_API) \
diff --git a/ppapi/tests/all_c_includes.h b/ppapi/tests/all_c_includes.h
index 0732ded..d4f3a0c 100644
--- a/ppapi/tests/all_c_includes.h
+++ b/ppapi/tests/all_c_includes.h
@@ -29,7 +29,6 @@
#include "ppapi/c/dev/ppb_scrollbar_dev.h"
#include "ppapi/c/dev/ppb_testing_dev.h"
#include "ppapi/c/dev/ppb_text_input_dev.h"
-#include "ppapi/c/dev/ppb_transport_dev.h"
#include "ppapi/c/dev/ppb_url_util_dev.h"
#include "ppapi/c/dev/ppb_var_deprecated.h"
#include "ppapi/c/dev/ppb_video_decoder_dev.h"
diff --git a/ppapi/tests/all_cpp_includes.h b/ppapi/tests/all_cpp_includes.h
index 0db1b77..0aca7aa 100644
--- a/ppapi/tests/all_cpp_includes.h
+++ b/ppapi/tests/all_cpp_includes.h
@@ -28,7 +28,6 @@
#include "ppapi/cpp/dev/scrollbar_dev.h"
#include "ppapi/cpp/dev/selection_dev.h"
#include "ppapi/cpp/dev/text_input_dev.h"
-#include "ppapi/cpp/dev/transport_dev.h"
#include "ppapi/cpp/dev/url_util_dev.h"
#include "ppapi/cpp/dev/video_decoder_dev.h"
#include "ppapi/cpp/dev/widget_client_dev.h"
diff --git a/ppapi/tests/test_transport.cc b/ppapi/tests/test_transport.cc
deleted file mode 100644
index d8bb134..0000000
--- a/ppapi/tests/test_transport.cc
+++ /dev/null
@@ -1,373 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ppapi/tests/test_transport.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <list>
-#include <map>
-
-#include "ppapi/c/dev/ppb_testing_dev.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/pp_macros.h"
-#include "ppapi/cpp/dev/transport_dev.h"
-#include "ppapi/cpp/instance.h"
-#include "ppapi/cpp/module.h"
-#include "ppapi/cpp/var.h"
-#include "ppapi/tests/test_utils.h"
-#include "ppapi/tests/testing_instance.h"
-#include "ppapi/utility/completion_callback_factory.h"
-
-REGISTER_TEST_CASE(Transport);
-
-namespace {
-
-const char kTestChannelName[] = "test";
-const int kReadBufferSize = 65536;
-
-class StreamReader {
- public:
- StreamReader(pp::Transport_Dev* transport,
- int expected_size,
- pp::CompletionCallback done_callback)
- : expected_size_(expected_size),
- done_callback_(done_callback),
- PP_ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)),
- transport_(transport),
- received_size_(0) {
- Read();
- }
-
- const std::list<std::vector<char> >& received() { return received_; }
- std::list<std::string> errors() { return errors_; }
-
- private:
- void Read() {
- while (true) {
- buffer_.resize(kReadBufferSize);
- int result = transport_->Recv(
- &buffer_[0], buffer_.size(),
- callback_factory_.NewOptionalCallback(&StreamReader::OnReadFinished));
- if (result > 0)
- DidFinishRead(result);
- else
- break;
- }
- }
-
- void OnReadFinished(int result) {
- DidFinishRead(result);
- if (result > 0)
- Read();
- }
-
- void DidFinishRead(int result) {
- if (result > 0) {
- if (result > static_cast<int>(buffer_.size())) {
- errors_.push_back(TestCase::MakeFailureMessage(
- __FILE__, __LINE__,
- "Recv() returned value that is bigger than the buffer."));
- }
- buffer_.resize(result);
- received_.push_back(buffer_);
- received_size_ += buffer_.size();
- if (received_size_ >= expected_size_)
- done_callback_.Run(0);
- }
- }
-
- int expected_size_;
- pp::CompletionCallback done_callback_;
- pp::CompletionCallbackFactory<StreamReader> callback_factory_;
- pp::Transport_Dev* transport_;
- std::vector<char> buffer_;
- std::list<std::vector<char> > received_;
- int received_size_;
- std::list<std::string> errors_;
-};
-
-} // namespace
-
-TestTransport::~TestTransport() {
- delete transport1_;
- delete transport2_;
-}
-
-bool TestTransport::Init() {
- transport_interface_ = static_cast<const PPB_Transport_Dev*>(
- pp::Module::Get()->GetBrowserInterface(PPB_TRANSPORT_DEV_INTERFACE));
- return transport_interface_ && CheckTestingInterface();
-}
-
-void TestTransport::RunTests(const std::string& filter) {
- RUN_TEST(Create, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(Connect, filter);
- RUN_TEST(SetProperty, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(SendDataUdp, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(SendDataTcp, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(ConnectAndCloseUdp, filter);
- RUN_TEST_FORCEASYNC_AND_NOT(ConnectAndCloseTcp, filter);
-}
-
-std::string TestTransport::InitTargets(PP_TransportType type) {
- transport1_ = new pp::Transport_Dev(instance_, kTestChannelName, type);
- transport2_ = new pp::Transport_Dev(instance_, kTestChannelName, type);
-
- ASSERT_NE(NULL, transport1_);
- ASSERT_NE(NULL, transport2_);
-
- PASS();
-}
-
-std::string TestTransport::Connect() {
- TestCompletionCallback connect_cb1(instance_->pp_instance());
- TestCompletionCallback connect_cb2(instance_->pp_instance());
- ASSERT_EQ(transport1_->Connect(connect_cb1), PP_OK_COMPLETIONPENDING);
- ASSERT_EQ(transport2_->Connect(connect_cb2), PP_OK_COMPLETIONPENDING);
-
- pp::Var address1;
- pp::Var address2;
- TestCompletionCallback next_address_cb1(instance_->pp_instance());
- TestCompletionCallback next_address_cb2(instance_->pp_instance());
- ASSERT_EQ(transport1_->GetNextAddress(&address1, next_address_cb1),
- PP_OK_COMPLETIONPENDING);
- ASSERT_EQ(transport2_->GetNextAddress(&address2, next_address_cb2),
- PP_OK_COMPLETIONPENDING);
- ASSERT_EQ(next_address_cb1.WaitForResult(), PP_OK);
- ASSERT_EQ(next_address_cb2.WaitForResult(), PP_OK);
- ASSERT_EQ(transport1_->GetNextAddress(&address1, next_address_cb1), PP_OK);
- ASSERT_EQ(transport2_->GetNextAddress(&address2, next_address_cb2), PP_OK);
-
- ASSERT_EQ(transport1_->ReceiveRemoteAddress(address2), PP_OK);
- ASSERT_EQ(transport2_->ReceiveRemoteAddress(address1), PP_OK);
-
-
- ASSERT_EQ(connect_cb1.WaitForResult(), PP_OK);
- ASSERT_EQ(connect_cb2.WaitForResult(), PP_OK);
-
- ASSERT_TRUE(transport1_->IsWritable());
- ASSERT_TRUE(transport2_->IsWritable());
-
- PASS();
-}
-
-std::string TestTransport::Clean() {
- delete transport1_;
- transport1_ = NULL;
- delete transport2_;
- transport2_ = NULL;
-
- PASS();
-}
-
-std::string TestTransport::TestCreate() {
- ASSERT_SUBTEST_SUCCESS(InitTargets(PP_TRANSPORTTYPE_DATAGRAM));
-
- Clean();
-
- PASS();
-}
-
-std::string TestTransport::TestSetProperty() {
- ASSERT_SUBTEST_SUCCESS(InitTargets(PP_TRANSPORTTYPE_STREAM));
-
- // Try settings STUN and Relay properties.
- ASSERT_EQ(transport1_->SetProperty(
- PP_TRANSPORTPROPERTY_STUN_SERVER,
- pp::Var("stun.example.com:19302")), PP_OK);
-
- ASSERT_EQ(transport1_->SetProperty(
- PP_TRANSPORTPROPERTY_RELAY_SERVER,
- pp::Var("ralay.example.com:80")), PP_OK);
-
- ASSERT_EQ(transport1_->SetProperty(
- PP_TRANSPORTPROPERTY_RELAY_USERNAME,
- pp::Var("USERNAME")), PP_OK);
- ASSERT_EQ(transport1_->SetProperty(
- PP_TRANSPORTPROPERTY_RELAY_PASSWORD,
- pp::Var("PASSWORD")), PP_OK);
-
- // Try changing TCP window size.
- ASSERT_EQ(transport1_->SetProperty(PP_TRANSPORTPROPERTY_TCP_RECEIVE_WINDOW,
- pp::Var(65536)), PP_OK);
- ASSERT_EQ(transport1_->SetProperty(PP_TRANSPORTPROPERTY_TCP_RECEIVE_WINDOW,
- pp::Var(10000000)), PP_ERROR_BADARGUMENT);
-
- ASSERT_EQ(transport1_->SetProperty(PP_TRANSPORTPROPERTY_TCP_SEND_WINDOW,
- pp::Var(65536)), PP_OK);
- ASSERT_EQ(transport1_->SetProperty(PP_TRANSPORTPROPERTY_TCP_SEND_WINDOW,
- pp::Var(10000000)), PP_ERROR_BADARGUMENT);
-
- ASSERT_EQ(transport1_->SetProperty(PP_TRANSPORTPROPERTY_TCP_NO_DELAY,
- pp::Var(true)), PP_OK);
-
- ASSERT_EQ(transport1_->SetProperty(PP_TRANSPORTPROPERTY_TCP_ACK_DELAY,
- pp::Var(10)), PP_OK);
- ASSERT_EQ(transport1_->SetProperty(PP_TRANSPORTPROPERTY_TCP_ACK_DELAY,
- pp::Var(10000)), PP_ERROR_BADARGUMENT);
-
- TestCompletionCallback connect_cb(instance_->pp_instance());
- ASSERT_EQ(transport1_->Connect(connect_cb), PP_OK_COMPLETIONPENDING);
-
- // SetProperty() should fail after we've connected.
- ASSERT_EQ(transport1_->SetProperty(
- PP_TRANSPORTPROPERTY_STUN_SERVER,
- pp::Var("stun.example.com:31323")), PP_ERROR_FAILED);
-
- Clean();
- ASSERT_EQ(connect_cb.WaitForResult(), PP_ERROR_ABORTED);
-
- PASS();
-}
-
-std::string TestTransport::TestConnect() {
- ASSERT_SUBTEST_SUCCESS(InitTargets(PP_TRANSPORTTYPE_DATAGRAM));
- ASSERT_SUBTEST_SUCCESS(Connect());
-
- Clean();
-
- PASS();
-}
-
-// Creating datagram connection and try sending data over it. Verify
-// that at least some packets are received (some packets may be lost).
-std::string TestTransport::TestSendDataUdp() {
- ASSERT_SUBTEST_SUCCESS(InitTargets(PP_TRANSPORTTYPE_DATAGRAM));
- ASSERT_SUBTEST_SUCCESS(Connect());
-
- const int kNumPackets = 100;
- const int kSendBufferSize = 1200;
- const int kUdpWaitTimeMs = 1000; // 1 second.
-
- TestCompletionCallback done_cb(instance_->pp_instance());
- StreamReader reader(transport1_, kSendBufferSize * kNumPackets, done_cb);
-
- std::map<int, std::vector<char> > sent_packets;
- for (int i = 0; i < kNumPackets; ++i) {
- std::vector<char> send_buffer(kSendBufferSize);
- for (size_t j = 0; j < send_buffer.size(); ++j) {
- send_buffer[j] = rand() % 256;
- }
- // Put packet index in the beginning.
- memcpy(&send_buffer[0], &i, sizeof(i));
-
- TestCompletionCallback send_cb(instance_->pp_instance(), force_async_);
- int32_t result = transport2_->Send(&send_buffer[0], send_buffer.size(),
- send_cb);
- if (force_async_) {
- ASSERT_EQ(result, PP_OK_COMPLETIONPENDING);
- ASSERT_EQ(send_cb.WaitForResult(), static_cast<int>(send_buffer.size()));
- } else {
- ASSERT_EQ(result, static_cast<int>(send_buffer.size()));
- }
- sent_packets[i] = send_buffer;
- }
-
- // Limit waiting time.
- TestCompletionCallback timeout_cb(instance_->pp_instance());
- pp::Module::Get()->core()->CallOnMainThread(kUdpWaitTimeMs, timeout_cb);
- ASSERT_EQ(timeout_cb.WaitForResult(), PP_OK);
-
- ASSERT_TRUE(reader.errors().size() == 0);
- ASSERT_TRUE(reader.received().size() > 0);
- for (std::list<std::vector<char> >::const_iterator it =
- reader.received().begin(); it != reader.received().end(); ++it) {
- int index;
- memcpy(&index, &(*it)[0], sizeof(index));
- ASSERT_TRUE(sent_packets[index] == *it);
- }
-
- Clean();
-
- PASS();
-}
-
-// Creating reliable (TCP-like) connection and try sending data over
-// it. Verify that all data is received correctly.
-std::string TestTransport::TestSendDataTcp() {
- ASSERT_SUBTEST_SUCCESS(InitTargets(PP_TRANSPORTTYPE_STREAM));
- ASSERT_SUBTEST_SUCCESS(Connect());
-
- const int kTcpSendSize = 100000;
-
- TestCompletionCallback done_cb(instance_->pp_instance());
- StreamReader reader(transport1_, kTcpSendSize, done_cb);
-
- std::vector<char> send_buffer(kTcpSendSize);
- for (size_t j = 0; j < send_buffer.size(); ++j) {
- send_buffer[j] = rand() % 256;
- }
-
- int pos = 0;
- while (pos < static_cast<int>(send_buffer.size())) {
- TestCompletionCallback send_cb(instance_->pp_instance(), force_async_);
- int result = transport2_->Send(
- &send_buffer[0] + pos, send_buffer.size() - pos, send_cb);
- if (force_async_)
- ASSERT_EQ(result, PP_OK_COMPLETIONPENDING);
- if (result == PP_OK_COMPLETIONPENDING)
- result = send_cb.WaitForResult();
- ASSERT_TRUE(result > 0);
- pos += result;
- }
-
- ASSERT_EQ(done_cb.WaitForResult(), PP_OK);
-
- ASSERT_TRUE(reader.errors().size() == 0);
-
- std::vector<char> received_data;
- for (std::list<std::vector<char> >::const_iterator it =
- reader.received().begin(); it != reader.received().end(); ++it) {
- received_data.insert(received_data.end(), it->begin(), it->end());
- }
- ASSERT_EQ(send_buffer, received_data);
-
- Clean();
-
- PASS();
-}
-
-std::string TestTransport::TestConnectAndCloseUdp() {
- ASSERT_SUBTEST_SUCCESS(InitTargets(PP_TRANSPORTTYPE_DATAGRAM));
- ASSERT_SUBTEST_SUCCESS(Connect());
-
- std::vector<char> recv_buffer(kReadBufferSize);
- TestCompletionCallback recv_cb(instance_->pp_instance());
- ASSERT_EQ(
- transport1_->Recv(&recv_buffer[0], recv_buffer.size(), recv_cb),
- PP_OK_COMPLETIONPENDING);
-
- // Close the transport and verify that callback is aborted.
- ASSERT_EQ(transport1_->Close(), PP_OK);
-
- ASSERT_EQ(recv_cb.run_count(), 1);
- ASSERT_EQ(recv_cb.result(), PP_ERROR_ABORTED);
-
- Clean();
-
- PASS();
-}
-
-std::string TestTransport::TestConnectAndCloseTcp() {
- ASSERT_SUBTEST_SUCCESS(InitTargets(PP_TRANSPORTTYPE_STREAM));
- ASSERT_SUBTEST_SUCCESS(Connect());
-
- std::vector<char> recv_buffer(kReadBufferSize);
- TestCompletionCallback recv_cb(instance_->pp_instance());
- ASSERT_EQ(
- transport1_->Recv(&recv_buffer[0], recv_buffer.size(), recv_cb),
- PP_OK_COMPLETIONPENDING);
-
- // Close the transport and verify that callback is aborted.
- ASSERT_EQ(transport1_->Close(), PP_OK);
-
- ASSERT_EQ(recv_cb.run_count(), 1);
- ASSERT_EQ(recv_cb.result(), PP_ERROR_ABORTED);
-
- Clean();
-
- PASS();
-}
diff --git a/ppapi/tests/test_transport.h b/ppapi/tests/test_transport.h
deleted file mode 100644
index eee1c2d..0000000
--- a/ppapi/tests/test_transport.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef PPAPI_TESTS_TEST_TRANSPORT_H_
-#define PPAPI_TESTS_TEST_TRANSPORT_H_
-
-#include <string>
-
-#include "ppapi/c/dev/ppb_transport_dev.h"
-#include "ppapi/tests/test_case.h"
-
-namespace pp {
-class Transport_Dev;
-} // namespace pp
-
-class TestTransport : public TestCase {
- public:
- explicit TestTransport(TestingInstance* instance)
- : TestCase(instance),
- transport1_(NULL),
- transport2_(NULL) {
- }
- virtual ~TestTransport();
-
-
- // TestCase implementation.
- virtual bool Init();
- virtual void RunTests(const std::string& filter);
-
- private:
- std::string InitTargets(PP_TransportType type);
- std::string Connect();
- std::string Clean();
-
- std::string TestCreate();
- std::string TestConnect();
- std::string TestSetProperty();
- std::string TestSendDataTcp();
- std::string TestSendDataUdp();
- std::string TestConnectAndCloseTcp();
- std::string TestConnectAndCloseUdp();
-
- // Used by the tests that access the C API directly.
- const PPB_Transport_Dev* transport_interface_;
-
- pp::Transport_Dev* transport1_;
- pp::Transport_Dev* transport2_;
-};
-
-#endif // PPAPI_TESTS_TEST_TRANSPORT_H_
diff --git a/ppapi/thunk/interfaces_ppb_public_dev.h b/ppapi/thunk/interfaces_ppb_public_dev.h
index 692b4f3..f23bb48 100644
--- a/ppapi/thunk/interfaces_ppb_public_dev.h
+++ b/ppapi/thunk/interfaces_ppb_public_dev.h
@@ -14,7 +14,6 @@ PROXIED_API(PPB_FileChooser)
PROXIED_API(PPB_Graphics3D)
UNPROXIED_API(PPB_LayerCompositor)
UNPROXIED_API(PPB_Scrollbar)
-UNPROXIED_API(PPB_Transport)
PROXIED_API(PPB_VideoCapture)
PROXIED_API(PPB_VideoDecoder)
UNPROXIED_API(PPB_WebSocket)
@@ -60,8 +59,6 @@ PROXIED_IFACE(PPB_Instance, PPB_TEXTINPUT_DEV_INTERFACE_0_1,
PPB_TextInput_Dev_0_1)
PROXIED_IFACE(PPB_Instance, PPB_TEXTINPUT_DEV_INTERFACE_0_2,
PPB_TextInput_Dev_0_2)
-UNPROXIED_IFACE(PPB_Transport, PPB_TRANSPORT_DEV_INTERFACE_0_7,
- PPB_Transport_Dev_0_7)
PROXIED_IFACE(PPB_VideoCapture, PPB_VIDEOCAPTURE_DEV_INTERFACE_0_1,
PPB_VideoCapture_Dev_0_1)
PROXIED_IFACE(PPB_VideoCapture, PPB_VIDEOCAPTURE_DEV_INTERFACE_0_2,
diff --git a/ppapi/thunk/ppb_transport_api.h b/ppapi/thunk/ppb_transport_api.h
deleted file mode 100644
index 256d920..0000000
--- a/ppapi/thunk/ppb_transport_api.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef PPAPI_THUNK_PPB_TRANSPORT_API_H_
-#define PPAPI_THUNK_PPB_TRANSPORT_API_H_
-
-#include "ppapi/c/dev/ppb_transport_dev.h"
-
-namespace ppapi {
-namespace thunk {
-
-class PPB_Transport_API {
- public:
- virtual ~PPB_Transport_API() {}
-
- virtual PP_Bool IsWritable() = 0;
- virtual int32_t SetProperty(PP_TransportProperty property, PP_Var value) = 0;
- virtual int32_t Connect(PP_CompletionCallback callback) = 0;
- virtual int32_t GetNextAddress(PP_Var* address,
- PP_CompletionCallback callback) = 0;
- virtual int32_t ReceiveRemoteAddress(PP_Var address) = 0;
- virtual int32_t Recv(void* data, uint32_t len,
- PP_CompletionCallback callback) = 0;
- virtual int32_t Send(const void* data, uint32_t len,
- PP_CompletionCallback callback) = 0;
- virtual int32_t Close() = 0;
-};
-
-} // namespace thunk
-} // namespace ppapi
-
-#endif // PPAPI_THUNK_PPB_TRANSPORT_API_H_
diff --git a/ppapi/thunk/ppb_transport_thunk.cc b/ppapi/thunk/ppb_transport_thunk.cc
deleted file mode 100644
index d739e89..0000000
--- a/ppapi/thunk/ppb_transport_thunk.cc
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/thunk.h"
-#include "ppapi/thunk/ppb_transport_api.h"
-#include "ppapi/thunk/resource_creation_api.h"
-
-namespace ppapi {
-namespace thunk {
-
-namespace {
-
-typedef EnterResource<PPB_Transport_API> EnterTransport;
-
-PP_Resource Create(PP_Instance instance, const char* name,
- PP_TransportType type) {
- EnterResourceCreation enter(instance);
- if (enter.failed())
- return 0;
- return enter.functions()->CreateTransport(instance, name, type);
-}
-
-PP_Bool IsTransport(PP_Resource resource) {
- EnterTransport enter(resource, false);
- return PP_FromBool(enter.succeeded());
-}
-
-PP_Bool IsWritable(PP_Resource transport) {
- EnterTransport enter(transport, true);
- if (enter.failed())
- return PP_FALSE;
- return enter.object()->IsWritable();
-}
-
-int32_t SetProperty(PP_Resource transport, PP_TransportProperty property,
- PP_Var value) {
- EnterTransport enter(transport, true);
- if (enter.failed())
- return enter.retval();
- return enter.object()->SetProperty(property, value);
-}
-
-int32_t Connect(PP_Resource transport, PP_CompletionCallback callback) {
- EnterTransport enter(transport, callback, true);
- if (enter.failed())
- return enter.retval();
- return enter.SetResult(enter.object()->Connect(callback));
-}
-
-int32_t GetNextAddress(PP_Resource transport, PP_Var* address,
- PP_CompletionCallback callback) {
- EnterTransport enter(transport, callback, true);
- if (enter.failed())
- return enter.retval();
- return enter.SetResult(enter.object()->GetNextAddress(address, callback));
-}
-
-int32_t ReceiveRemoteAddress(PP_Resource transport, PP_Var address) {
- EnterTransport enter(transport, true);
- if (enter.failed())
- return enter.retval();
- return enter.object()->ReceiveRemoteAddress(address);
-}
-
-int32_t Recv(PP_Resource transport, void* data, uint32_t len,
- PP_CompletionCallback callback) {
- EnterTransport enter(transport, callback, true);
- if (enter.failed())
- return enter.retval();
- return enter.SetResult(enter.object()->Recv(data, len, callback));
-}
-
-int32_t Send(PP_Resource transport, const void* data, uint32_t len,
- PP_CompletionCallback callback) {
- EnterTransport enter(transport, callback, true);
- if (enter.failed())
- return enter.retval();
- return enter.SetResult(enter.object()->Send(data, len, callback));
-}
-
-int32_t Close(PP_Resource transport) {
- EnterTransport enter(transport, true);
- if (enter.failed())
- return enter.retval();
- return enter.object()->Close();
-}
-
-const PPB_Transport_Dev g_ppb_transport_thunk = {
- &Create,
- &IsTransport,
- &IsWritable,
- &SetProperty,
- &Connect,
- &GetNextAddress,
- &ReceiveRemoteAddress,
- &Recv,
- &Send,
- &Close,
-};
-
-} // namespace
-
-const PPB_Transport_Dev_0_7* GetPPB_Transport_Dev_0_7_Thunk() {
- return &g_ppb_transport_thunk;
-}
-
-} // namespace thunk
-} // namespace ppapi
diff --git a/ppapi/thunk/resource_creation_api.h b/ppapi/thunk/resource_creation_api.h
index 2f214e7..3cd1752 100644
--- a/ppapi/thunk/resource_creation_api.h
+++ b/ppapi/thunk/resource_creation_api.h
@@ -19,7 +19,6 @@
#include "ppapi/c/ppb_input_event.h"
#include "ppapi/c/ppb_websocket.h"
#include "ppapi/c/dev/pp_video_dev.h"
-#include "ppapi/c/dev/ppb_transport_dev.h"
#include "ppapi/c/private/ppb_network_monitor_private.h"
#include "ppapi/shared_impl/api_id.h"
@@ -138,9 +137,6 @@ class ResourceCreationAPI {
virtual PP_Resource CreateTalk(PP_Instance instance) = 0;
virtual PP_Resource CreateTCPServerSocketPrivate(PP_Instance instance) = 0;
virtual PP_Resource CreateTCPSocketPrivate(PP_Instance instace) = 0;
- virtual PP_Resource CreateTransport(PP_Instance instance,
- const char* name,
- PP_TransportType type) = 0;
virtual PP_Resource CreateUDPSocketPrivate(PP_Instance instace) = 0;
virtual PP_Resource CreateVideoCapture(PP_Instance instance) = 0;
virtual PP_Resource CreateVideoDecoder(
diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi
index d2fca69..0f3e0c6 100644
--- a/webkit/glue/webkit_glue.gypi
+++ b/webkit/glue/webkit_glue.gypi
@@ -537,12 +537,6 @@
'<(DEPTH)/webkit/support/setup_third_party.gyp:third_party_headers',
],
}],
- ['p2p_apis==1', {
- 'sources': [
- '../plugins/ppapi/ppb_transport_impl.cc',
- '../plugins/ppapi/ppb_transport_impl.h',
- ],
- }],
],
},
],
diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc
index 147511c..70989bd 100644
--- a/webkit/plugins/ppapi/plugin_module.cc
+++ b/webkit/plugins/ppapi/plugin_module.cc
@@ -33,7 +33,6 @@
#include "ppapi/c/dev/ppb_scrollbar_dev.h"
#include "ppapi/c/dev/ppb_testing_dev.h"
#include "ppapi/c/dev/ppb_text_input_dev.h"
-#include "ppapi/c/dev/ppb_transport_dev.h"
#include "ppapi/c/dev/ppb_url_util_dev.h"
#include "ppapi/c/dev/ppb_var_deprecated.h"
#include "ppapi/c/dev/ppb_video_capture_dev.h"
diff --git a/webkit/plugins/ppapi/ppb_transport_impl.cc b/webkit/plugins/ppapi/ppb_transport_impl.cc
deleted file mode 100644
index caa60e4..0000000
--- a/webkit/plugins/ppapi/ppb_transport_impl.cc
+++ /dev/null
@@ -1,404 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "webkit/plugins/ppapi/ppb_transport_impl.h"
-
-#include "base/message_loop.h"
-#include "base/string_util.h"
-#include "net/base/io_buffer.h"
-#include "net/base/net_errors.h"
-#include "net/base/net_util.h"
-#include "net/socket/socket.h"
-#include "ppapi/c/dev/ppb_transport_dev.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/shared_impl/callback_tracker.h"
-#include "ppapi/shared_impl/ppapi_globals.h"
-#include "ppapi/shared_impl/var.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h"
-#include "webkit/plugins/ppapi/common.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
-#include "webkit/plugins/ppapi/resource_helper.h"
-
-using ppapi::StringVar;
-using ppapi::thunk::PPB_Transport_API;
-using ppapi::TrackedCallback;
-using webkit_glue::P2PTransport;
-
-namespace webkit {
-namespace ppapi {
-
-namespace {
-
-const char kUdpProtocolName[] = "udp";
-const char kTcpProtocolName[] = "tcp";
-
-const int kMinBufferSize = 1024;
-const int kMaxBufferSize = 1024 * 1024;
-const int kMinAckDelay = 10;
-const int kMaxAckDelay = 1000;
-
-int MapNetError(int result) {
- if (result > 0)
- return result;
-
- switch (result) {
- case net::OK:
- return PP_OK;
- case net::ERR_IO_PENDING:
- return PP_OK_COMPLETIONPENDING;
- case net::ERR_INVALID_ARGUMENT:
- return PP_ERROR_BADARGUMENT;
- default:
- return PP_ERROR_FAILED;
- }
-}
-
-WebKit::WebFrame* GetFrameForResource(const ::ppapi::Resource* resource) {
- PluginInstance* plugin_instance =
- ResourceHelper::GetPluginInstance(resource);
- if (!plugin_instance)
- return NULL;
- return plugin_instance->container()->element().document().frame();
-}
-
-} // namespace
-
-PPB_Transport_Impl::PPB_Transport_Impl(PP_Instance instance)
- : Resource(::ppapi::OBJECT_IS_IMPL, instance),
- type_(PP_TRANSPORTTYPE_DATAGRAM),
- started_(false),
- writable_(false) {
-}
-
-PPB_Transport_Impl::~PPB_Transport_Impl() {
-}
-
-// static
-PP_Resource PPB_Transport_Impl::Create(PP_Instance instance,
- const char* name,
- PP_TransportType type) {
- scoped_refptr<PPB_Transport_Impl> t(new PPB_Transport_Impl(instance));
- if (!t->Init(name, type))
- return 0;
- return t->GetReference();
-}
-
-PPB_Transport_API* PPB_Transport_Impl::AsPPB_Transport_API() {
- return this;
-}
-
-bool PPB_Transport_Impl::Init(const char* name, PP_TransportType type) {
- name_ = name;
-
- if (type != PP_TRANSPORTTYPE_DATAGRAM && type != PP_TRANSPORTTYPE_STREAM) {
- LOG(WARNING) << "Unknown transport type: " << type;
- return false;
- }
- type_ = type;
-
- PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this);
- if (!plugin_delegate)
- return false;
- p2p_transport_.reset(plugin_delegate->CreateP2PTransport());
- return p2p_transport_.get() != NULL;
-}
-
-PP_Bool PPB_Transport_Impl::IsWritable() {
- if (!p2p_transport_.get())
- return PP_FALSE;
-
- return PP_FromBool(writable_);
-}
-
-int32_t PPB_Transport_Impl::SetProperty(PP_TransportProperty property,
- PP_Var value) {
- // SetProperty() may be called only before Connect().
- if (started_)
- return PP_ERROR_FAILED;
-
- switch (property) {
- case PP_TRANSPORTPROPERTY_STUN_SERVER: {
- StringVar* value_str = StringVar::FromPPVar(value);
- if (!value_str)
- return PP_ERROR_BADARGUMENT;
- if (!net::ParseHostAndPort(value_str->value(), &config_.stun_server,
- &config_.stun_server_port)) {
- return PP_ERROR_BADARGUMENT;
- }
- break;
- }
-
- case PP_TRANSPORTPROPERTY_RELAY_SERVER: {
- StringVar* value_str = StringVar::FromPPVar(value);
- if (!value_str)
- return PP_ERROR_BADARGUMENT;
- if (!net::ParseHostAndPort(value_str->value(), &config_.relay_server,
- &config_.relay_server_port)) {
- return PP_ERROR_BADARGUMENT;
- }
- break;
- }
-
- case PP_TRANSPORTPROPERTY_RELAY_USERNAME: {
- StringVar* value_str = StringVar::FromPPVar(value);
- if (!value_str)
- return PP_ERROR_BADARGUMENT;
- config_.relay_username = value_str->value();
- break;
- }
-
- case PP_TRANSPORTPROPERTY_RELAY_PASSWORD: {
- StringVar* value_str = StringVar::FromPPVar(value);
- if (!value_str)
- return PP_ERROR_BADARGUMENT;
- config_.relay_password = value_str->value();
- break;
- }
-
- case PP_TRANSPORTPROPERTY_RELAY_MODE: {
- switch (value.value.as_int) {
- case PP_TRANSPORTRELAYMODE_TURN:
- config_.legacy_relay = false;
- break;
- case PP_TRANSPORTRELAYMODE_GOOGLE:
- config_.legacy_relay = true;
- break;
- default:
- return PP_ERROR_BADARGUMENT;
- }
- break;
- }
-
- case PP_TRANSPORTPROPERTY_TCP_RECEIVE_WINDOW: {
- if (type_ != PP_TRANSPORTTYPE_STREAM)
- return PP_ERROR_BADARGUMENT;
-
- int32_t int_value = value.value.as_int;
- if (value.type != PP_VARTYPE_INT32 || int_value < kMinBufferSize ||
- int_value > kMaxBufferSize) {
- return PP_ERROR_BADARGUMENT;
- }
- config_.tcp_receive_window = int_value;
- break;
- }
-
- case PP_TRANSPORTPROPERTY_TCP_SEND_WINDOW: {
- if (type_ != PP_TRANSPORTTYPE_STREAM)
- return PP_ERROR_BADARGUMENT;
-
- int32_t int_value = value.value.as_int;
- if (value.type != PP_VARTYPE_INT32 || int_value < kMinBufferSize ||
- int_value > kMaxBufferSize) {
- return PP_ERROR_BADARGUMENT;
- }
- config_.tcp_send_window = int_value;
- break;
- }
-
- case PP_TRANSPORTPROPERTY_TCP_NO_DELAY: {
- if (type_ != PP_TRANSPORTTYPE_STREAM)
- return PP_ERROR_BADARGUMENT;
-
- if (value.type != PP_VARTYPE_BOOL)
- return PP_ERROR_BADARGUMENT;
- config_.tcp_no_delay = PP_ToBool(value.value.as_bool);
- break;
- }
-
- case PP_TRANSPORTPROPERTY_TCP_ACK_DELAY: {
- if (type_ != PP_TRANSPORTTYPE_STREAM)
- return PP_ERROR_BADARGUMENT;
-
- int32_t int_value = value.value.as_int;
- if (value.type != PP_VARTYPE_INT32 || int_value < kMinAckDelay ||
- int_value > kMaxAckDelay) {
- return PP_ERROR_BADARGUMENT;
- }
- config_.tcp_ack_delay_ms = int_value;
- break;
- }
-
- case PP_TRANSPORTPROPERTY_DISABLE_TCP_TRANSPORT: {
- if (value.type != PP_VARTYPE_BOOL)
- return PP_ERROR_BADARGUMENT;
- config_.disable_tcp_transport = PP_ToBool(value.value.as_bool);
- break;
- }
-
- default:
- return PP_ERROR_BADARGUMENT;
- }
-
- return PP_OK;
-}
-
-int32_t PPB_Transport_Impl::Connect(PP_CompletionCallback callback) {
- if (!callback.func)
- return PP_ERROR_BLOCKS_MAIN_THREAD;
- if (!p2p_transport_.get())
- return PP_ERROR_FAILED;
-
- // Connect() has already been called.
- if (started_)
- return PP_ERROR_INPROGRESS;
-
- P2PTransport::Protocol protocol = (type_ == PP_TRANSPORTTYPE_STREAM) ?
- P2PTransport::PROTOCOL_TCP : P2PTransport::PROTOCOL_UDP;
-
- if (!p2p_transport_->Init(
- GetFrameForResource(this), name_, protocol, config_, this)) {
- return PP_ERROR_FAILED;
- }
-
- started_ = true;
-
- PluginModule* plugin_module = ResourceHelper::GetPluginModule(this);
- if (!plugin_module)
- return PP_ERROR_FAILED;
-
- connect_callback_ = new TrackedCallback(this, callback);
- return PP_OK_COMPLETIONPENDING;
-}
-
-int32_t PPB_Transport_Impl::GetNextAddress(PP_Var* address,
- PP_CompletionCallback callback) {
- if (!callback.func)
- return PP_ERROR_BLOCKS_MAIN_THREAD;
- if (!p2p_transport_.get())
- return PP_ERROR_FAILED;
-
- if (TrackedCallback::IsPending(next_address_callback_))
- return PP_ERROR_INPROGRESS;
-
- PluginModule* plugin_module = ResourceHelper::GetPluginModule(this);
- if (!plugin_module)
- return PP_ERROR_FAILED;
-
- if (!local_candidates_.empty()) {
- *address = StringVar::StringToPPVar(local_candidates_.front());
- local_candidates_.pop_front();
- return PP_OK;
- }
-
- next_address_callback_ = new TrackedCallback(this, callback);
- return PP_OK_COMPLETIONPENDING;
-}
-
-int32_t PPB_Transport_Impl::ReceiveRemoteAddress(PP_Var address) {
- if (!p2p_transport_.get())
- return PP_ERROR_FAILED;
-
- StringVar* address_str = StringVar::FromPPVar(address);
- if (!address_str)
- return PP_ERROR_BADARGUMENT;
-
- return p2p_transport_->AddRemoteCandidate(address_str->value()) ?
- PP_OK : PP_ERROR_FAILED;
-}
-
-int32_t PPB_Transport_Impl::Recv(void* data, uint32_t len,
- PP_CompletionCallback callback) {
- if (!callback.func)
- return PP_ERROR_BLOCKS_MAIN_THREAD;
- if (!p2p_transport_.get())
- return PP_ERROR_FAILED;
-
- if (TrackedCallback::IsPending(recv_callback_))
- return PP_ERROR_INPROGRESS;
-
- net::Socket* channel = p2p_transport_->GetChannel();
- if (!channel)
- return PP_ERROR_FAILED;
-
- PluginModule* plugin_module = ResourceHelper::GetPluginModule(this);
- if (!plugin_module)
- return PP_ERROR_FAILED;
-
- scoped_refptr<net::IOBuffer> buffer =
- new net::WrappedIOBuffer(static_cast<const char*>(data));
- int result = MapNetError(
- channel->Read(buffer, len, base::Bind(&PPB_Transport_Impl::OnRead,
- base::Unretained(this))));
- if (result == PP_OK_COMPLETIONPENDING)
- recv_callback_ = new TrackedCallback(this, callback);
-
- return result;
-}
-
-int32_t PPB_Transport_Impl::Send(const void* data, uint32_t len,
- PP_CompletionCallback callback) {
- if (!callback.func)
- return PP_ERROR_BLOCKS_MAIN_THREAD;
- if (!p2p_transport_.get())
- return PP_ERROR_FAILED;
-
- if (TrackedCallback::IsPending(send_callback_))
- return PP_ERROR_INPROGRESS;
-
- net::Socket* channel = p2p_transport_->GetChannel();
- if (!channel)
- return PP_ERROR_FAILED;
-
- PluginModule* plugin_module = ResourceHelper::GetPluginModule(this);
- if (!plugin_module)
- return PP_ERROR_FAILED;
-
- scoped_refptr<net::IOBuffer> buffer =
- new net::WrappedIOBuffer(static_cast<const char*>(data));
- int result = MapNetError(
- channel->Write(buffer, len, base::Bind(&PPB_Transport_Impl::OnWritten,
- base::Unretained(this))));
- if (result == PP_OK_COMPLETIONPENDING)
- send_callback_ = new TrackedCallback(this, callback);
-
- return result;
-}
-
-int32_t PPB_Transport_Impl::Close() {
- if (!p2p_transport_.get())
- return PP_ERROR_FAILED;
-
- p2p_transport_.reset();
-
- ::ppapi::PpapiGlobals::Get()->GetCallbackTrackerForInstance(
- pp_instance())->PostAbortForResource(pp_resource());
- return PP_OK;
-}
-
-void PPB_Transport_Impl::OnCandidateReady(const std::string& address) {
- // Store the candidate first before calling the callback.
- local_candidates_.push_back(address);
-
- if (TrackedCallback::IsPending(next_address_callback_))
- TrackedCallback::ClearAndRun(&next_address_callback_, PP_OK);
-}
-
-void PPB_Transport_Impl::OnStateChange(webkit_glue::P2PTransport::State state) {
- writable_ = (state | webkit_glue::P2PTransport::STATE_WRITABLE) != 0;
- if (writable_ && TrackedCallback::IsPending(connect_callback_))
- TrackedCallback::ClearAndRun(&connect_callback_, PP_OK);
-}
-
-void PPB_Transport_Impl::OnError(int error) {
- writable_ = false;
- if (TrackedCallback::IsPending(connect_callback_))
- TrackedCallback::ClearAndRun(&connect_callback_, PP_ERROR_FAILED);
-}
-
-void PPB_Transport_Impl::OnRead(int result) {
- DCHECK(TrackedCallback::IsPending(recv_callback_));
- TrackedCallback::ClearAndRun(&recv_callback_, MapNetError(result));
-}
-
-void PPB_Transport_Impl::OnWritten(int result) {
- DCHECK(TrackedCallback::IsPending(send_callback_));
- TrackedCallback::ClearAndRun(&send_callback_, MapNetError(result));
-}
-
-} // namespace ppapi
-} // namespace webkit
diff --git a/webkit/plugins/ppapi/ppb_transport_impl.h b/webkit/plugins/ppapi/ppb_transport_impl.h
deleted file mode 100644
index 34393e4..0000000
--- a/webkit/plugins/ppapi/ppb_transport_impl.h
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef WEBKIT_PLUGINS_PPAPI_PPB_TRANSPORT_IMPL_H_
-#define WEBKIT_PLUGINS_PPAPI_PPB_TRANSPORT_IMPL_H_
-
-#include <list>
-#include <string>
-
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-#include "net/base/completion_callback.h"
-#include "ppapi/shared_impl/tracked_callback.h"
-#include "ppapi/shared_impl/resource.h"
-#include "ppapi/thunk/ppb_transport_api.h"
-#include "webkit/glue/p2p_transport.h"
-
-namespace webkit {
-namespace ppapi {
-
-class PPB_Transport_Impl : public ::ppapi::Resource,
- public ::ppapi::thunk::PPB_Transport_API,
- public webkit_glue::P2PTransport::EventHandler {
- public:
- virtual ~PPB_Transport_Impl();
-
- static PP_Resource Create(PP_Instance instance,
- const char* name,
- PP_TransportType type);
-
- // Resource override.
- virtual ::ppapi::thunk::PPB_Transport_API* AsPPB_Transport_API() OVERRIDE;
-
- // PPB_Transport_API implementation.
- virtual PP_Bool IsWritable() OVERRIDE;
- virtual int32_t SetProperty(PP_TransportProperty property,
- PP_Var value) OVERRIDE;
- virtual int32_t Connect(PP_CompletionCallback callback) OVERRIDE;
- virtual int32_t GetNextAddress(PP_Var* address,
- PP_CompletionCallback callback) OVERRIDE;
- virtual int32_t ReceiveRemoteAddress(PP_Var address) OVERRIDE;
- virtual int32_t Recv(void* data, uint32_t len,
- PP_CompletionCallback callback) OVERRIDE;
- virtual int32_t Send(const void* data, uint32_t len,
- PP_CompletionCallback callback) OVERRIDE;
- virtual int32_t Close() OVERRIDE;
-
- // webkit_glue::P2PTransport::EventHandler implementation.
- virtual void OnCandidateReady(const std::string& address) OVERRIDE;
- virtual void OnStateChange(webkit_glue::P2PTransport::State state) OVERRIDE;
- virtual void OnError(int error) OVERRIDE;
-
- private:
- explicit PPB_Transport_Impl(PP_Instance instance);
-
- bool Init(const char* name, PP_TransportType type);
-
- void OnRead(int result);
- void OnWritten(int result);
-
- std::string name_;
- PP_TransportType type_;
- webkit_glue::P2PTransport::Config config_;
- bool started_;
- scoped_ptr<webkit_glue::P2PTransport> p2p_transport_;
- bool writable_;
- std::list<std::string> local_candidates_;
-
- scoped_refptr< ::ppapi::TrackedCallback> connect_callback_;
- scoped_refptr< ::ppapi::TrackedCallback> next_address_callback_;
-
- scoped_refptr< ::ppapi::TrackedCallback> recv_callback_;
- scoped_refptr< ::ppapi::TrackedCallback> send_callback_;
-
- DISALLOW_COPY_AND_ASSIGN(PPB_Transport_Impl);
-};
-
-} // namespace ppapi
-} // namespace webkit
-
-#endif // WEBKIT_PLUGINS_PPAPI_PPB_TRANSPORT_IMPL_H_
diff --git a/webkit/plugins/ppapi/resource_creation_impl.cc b/webkit/plugins/ppapi/resource_creation_impl.cc
index e14030f..1d0905b 100644
--- a/webkit/plugins/ppapi/resource_creation_impl.cc
+++ b/webkit/plugins/ppapi/resource_creation_impl.cc
@@ -30,7 +30,6 @@
#include "webkit/plugins/ppapi/ppb_scrollbar_impl.h"
#include "webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.h"
#include "webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h"
-#include "webkit/plugins/ppapi/ppb_transport_impl.h"
#include "webkit/plugins/ppapi/ppb_udp_socket_private_impl.h"
#include "webkit/plugins/ppapi/ppb_url_loader_impl.h"
#include "webkit/plugins/ppapi/ppb_url_request_info_impl.h"
@@ -258,16 +257,6 @@ PP_Resource ResourceCreationImpl::CreateTCPSocketPrivate(PP_Instance instance) {
return PPB_TCPSocket_Private_Impl::CreateResource(instance);
}
-PP_Resource ResourceCreationImpl::CreateTransport(PP_Instance instance,
- const char* name,
- PP_TransportType type) {
-#if defined(ENABLE_P2P_APIS)
- return PPB_Transport_Impl::Create(instance, name, type);
-#else
- return 0;
-#endif
-}
-
PP_Resource ResourceCreationImpl::CreateUDPSocketPrivate(PP_Instance instance) {
return PPB_UDPSocket_Private_Impl::CreateResource(instance);
}
diff --git a/webkit/plugins/ppapi/resource_creation_impl.h b/webkit/plugins/ppapi/resource_creation_impl.h
index 84f9b2e..4712c19 100644
--- a/webkit/plugins/ppapi/resource_creation_impl.h
+++ b/webkit/plugins/ppapi/resource_creation_impl.h
@@ -106,9 +106,6 @@ class ResourceCreationImpl : public ::ppapi::thunk::ResourceCreationAPI {
PP_Instance instance) OVERRIDE;
virtual PP_Resource CreateTCPSocketPrivate(PP_Instance instance) OVERRIDE;
- virtual PP_Resource CreateTransport(PP_Instance instance,
- const char* name,
- PP_TransportType type) OVERRIDE;
virtual PP_Resource CreateUDPSocketPrivate(PP_Instance instance) OVERRIDE;
virtual PP_Resource CreateURLLoader(PP_Instance instance) OVERRIDE;
virtual PP_Resource CreateURLRequestInfo(