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

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: Minor fixes for dmichael 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
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..f63f90635dc9e765a9f594c912d797443073095c 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_ = file_ref;
+
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_ = 0;
if (params.result() == PP_OK)
state_manager_.SetOpenSucceed();

Powered by Google App Engine
This is Rietveld 408576698