Index: ppapi/proxy/file_system_resource.cc |
diff --git a/ppapi/proxy/file_system_resource.cc b/ppapi/proxy/file_system_resource.cc |
index 18399301309ae10ba0274b91d5602279fe3e9f93..df8c39077514efbefa963912d01c51ad7afd28a3 100644 |
--- a/ppapi/proxy/file_system_resource.cc |
+++ b/ppapi/proxy/file_system_resource.cc |
@@ -21,7 +21,8 @@ FileSystemResource::FileSystemResource(Connection connection, |
: PluginResource(connection, instance), |
type_(type), |
called_open_(false), |
- callback_count_(0) { |
+ callback_count_(0), |
+ callback_result_(PP_OK) { |
DCHECK(type_ != PP_FILESYSTEMTYPE_INVALID); |
SendCreate(RENDERER, PpapiHostMsg_FileSystem_Create(type_)); |
SendCreate(BROWSER, PpapiHostMsg_FileSystem_Create(type_)); |
@@ -34,7 +35,9 @@ FileSystemResource::FileSystemResource(Connection connection, |
PP_FileSystemType type) |
: PluginResource(connection, instance), |
type_(type), |
- called_open_(true) { |
+ called_open_(true), |
+ callback_count_(0), |
+ callback_result_(PP_OK) { |
DCHECK(type_ != PP_FILESYSTEMTYPE_INVALID); |
AttachToPendingHost(RENDERER, pending_renderer_id); |
AttachToPendingHost(BROWSER, pending_browser_id); |
@@ -99,18 +102,24 @@ void FileSystemResource::OpenComplete( |
scoped_refptr<TrackedCallback> callback, |
const ResourceMessageReplyParams& params) { |
++callback_count_; |
+ // Prioritize worse result since only one status can be returned. |
+ if (params.result() != PP_OK) |
+ callback_result_ = params.result(); |
// Received callback from browser and renderer. |
if (callback_count_ == 2) |
- callback->Run(params.result()); |
+ callback->Run(callback_result_); |
} |
void FileSystemResource::InitIsolatedFileSystemComplete( |
const base::Callback<void(int32_t)>& callback, |
const ResourceMessageReplyParams& params) { |
++callback_count_; |
+ // Prioritize worse result since only one status can be returned. |
+ if (params.result() != PP_OK) |
+ callback_result_ = params.result(); |
// Received callback from browser and renderer. |
if (callback_count_ == 2) |
- callback.Run(params.result()); |
+ callback.Run(callback_result_); |
} |
} // namespace proxy |