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

Unified Diff: ppapi/proxy/file_io_resource.cc

Issue 21966004: Pepper: Move FileRef to the "new" resource proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another rebase Created 7 years, 3 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
« no previous file with comments | « ppapi/proxy/file_io_resource.h ('k') | ppapi/proxy/file_ref_resource.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/file_io_resource.cc
diff --git a/ppapi/proxy/file_io_resource.cc b/ppapi/proxy/file_io_resource.cc
index 76ee51c4e9ca01560bdc8bfcdde65c33117d587a..fc53fb052432c7124e039d0396a0d23b71ec219e 100644
--- a/ppapi/proxy/file_io_resource.cc
+++ b/ppapi/proxy/file_io_resource.cc
@@ -111,9 +111,13 @@ int32_t FileIOResource::Open(PP_Resource file_ref,
if (rv != PP_OK)
return rv;
+ // Take a reference on the FileRef resource while we're opening the file; we
+ // don't want the plugin destroying it during the Open operation.
+ file_ref_ = enter.resource();
+
Call<PpapiPluginMsg_FileIO_OpenReply>(RENDERER,
PpapiHostMsg_FileIO_Open(
- enter.resource()->host_resource().host_resource(),
+ file_ref,
open_flags),
base::Bind(&FileIOResource::OnPluginMsgOpenFileComplete, this,
callback));
@@ -410,6 +414,9 @@ void FileIOResource::OnPluginMsgOpenFileComplete(
const ResourceMessageReplyParams& params) {
DCHECK(state_manager_.get_pending_operation() ==
FileIOStateManager::OPERATION_EXCLUSIVE);
+
+ // Release the FileRef resource.
+ file_ref_ = NULL;
if (params.result() == PP_OK)
state_manager_.SetOpenSucceed();
« no previous file with comments | « ppapi/proxy/file_io_resource.h ('k') | ppapi/proxy/file_ref_resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698