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

Unified Diff: ppapi/thunk/ppb_flash_file_modulelocal_thunk.cc

Issue 10169040: Move the rest of the Flash functions to the thunk system. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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
« no previous file with comments | « ppapi/thunk/ppb_flash_file_fileref_thunk.cc ('k') | ppapi/thunk/thunk.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/thunk/ppb_flash_file_modulelocal_thunk.cc
diff --git a/ppapi/thunk/ppb_flash_file_modulelocal_thunk.cc b/ppapi/thunk/ppb_flash_file_modulelocal_thunk.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6338779f5d3c2eb5ca8bca9a91191f8fee8e877c
--- /dev/null
+++ b/ppapi/thunk/ppb_flash_file_modulelocal_thunk.cc
@@ -0,0 +1,115 @@
+// 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_errors.h"
+#include "ppapi/c/private/ppb_flash_file.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_flash_api.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+bool CreateThreadAdapterForInstance(PP_Instance instance) {
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return false;
+ return enter.functions()->GetFlashAPI()->CreateThreadAdapterForInstance(
+ instance);
+}
+
+void ClearThreadAdapterForInstance(PP_Instance instance) {
+ EnterInstance enter(instance);
+ if (enter.succeeded()) {
+ return enter.functions()->GetFlashAPI()->ClearThreadAdapterForInstance(
+ instance);
+ }
+}
+
+int32_t OpenFile(PP_Instance instance,
+ const char* path,
+ int32_t mode,
+ PP_FileHandle* file) {
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_ERROR_BADARGUMENT;
+ return enter.functions()->GetFlashAPI()->OpenFile(instance, path, mode, file);
+}
+
+int32_t RenameFile(PP_Instance instance,
+ const char* path_from,
+ const char* path_to) {
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_ERROR_BADARGUMENT;
+ return enter.functions()->GetFlashAPI()->RenameFile(instance,
+ path_from, path_to);
+}
+
+int32_t DeleteFileOrDir(PP_Instance instance,
+ const char* path,
+ PP_Bool recursive) {
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_ERROR_BADARGUMENT;
+ return enter.functions()->GetFlashAPI()->DeleteFileOrDir(instance, path,
+ recursive);
+}
+
+int32_t CreateDir(PP_Instance instance, const char* path) {
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_ERROR_BADARGUMENT;
+ return enter.functions()->GetFlashAPI()->CreateDir(instance, path);
+}
+
+int32_t QueryFile(PP_Instance instance, const char* path, PP_FileInfo* info) {
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_ERROR_BADARGUMENT;
+ return enter.functions()->GetFlashAPI()->QueryFile(instance, path, info);
+}
+
+int32_t GetDirContents(PP_Instance instance,
+ const char* path,
+ PP_DirContents_Dev** contents) {
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_ERROR_BADARGUMENT;
+ return enter.functions()->GetFlashAPI()->GetDirContents(instance, path,
+ contents);
+}
+
+void FreeDirContents(PP_Instance instance,
+ PP_DirContents_Dev* contents) {
+ EnterInstance enter(instance);
+ if (enter.succeeded()) {
+ return enter.functions()->GetFlashAPI()->FreeDirContents(instance,
+ contents);
+ }
+}
+
+const PPB_Flash_File_ModuleLocal g_ppb_flash_file_modulelocal_thunk = {
+ &CreateThreadAdapterForInstance,
+ &ClearThreadAdapterForInstance,
+ &OpenFile,
+ &RenameFile,
+ &DeleteFileOrDir,
+ &CreateDir,
+ &QueryFile,
+ &GetDirContents,
+ &FreeDirContents
+};
+
+} // namespace
+
+const PPB_Flash_File_ModuleLocal* GetPPB_Flash_File_ModuleLocal_Thunk() {
+ return &g_ppb_flash_file_modulelocal_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
« no previous file with comments | « ppapi/thunk/ppb_flash_file_fileref_thunk.cc ('k') | ppapi/thunk/thunk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698