summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/c/dev/ppb_transport_dev.h11
-rw-r--r--ppapi/cpp/dev/transport_dev.cc4
-rw-r--r--ppapi/cpp/dev/transport_dev.h2
-rw-r--r--ppapi/proxy/resource_creation_proxy.cc2
-rw-r--r--ppapi/proxy/resource_creation_proxy.h2
-rw-r--r--ppapi/tests/test_transport.cc22
-rw-r--r--ppapi/tests/test_transport.h3
-rw-r--r--ppapi/thunk/ppb_transport_thunk.cc5
-rw-r--r--ppapi/thunk/resource_creation_api.h3
9 files changed, 31 insertions, 23 deletions
diff --git a/ppapi/c/dev/ppb_transport_dev.h b/ppapi/c/dev/ppb_transport_dev.h
index 89e214f..f34b3bf 100644
--- a/ppapi/c/dev/ppb_transport_dev.h
+++ b/ppapi/c/dev/ppb_transport_dev.h
@@ -13,8 +13,13 @@
#include "ppapi/c/pp_stdint.h"
#include "ppapi/c/pp_var.h"
-#define PPB_TRANSPORT_DEV_INTERFACE_0_6 "PPB_Transport;0.6"
-#define PPB_TRANSPORT_DEV_INTERFACE PPB_TRANSPORT_DEV_INTERFACE_0_6
+#define PPB_TRANSPORT_DEV_INTERFACE_0_7 "PPB_Transport;0.7"
+#define PPB_TRANSPORT_DEV_INTERFACE PPB_TRANSPORT_DEV_INTERFACE_0_7
+
+typedef enum {
+ PP_TRANSPORTTYPE_DATAGRAM = 0,
+ PP_TRANSPORTTYPE_STREAM = 1
+} PP_TransportType;
typedef enum {
// STUN server address and port, e.g "stun.example.com:19302".
@@ -50,7 +55,7 @@ struct PPB_Transport_Dev {
// specified protocol.
PP_Resource (*CreateTransport)(PP_Instance instance,
const char* name,
- const char* proto);
+ PP_TransportType type);
// Returns PP_TRUE if resource is a Transport, PP_FALSE otherwise.
PP_Bool (*IsTransport)(PP_Resource resource);
diff --git a/ppapi/cpp/dev/transport_dev.cc b/ppapi/cpp/dev/transport_dev.cc
index e725838..6c163fd 100644
--- a/ppapi/cpp/dev/transport_dev.cc
+++ b/ppapi/cpp/dev/transport_dev.cc
@@ -23,10 +23,10 @@ template <> const char* interface_name<PPB_Transport_Dev>() {
Transport_Dev::Transport_Dev(Instance* instance,
const char* name,
- const char* proto) {
+ PP_TransportType type) {
if (has_interface<PPB_Transport_Dev>())
PassRefFromConstructor(get_interface<PPB_Transport_Dev>()->CreateTransport(
- instance->pp_instance(), name, proto));
+ instance->pp_instance(), name, type));
}
bool Transport_Dev::IsWritable() {
diff --git a/ppapi/cpp/dev/transport_dev.h b/ppapi/cpp/dev/transport_dev.h
index 9c8c302..cf0721e 100644
--- a/ppapi/cpp/dev/transport_dev.h
+++ b/ppapi/cpp/dev/transport_dev.h
@@ -16,7 +16,7 @@ class Var;
class Transport_Dev : public Resource {
public:
- Transport_Dev(Instance* instance, const char* name, const char* proto);
+ Transport_Dev(Instance* instance, const char* name, PP_TransportType type);
bool IsWritable();
int32_t SetProperty(PP_TransportProperty property, const Var& value);
diff --git a/ppapi/proxy/resource_creation_proxy.cc b/ppapi/proxy/resource_creation_proxy.cc
index f3ee425..b340eca 100644
--- a/ppapi/proxy/resource_creation_proxy.cc
+++ b/ppapi/proxy/resource_creation_proxy.cc
@@ -287,7 +287,7 @@ PP_Resource ResourceCreationProxy::CreateSurface3D(
PP_Resource ResourceCreationProxy::CreateTransport(PP_Instance instance,
const char* name,
- const char* proto) {
+ PP_TransportType type) {
NOTIMPLEMENTED(); // Not proxied yet.
return 0;
}
diff --git a/ppapi/proxy/resource_creation_proxy.h b/ppapi/proxy/resource_creation_proxy.h
index 1db9164..2f27f1f 100644
--- a/ppapi/proxy/resource_creation_proxy.h
+++ b/ppapi/proxy/resource_creation_proxy.h
@@ -110,7 +110,7 @@ class ResourceCreationProxy : public InterfaceProxy,
const int32_t* attrib_list) OVERRIDE;
virtual PP_Resource CreateTransport(PP_Instance instance,
const char* name,
- const char* proto) OVERRIDE;
+ PP_TransportType type) OVERRIDE;
virtual PP_Resource CreateURLLoader(PP_Instance instance) OVERRIDE;
virtual PP_Resource CreateURLRequestInfo(
PP_Instance instance,
diff --git a/ppapi/tests/test_transport.cc b/ppapi/tests/test_transport.cc
index 8e06f85..6e520c5 100644
--- a/ppapi/tests/test_transport.cc
+++ b/ppapi/tests/test_transport.cc
@@ -112,9 +112,9 @@ void TestTransport::RunTest() {
RUN_TEST_FORCEASYNC_AND_NOT(ConnectAndCloseTcp);
}
-std::string TestTransport::InitTargets(const char* proto) {
- transport1_.reset(new pp::Transport_Dev(instance_, kTestChannelName, proto));
- transport2_.reset(new pp::Transport_Dev(instance_, kTestChannelName, proto));
+std::string TestTransport::InitTargets(PP_TransportType type) {
+ transport1_.reset(new pp::Transport_Dev(instance_, kTestChannelName, type));
+ transport2_.reset(new pp::Transport_Dev(instance_, kTestChannelName, type));
ASSERT_TRUE(transport1_.get() != NULL);
ASSERT_TRUE(transport2_.get() != NULL);
@@ -161,7 +161,7 @@ std::string TestTransport::Clean() {
}
std::string TestTransport::TestCreate() {
- RUN_SUBTEST(InitTargets("udp"));
+ RUN_SUBTEST(InitTargets(PP_TRANSPORTTYPE_DATAGRAM));
Clean();
@@ -169,7 +169,7 @@ std::string TestTransport::TestCreate() {
}
std::string TestTransport::TestSetProperty() {
- RUN_SUBTEST(InitTargets("tcp"));
+ RUN_SUBTEST(InitTargets(PP_TRANSPORTTYPE_STREAM));
// Try settings STUN and Relay properties.
ASSERT_EQ(transport1_->SetProperty(
@@ -200,7 +200,7 @@ std::string TestTransport::TestSetProperty() {
ASSERT_EQ(transport1_->SetProperty(PP_TRANSPORTPROPERTY_TCP_ACK_DELAY,
pp::Var(10)), PP_OK);
- ASSERT_EQ(transport1_->SetProperty(PP_TRANSPORTPROPERTY_TCP_SEND_WINDOW,
+ ASSERT_EQ(transport1_->SetProperty(PP_TRANSPORTPROPERTY_TCP_ACK_DELAY,
pp::Var(10000)), PP_ERROR_BADARGUMENT);
TestCompletionCallback connect_cb(instance_->pp_instance());
@@ -218,7 +218,7 @@ std::string TestTransport::TestSetProperty() {
}
std::string TestTransport::TestConnect() {
- RUN_SUBTEST(InitTargets("udp"));
+ RUN_SUBTEST(InitTargets(PP_TRANSPORTTYPE_DATAGRAM));
RUN_SUBTEST(Connect());
Clean();
@@ -229,7 +229,7 @@ std::string TestTransport::TestConnect() {
// 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() {
- RUN_SUBTEST(InitTargets("udp"));
+ RUN_SUBTEST(InitTargets(PP_TRANSPORTTYPE_DATAGRAM));
RUN_SUBTEST(Connect());
const int kNumPackets = 100;
@@ -283,7 +283,7 @@ std::string TestTransport::TestSendDataUdp() {
// Creating reliable (TCP-like) connection and try sending data over
// it. Verify that all data is received correctly.
std::string TestTransport::TestSendDataTcp() {
- RUN_SUBTEST(InitTargets("tcp"));
+ RUN_SUBTEST(InitTargets(PP_TRANSPORTTYPE_STREAM));
RUN_SUBTEST(Connect());
const int kTcpSendSize = 100000;
@@ -327,7 +327,7 @@ std::string TestTransport::TestSendDataTcp() {
}
std::string TestTransport::TestConnectAndCloseUdp() {
- RUN_SUBTEST(InitTargets("udp"));
+ RUN_SUBTEST(InitTargets(PP_TRANSPORTTYPE_DATAGRAM));
RUN_SUBTEST(Connect());
std::vector<char> recv_buffer(kReadBufferSize);
@@ -348,7 +348,7 @@ std::string TestTransport::TestConnectAndCloseUdp() {
}
std::string TestTransport::TestConnectAndCloseTcp() {
- RUN_SUBTEST(InitTargets("tcp"));
+ RUN_SUBTEST(InitTargets(PP_TRANSPORTTYPE_STREAM));
RUN_SUBTEST(Connect());
std::vector<char> recv_buffer(kReadBufferSize);
diff --git a/ppapi/tests/test_transport.h b/ppapi/tests/test_transport.h
index 75089b3..b8f7426 100644
--- a/ppapi/tests/test_transport.h
+++ b/ppapi/tests/test_transport.h
@@ -8,6 +8,7 @@
#include <string>
#include "base/memory/scoped_ptr.h"
+#include "ppapi/c/dev/ppb_transport_dev.h"
#include "ppapi/tests/test_case.h"
struct PPB_Transport_Dev;
@@ -25,7 +26,7 @@ class TestTransport : public TestCase {
virtual void RunTest();
private:
- std::string InitTargets(const char* proto);
+ std::string InitTargets(PP_TransportType type);
std::string Connect();
std::string Clean();
diff --git a/ppapi/thunk/ppb_transport_thunk.cc b/ppapi/thunk/ppb_transport_thunk.cc
index 17c572e..b0caae1 100644
--- a/ppapi/thunk/ppb_transport_thunk.cc
+++ b/ppapi/thunk/ppb_transport_thunk.cc
@@ -17,11 +17,12 @@ namespace {
typedef EnterResource<PPB_Transport_API> EnterTransport;
-PP_Resource Create(PP_Instance instance, const char* name, const char* proto) {
+PP_Resource Create(PP_Instance instance, const char* name,
+ PP_TransportType type) {
EnterFunction<ResourceCreationAPI> enter(instance, true);
if (enter.failed())
return 0;
- return enter.functions()->CreateTransport(instance, name, proto);
+ return enter.functions()->CreateTransport(instance, name, type);
}
PP_Bool IsTransport(PP_Resource resource) {
diff --git a/ppapi/thunk/resource_creation_api.h b/ppapi/thunk/resource_creation_api.h
index 5cb7383..5c92f38 100644
--- a/ppapi/thunk/resource_creation_api.h
+++ b/ppapi/thunk/resource_creation_api.h
@@ -16,6 +16,7 @@
#include "ppapi/c/ppb_graphics_3d.h"
#include "ppapi/c/ppb_image_data.h"
#include "ppapi/c/ppb_input_event.h"
+#include "ppapi/c/dev/ppb_transport_dev.h"
#include "ppapi/proxy/interface_id.h"
struct PP_Flash_Menu;
@@ -110,7 +111,7 @@ class ResourceCreationAPI {
const int32_t* attrib_list) = 0;
virtual PP_Resource CreateTransport(PP_Instance instance,
const char* name,
- const char* proto) = 0;
+ PP_TransportType type) = 0;
virtual PP_Resource CreateURLLoader(PP_Instance instance) = 0;
virtual PP_Resource CreateURLRequestInfo(
PP_Instance instance,