Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
|
bbudge
2014/01/23 23:01:03
2014
dmichael (off chromium)
2014/01/24 20:02:50
Done.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef PPAPI_PROXY_FILE_MAPPING_RESOURCE_H_ | |
| 6 #define PPAPI_PROXY_FILE_MAPPING_RESOURCE_H_ | |
| 7 | |
| 8 #include "ppapi/proxy/file_io_resource.h" | |
| 9 #include "ppapi/proxy/plugin_resource.h" | |
| 10 #include "ppapi/proxy/ppapi_proxy_export.h" | |
| 11 #include "ppapi/thunk/ppb_file_mapping_api.h" | |
| 12 | |
| 13 namespace ppapi { | |
| 14 namespace proxy { | |
| 15 | |
| 16 // The proxy-side resource for PPB_FileMapping. | |
| 17 class PPAPI_PROXY_EXPORT FileMappingResource | |
| 18 : public PluginResource, | |
| 19 public thunk::PPB_FileMapping_API { | |
| 20 public: | |
| 21 FileMappingResource(Connection connection, PP_Instance instance); | |
| 22 | |
| 23 private: | |
| 24 virtual ~FileMappingResource(); | |
| 25 | |
| 26 // Resource implementation. | |
| 27 virtual thunk::PPB_FileMapping_API* AsPPB_FileMapping_API() OVERRIDE; | |
| 28 | |
| 29 // PPB_FileMapping_API implementation. | |
| 30 virtual int32_t Map(PP_Instance instance, | |
| 31 PP_Resource file_io, | |
| 32 int64_t length, | |
| 33 uint32_t map_protection, | |
| 34 uint32_t map_flags, | |
| 35 int64_t offset, | |
| 36 void** address, | |
| 37 scoped_refptr<TrackedCallback> callback) OVERRIDE; | |
| 38 virtual int32_t Unmap(PP_Instance instance, | |
| 39 const void* address, | |
| 40 int64_t length, | |
| 41 scoped_refptr<TrackedCallback> callback) OVERRIDE; | |
| 42 virtual int64_t GetMapPageSize(PP_Instance instance) OVERRIDE; | |
| 43 | |
| 44 struct MapResult { | |
| 45 MapResult() : result(PP_ERROR_FAILED), address(NULL) { | |
| 46 } | |
| 47 int32_t result; | |
| 48 void* address; | |
| 49 }; | |
| 50 static MapResult DoMap(scoped_refptr<FileIOResource::FileHandleHolder> handle, | |
| 51 void* address_hint, | |
| 52 int64_t length, | |
| 53 uint32_t map_protection, | |
| 54 uint32_t map_flags, | |
| 55 int64_t offset); | |
| 56 void OnMapCompleted(void** mapped_address_out_param, | |
| 57 scoped_refptr<TrackedCallback> callback, | |
| 58 const MapResult& map_result); | |
| 59 | |
| 60 static int32_t DoUnmap(const void* address, | |
| 61 int64_t length); | |
| 62 | |
| 63 DISALLOW_COPY_AND_ASSIGN(FileMappingResource); | |
| 64 }; | |
| 65 | |
| 66 } // namespace proxy | |
| 67 } // namespace ppapi | |
| 68 | |
| 69 #endif // PPAPI_PROXY_FILE_MAPPING_RESOURCE_H_ | |
| OLD | NEW |