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

Unified Diff: ppapi/proxy/file_system_resource.cc

Issue 26803004: PPAPI: Add PluginPrivateFileSystem (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month 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_system_resource.h ('k') | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ppapi/proxy/file_system_resource.h ('k') | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698