Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ppapi/proxy/file_mapping_resource.h" | 5 #include "ppapi/proxy/file_mapping_resource.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/numerics/safe_conversions.h" | 8 #include "base/numerics/safe_conversions.h" |
| 9 #include "base/task_runner_util.h" | 9 #include "base/task_runner_util.h" |
| 10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 | 130 |
| 131 int64_t FileMappingResource::GetMapPageSize(PP_Instance /* instance */) { | 131 int64_t FileMappingResource::GetMapPageSize(PP_Instance /* instance */) { |
| 132 return DoGetMapPageSize(); | 132 return DoGetMapPageSize(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void FileMappingResource::OnMapCompleted( | 135 void FileMappingResource::OnMapCompleted( |
| 136 void** mapped_address_out_param, | 136 void** mapped_address_out_param, |
| 137 int64_t length, | 137 int64_t length, |
| 138 scoped_refptr<TrackedCallback> callback, | 138 scoped_refptr<TrackedCallback> callback, |
| 139 const MapResult& map_result) { | 139 const MapResult& map_result) { |
| 140 if (callback->aborted()) { | 140 // FIXME, just delete this whole file when merging. |
|
dmichael (off chromium)
2015/02/27 22:04:40
When I can rebase this on top of removing FileMapp
bbudge
2015/03/05 01:29:35
OK.
| |
| 141 if (map_result.result == PP_OK) { | |
| 142 // If the Map operation was successful, we need to Unmap to avoid leaks. | |
| 143 // The plugin won't get the address, so doesn't have a chance to do the | |
| 144 // Unmap. | |
| 145 PpapiGlobals::Get()->GetFileTaskRunner()->PostTask( | |
| 146 FROM_HERE, | |
| 147 base::Bind(base::IgnoreResult(&FileMappingResource::DoUnmapBlocking), | |
| 148 map_result.address, | |
| 149 length)); | |
| 150 } | |
| 151 return; | |
| 152 } | |
| 153 if (map_result.result == PP_OK) | 141 if (map_result.result == PP_OK) |
| 154 *mapped_address_out_param = map_result.address; | 142 *mapped_address_out_param = map_result.address; |
| 155 if (!callback->is_blocking()) | 143 if (!callback->is_blocking()) |
| 156 callback->Run(map_result.result); | 144 callback->Run(map_result.result); |
| 157 } | 145 } |
| 158 | 146 |
| 159 } // namespace proxy | 147 } // namespace proxy |
| 160 } // namespace ppapi | 148 } // namespace ppapi |
| OLD | NEW |