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

Unified Diff: ppapi/native_client/src/shared/ppapi_proxy/plugin_nacl_file.cc

Issue 7740013: Cloning a bunch of stuff from the native_client repository at r6528 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: ppapi/native_client/src/shared/ppapi_proxy/plugin_nacl_file.cc
===================================================================
--- ppapi/native_client/src/shared/ppapi_proxy/plugin_nacl_file.cc (revision 0)
+++ ppapi/native_client/src/shared/ppapi_proxy/plugin_nacl_file.cc (revision 0)
@@ -0,0 +1,53 @@
+/*
+ Copyright (c) 2011 The Native Client 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 "native_client/src/include/nacl_macros.h"
+#include "native_client/src/shared/ppapi_proxy/plugin_callback.h"
+#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
+#include "native_client/src/shared/ppapi_proxy/plugin_nacl_file.h"
+#include "native_client/src/shared/ppapi_proxy/utility.h"
+#include "native_client/src/shared/srpc/nacl_srpc.h"
+#include "ppapi/c/pp_errors.h"
+#include "srpcgen/ppb_rpc.h"
+
+namespace ppapi_proxy {
+
+int32_t StreamAsFile(PP_Instance instance,
+ const char* url,
+ struct PP_CompletionCallback callback) {
+ DebugPrintf("NaClFile::StreamAsFile: instance=%"NACL_PRIu32" url=%s\n",
+ instance, url);
+
+ int32_t callback_id =
+ CompletionCallbackTable::Get()->AddCallback(callback);
+ if (callback_id == 0)
+ return PP_ERROR_BADARGUMENT;
+
+ NaClSrpcError srpc_result = NaClFileRpcClient::StreamAsFile(
+ GetMainSrpcChannel(), instance, const_cast<char*>(url), callback_id);
+ DebugPrintf("NaClFile::StreamAsFile: %s\n", NaClSrpcErrorString(srpc_result));
+
+ if (srpc_result == NACL_SRPC_RESULT_OK)
+ return PP_OK_COMPLETIONPENDING;
+ return MayForceCallback(callback, PP_ERROR_FAILED);
+}
+
+
+int GetFileDesc(PP_Instance instance, const char* url) {
+ DebugPrintf("NaClFile::GetFileDesc: instance=%"NACL_PRIu32" url=%s\n",
+ instance, url);
+
+ int file_desc;
+ NaClSrpcError srpc_result = NaClFileRpcClient::GetFileDesc(
+ GetMainSrpcChannel(), instance, const_cast<char*>(url), &file_desc);
+ DebugPrintf("NaClFile::GetFileDesc: %s\n", NaClSrpcErrorString(srpc_result));
+
+ if (srpc_result == NACL_SRPC_RESULT_OK)
+ return file_desc;
+ return NACL_NO_FILE_DESC;
+}
+
+} // namespace ppapi_proxy

Powered by Google App Engine
This is Rietveld 408576698