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

Unified Diff: ppapi/proxy/ppb_file_system_proxy.cc

Issue 6596026: Don't allow multiple opens for Pepper FileSystem. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 10 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/ppapi_tests.gypi ('k') | ppapi/tests/test_file_ref.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppb_file_system_proxy.cc
diff --git a/ppapi/proxy/ppb_file_system_proxy.cc b/ppapi/proxy/ppb_file_system_proxy.cc
index 36a36f11a56e154f9ede563048e9f787858305f7..74c8bcc95ee913da09a7a981dbcf35f665645075 100644
--- a/ppapi/proxy/ppb_file_system_proxy.cc
+++ b/ppapi/proxy/ppb_file_system_proxy.cc
@@ -28,7 +28,7 @@ class FileSystem : public PluginResource {
virtual FileSystem* AsFileSystem();
PP_FileSystemType_Dev type_;
- bool opened_;
+ bool called_open_;
PP_CompletionCallback current_open_callback_;
private:
@@ -39,7 +39,7 @@ FileSystem::FileSystem(const HostResource& host_resource,
PP_FileSystemType_Dev type)
: PluginResource(host_resource),
type_(type),
- opened_(false),
+ called_open_(false),
current_open_callback_(PP_MakeCompletionCallback(NULL, NULL)) {
}
@@ -89,8 +89,6 @@ int32_t Open(PP_Resource file_system,
FileSystem* object = PluginResource::GetAs<FileSystem>(file_system);
if (!object)
return PP_ERROR_BADRESOURCE;
- if (object->opened_)
- return PP_OK;
Dispatcher* dispatcher = PluginDispatcher::GetForInstance(object->instance());
if (!dispatcher)
@@ -98,7 +96,11 @@ int32_t Open(PP_Resource file_system,
if (object->current_open_callback_.func)
return PP_ERROR_INPROGRESS;
+ else if (object->called_open_)
+ return PP_ERROR_FAILED;
+
object->current_open_callback_ = callback;
+ object->called_open_ = true;
dispatcher->Send(new PpapiHostMsg_PPBFileSystem_Open(
INTERFACE_ID_PPB_FILE_SYSTEM, object->host_resource(), expected_size));
« no previous file with comments | « ppapi/ppapi_tests.gypi ('k') | ppapi/tests/test_file_ref.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698