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

Unified Diff: ppapi/proxy/ppb_file_io_proxy.h

Issue 8764003: Implement a proxy for Pepper FileIO. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Homestarmy Created 9 years 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/proxy/ppapi_param_traits.cc ('k') | ppapi/proxy/ppb_file_io_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppb_file_io_proxy.h
diff --git a/ppapi/proxy/ppb_file_io_proxy.h b/ppapi/proxy/ppb_file_io_proxy.h
new file mode 100644
index 0000000000000000000000000000000000000000..fbc8a16a22151a87d666a6a358f72ddb43077299
--- /dev/null
+++ b/ppapi/proxy/ppb_file_io_proxy.h
@@ -0,0 +1,93 @@
+// 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.
+
+#ifndef PPAPI_PROXY_PPB_FILE_IO_PROXY_H_
+#define PPAPI_PROXY_PPB_FILE_IO_PROXY_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "ppapi/c/pp_file_info.h"
+#include "ppapi/proxy/interface_proxy.h"
+#include "ppapi/proxy/proxy_non_thread_safe_ref_count.h"
+
+namespace ppapi {
+
+class HostResource;
+namespace proxy {
+
+class PPB_FileIO_Proxy : public InterfaceProxy {
+ public:
+ explicit PPB_FileIO_Proxy(Dispatcher* dispatcher);
+ virtual ~PPB_FileIO_Proxy();
+
+ static PP_Resource CreateProxyResource(PP_Instance instance);
+
+ // InterfaceProxy implementation.
+ virtual bool OnMessageReceived(const IPC::Message& msg);
+
+ static const ApiID kApiID = API_ID_PPB_FILE_IO;
+
+ private:
+ // Plugin -> Host message handlers.
+ void OnHostMsgCreate(PP_Instance instance, HostResource* result);
+ void OnHostMsgOpen(const HostResource& host_resource,
+ const HostResource& file_ref_resource,
+ int32_t open_flags);
+ void OnHostMsgClose(const HostResource& host_resource);
+ void OnHostMsgQuery(const HostResource& host_resource);
+ void OnHostMsgTouch(const HostResource& host_resource,
+ PP_Time last_access_time,
+ PP_Time last_modified_time);
+ void OnHostMsgRead(const HostResource& host_resource,
+ int64_t offset,
+ int32_t bytes_to_read);
+ void OnHostMsgWrite(const HostResource& host_resource,
+ int64_t offset,
+ const std::string& data);
+ void OnHostMsgSetLength(const HostResource& host_resource,
+ int64_t length);
+ void OnHostMsgFlush(const HostResource& host_resource);
+ void OnHostMsgWillWrite(const HostResource& host_resource,
+ int64_t offset,
+ int32_t bytes_to_write);
+ void OnHostMsgWillSetLength(const HostResource& host_resource,
+ int64_t length);
+
+ // Host -> Plugin message handlers.
+ void OnPluginMsgGeneralComplete(const HostResource& host_resource,
+ int32_t result);
+ void OnPluginMsgOpenFileComplete(const HostResource& host_resource,
+ int32_t result);
+ void OnPluginMsgQueryComplete(const HostResource& host_resource,
+ int32_t result,
+ const PP_FileInfo& info);
+ void OnPluginMsgReadComplete(const HostResource& host_resource,
+ int32_t result,
+ const std::string& data);
+ void OnPluginMsgWriteComplete(const HostResource& host_resource,
+ int32_t result);
+
+ // Host-side callback handlers. These convert the callbacks to an IPC message
+ // to the plugin.
+ void GeneralCallbackCompleteInHost(int32_t pp_error,
+ const HostResource& host_resource);
+ void OpenFileCallbackCompleteInHost(int32_t pp_error,
+ const HostResource& host_resource);
+ void QueryCallbackCompleteInHost(int32_t pp_error,
+ const HostResource& host_resource,
+ PP_FileInfo* info);
+ void ReadCallbackCompleteInHost(int32_t pp_error,
+ const HostResource& host_resource,
+ std::string* data);
+ pp::CompletionCallbackFactory<PPB_FileIO_Proxy,
+ ProxyNonThreadSafeRefCount> callback_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(PPB_FileIO_Proxy);
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PROXY_PPB_FILE_IO_PROXY_H_
« no previous file with comments | « ppapi/proxy/ppapi_param_traits.cc ('k') | ppapi/proxy/ppb_file_io_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698