summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy/ppb_file_system_proxy.h
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-21 23:49:16 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-21 23:49:16 +0000
commitce482dfe397df7f7c06901ade9f35b10fd32aa94 (patch)
tree88e2dca000032b47b12edfa908c8e8ec0f4ddab3 /ppapi/proxy/ppb_file_system_proxy.h
parent563532cca9b9c670f77c16b70034e4fe2aad7e7e (diff)
downloadchromium_src-ce482dfe397df7f7c06901ade9f35b10fd32aa94.zip
chromium_src-ce482dfe397df7f7c06901ade9f35b10fd32aa94.tar.gz
chromium_src-ce482dfe397df7f7c06901ade9f35b10fd32aa94.tar.bz2
Implement the filesystem proxy. This allows the FileRef tests (the ones which
don't use FileIO which isn't don yet) to pass in the proxy. Hook up the code from the URLLoader that downloads to a file. This allows all URLLoader tests to pass in the proxy. Change code in dispatcher that zeros out the array to take into account padding. It was only zero-filling half of the array since sizeof(enum) * # elts seems to be half as large as the actual array due to padding on 64-bit systems. Make the aborted completion callbacks run asynchronously. This was caught by one of the file ref tests. We really need a system for doing this better, but I don't want to do that in this patch. TEST=ppapi_tests run under proxy Review URL: http://codereview.chromium.org/6543028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75566 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/ppb_file_system_proxy.h')
-rw-r--r--ppapi/proxy/ppb_file_system_proxy.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/ppapi/proxy/ppb_file_system_proxy.h b/ppapi/proxy/ppb_file_system_proxy.h
new file mode 100644
index 0000000..acfe171
--- /dev/null
+++ b/ppapi/proxy/ppb_file_system_proxy.h
@@ -0,0 +1,61 @@
+// 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_SYSTEM_PROXY_H_
+#define PPAPI_PROXY_PPB_FILE_SYSTEM_PROXY_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/c/pp_time.h"
+#include "ppapi/cpp/completion_callback.h"
+#include "ppapi/proxy/interface_proxy.h"
+#include "ppapi/proxy/proxy_non_thread_safe_ref_count.h"
+
+struct PPB_FileSystem_Dev;
+
+namespace pp {
+namespace proxy {
+
+class HostResource;
+
+class PPB_FileSystem_Proxy : public InterfaceProxy {
+ public:
+ PPB_FileSystem_Proxy(Dispatcher* dispatcher, const void* target_interface);
+ virtual ~PPB_FileSystem_Proxy();
+
+ static const Info* GetInfo();
+
+ const PPB_FileSystem_Dev* ppb_file_system_target() const {
+ return static_cast<const PPB_FileSystem_Dev*>(target_interface());
+ }
+
+ // InterfaceProxy implementation.
+ virtual bool OnMessageReceived(const IPC::Message& msg);
+
+ private:
+ // Message handlers.
+ void OnMsgCreate(PP_Instance instance,
+ int type,
+ HostResource* result);
+ void OnMsgOpen(const HostResource& filesystem,
+ int64_t expected_size);
+
+ void OnMsgOpenComplete(const HostResource& filesystem,
+ int32_t result);
+
+ void OpenCompleteInHost(int32_t result, const HostResource& host_resource);
+
+ CompletionCallbackFactory<PPB_FileSystem_Proxy,
+ ProxyNonThreadSafeRefCount> callback_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(PPB_FileSystem_Proxy);
+};
+
+} // namespace proxy
+} // namespace pp
+
+#endif // PPAPI_PROXY_PPB_FILE_SYSTEM_PROXY_H_