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

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

Issue 7608030: Convert the PluginResource to be refcounted. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ppb_file_ref_proxy.h" 5 #include "ppapi/proxy/ppb_file_ref_proxy.h"
6 6
7 #include "ppapi/c/pp_errors.h" 7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/ppb_file_ref.h" 8 #include "ppapi/c/ppb_file_ref.h"
9 #include "ppapi/c/private/ppb_proxy_private.h" 9 #include "ppapi/c/private/ppb_proxy_private.h"
10 #include "ppapi/proxy/enter_proxy.h" 10 #include "ppapi/proxy/enter_proxy.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 result->name = SerializedVarReturnValue::Convert(dispatcher(), 221 result->name = SerializedVarReturnValue::Convert(dispatcher(),
222 enter.object()->GetName()); 222 enter.object()->GetName());
223 } 223 }
224 224
225 // static 225 // static
226 PP_Resource PPB_FileRef_Proxy::DeserializeFileRef( 226 PP_Resource PPB_FileRef_Proxy::DeserializeFileRef(
227 const PPBFileRef_CreateInfo& serialized) { 227 const PPBFileRef_CreateInfo& serialized) {
228 if (serialized.resource.is_null()) 228 if (serialized.resource.is_null())
229 return 0; // Resource invalid. 229 return 0; // Resource invalid.
230 230
231 linked_ptr<FileRef> object(new FileRef(serialized)); 231 return PluginResourceTracker::GetInstance()->AddResource(
232 return PluginResourceTracker::GetInstance()->AddResource(object); 232 new FileRef(serialized));
233 } 233 }
234 234
235 void PPB_FileRef_Proxy::OnMsgCreate(const HostResource& file_system, 235 void PPB_FileRef_Proxy::OnMsgCreate(const HostResource& file_system,
236 const std::string& path, 236 const std::string& path,
237 PPBFileRef_CreateInfo* result) { 237 PPBFileRef_CreateInfo* result) {
238 EnterFunctionNoLock<ResourceCreationAPI> enter(file_system.instance(), true); 238 EnterFunctionNoLock<ResourceCreationAPI> enter(file_system.instance(), true);
239 if (enter.failed()) 239 if (enter.failed())
240 return; 240 return;
241 PP_Resource resource = enter.functions()->CreateFileRef( 241 PP_Resource resource = enter.functions()->CreateFileRef(
242 file_system.host_resource(), path.c_str()); 242 file_system.host_resource(), path.c_str());
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 return; 296 return;
297 PP_CompletionCallback callback = ReceiveCallback(serialized_callback); 297 PP_CompletionCallback callback = ReceiveCallback(serialized_callback);
298 int32_t result = enter.object()->Rename(new_file_ref.host_resource(), 298 int32_t result = enter.object()->Rename(new_file_ref.host_resource(),
299 callback); 299 callback);
300 if (result != PP_OK_COMPLETIONPENDING) 300 if (result != PP_OK_COMPLETIONPENDING)
301 PP_RunCompletionCallback(&callback, result); 301 PP_RunCompletionCallback(&callback, result);
302 } 302 }
303 303
304 } // namespace proxy 304 } // namespace proxy
305 } // namespace pp 305 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698