Index: ppapi/cpp/dev/transport_dev.cc |
diff --git a/ppapi/cpp/dev/transport_dev.cc b/ppapi/cpp/dev/transport_dev.cc |
index 241c3bdddf0d54624ff229ee4ab8c5b7c445474b..0b6282955d959889615b4b6bf9f65bbab0cd999f 100644 |
--- a/ppapi/cpp/dev/transport_dev.cc |
+++ b/ppapi/cpp/dev/transport_dev.cc |
@@ -1,13 +1,15 @@ |
-// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
+// 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.h" |
#include "ppapi/cpp/resource.h" |
#include "ppapi/cpp/module.h" |
#include "ppapi/cpp/module_impl.h" |
+#include "ppapi/cpp/var.h" |
namespace pp { |
@@ -27,5 +29,58 @@ Transport_Dev::Transport_Dev(Instance* instance, |
instance->pp_instance(), name, proto)); |
} |
-} // namespace pp |
+bool Transport_Dev::IsWritable() { |
+ if (!has_interface<PPB_Transport_Dev>()) |
+ return false; |
+ return PPBoolToBool( |
+ get_interface<PPB_Transport_Dev>()->IsWritable(pp_resource())); |
+} |
+ |
+int32_t Transport_Dev::Connect(const CompletionCallback& cc) { |
+ if (!has_interface<PPB_Transport_Dev>()) |
+ return 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 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(Var::PassRef(), 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 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 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 |