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

Side by Side Diff: ppapi/proxy/file_mapping_resource.cc

Issue 923263003: PPAPI: Make TrackedCallback more threadsafe (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « ppapi/ppapi_tests.gypi ('k') | ppapi/proxy/tracked_callback_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « ppapi/ppapi_tests.gypi ('k') | ppapi/proxy/tracked_callback_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698