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

Unified Diff: ppapi/cpp/dev/transport_dev.cc

Issue 6478018: Basic implementation of Pepper Transport API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updated copyright year Created 9 years, 10 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 side-by-side diff with in-line comments
Download patch
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..4e73359abe2980dda1cdf1d2d3d70a8fc1eee350 100644
--- a/ppapi/cpp/dev/transport_dev.cc
+++ b/ppapi/cpp/dev/transport_dev.cc
@@ -1,9 +1,10 @@
-// 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"
@@ -27,5 +28,55 @@ 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(PP_Var* address,
brettw 2011/02/14 23:16:39 This should be a pp::Var* To implement this, I'd
Sergey Ulanov 2011/02/15 00:26:25 Done.
+ const CompletionCallback& cc) {
+ if (!has_interface<PPB_Transport_Dev>())
+ return PP_ERROR_NOINTERFACE;
+ return get_interface<PPB_Transport_Dev>()->GetNextAddress(
+ pp_resource(), address, cc.pp_completion_callback());
+}
+
+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);
+}
+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

Powered by Google App Engine
This is Rietveld 408576698