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

Unified Diff: ppapi/proxy/file_mapping_resource.h

Issue 69663002: PPAPI: Implement PPB_FileMapping on POSIX (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: bbudge review comment, fix windows build (probably) Created 6 years, 11 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/proxy/file_mapping_resource.h
diff --git a/ppapi/proxy/file_mapping_resource.h b/ppapi/proxy/file_mapping_resource.h
new file mode 100644
index 0000000000000000000000000000000000000000..0aad299ce1add1123dfe41dc3cacbea79057bcaa
--- /dev/null
+++ b/ppapi/proxy/file_mapping_resource.h
@@ -0,0 +1,76 @@
+// Copyright (c) 2014 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_FILE_MAPPING_RESOURCE_H_
+#define PPAPI_PROXY_FILE_MAPPING_RESOURCE_H_
+
+#include "ppapi/proxy/file_io_resource.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
+#include "ppapi/thunk/ppb_file_mapping_api.h"
+
+namespace ppapi {
+namespace proxy {
+
+// The proxy-side resource for PPB_FileMapping.
+class PPAPI_PROXY_EXPORT FileMappingResource
+ : public PluginResource,
+ public thunk::PPB_FileMapping_API {
+ public:
+ FileMappingResource(Connection connection, PP_Instance instance);
+
+ private:
+ virtual ~FileMappingResource();
+
+ // Resource implementation.
+ virtual thunk::PPB_FileMapping_API* AsPPB_FileMapping_API() OVERRIDE;
+
+ // PPB_FileMapping_API implementation.
+ virtual int32_t Map(PP_Instance instance,
+ PP_Resource file_io,
+ int64_t length,
+ uint32_t map_protection,
+ uint32_t map_flags,
+ int64_t offset,
+ void** address,
+ scoped_refptr<TrackedCallback> callback) OVERRIDE;
+ virtual int32_t Unmap(PP_Instance instance,
+ const void* address,
+ int64_t length,
+ scoped_refptr<TrackedCallback> callback) OVERRIDE;
+ virtual int64_t GetMapPageSize(PP_Instance instance) OVERRIDE;
+
+ struct MapResult {
+ MapResult() : result(PP_ERROR_FAILED), address(NULL) {
+ }
+ int32_t result;
+ void* address;
+ };
+ void OnMapCompleted(void** mapped_address_out_param,
+ int64_t length,
+ scoped_refptr<TrackedCallback> callback,
+ const MapResult& map_result);
+
+ // These perform the actual operations in platform-dependent ways,
+ // synchronously on the thread on which their invoked, and do not require the
+ // the proxy lock to be acquired. Map, Unmap, and GetMapPageSize forward
+ // calls to these. See file_mapping_resource_posix.cc and
+ // file_mapping_resource_win.cc for the implementations of the Do* functions.
bbudge 2014/01/25 01:04:55 Rework. How about this? // These functions perf
dmichael (off chromium) 2014/01/27 18:29:53 Thanks, that's much better. Only downside is I don
+ static MapResult DoMap(scoped_refptr<FileIOResource::FileHandleHolder> handle,
+ void* address_hint,
+ int64_t length,
+ uint32_t map_protection,
+ uint32_t map_flags,
+ int64_t offset);
+ static int32_t DoUnmap(const void* address,
+ int64_t length);
+ static int64_t DoGetMapPageSize();
+
+ DISALLOW_COPY_AND_ASSIGN(FileMappingResource);
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PROXY_FILE_MAPPING_RESOURCE_H_

Powered by Google App Engine
This is Rietveld 408576698