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

Unified Diff: ppapi/proxy/url_loader_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/resource_creation_proxy.cc ('k') | ppapi/proxy/url_response_info_resource.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/url_loader_resource.cc
diff --git a/ppapi/proxy/url_loader_resource.cc b/ppapi/proxy/url_loader_resource.cc
index b2e8d6d79a1c2f55198fece14c71f1789e03dd7b..1ff0a5e1a983bb6dabfce13913d8c3e7dd3536cc 100644
--- a/ppapi/proxy/url_loader_resource.cc
+++ b/ppapi/proxy/url_loader_resource.cc
@@ -9,8 +9,8 @@
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_url_loader.h"
#include "ppapi/proxy/dispatch_reply_message.h"
+#include "ppapi/proxy/file_ref_resource.h"
#include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/proxy/ppb_file_ref_proxy.h"
#include "ppapi/proxy/url_request_info_resource.h"
#include "ppapi/proxy/url_response_info_resource.h"
#include "ppapi/shared_impl/ppapi_globals.h"
@@ -158,9 +158,14 @@ int32_t URLLoaderResource::ReadResponseBody(
int32_t rv = ValidateCallback(callback);
if (rv != PP_OK)
return rv;
- if (!response_info_.get() ||
- !response_info_->data().body_as_file_ref.resource.is_null())
+ if (!response_info_.get())
return PP_ERROR_FAILED;
+
+ // Fail if we have a valid file ref.
+ // ReadResponseBody() is for reading to a user-provided buffer.
+ if (response_info_->data().body_as_file_ref.IsValid())
+ return PP_ERROR_FAILED;
+
if (bytes_to_read <= 0 || !buffer)
return PP_ERROR_BADARGUMENT;
@@ -186,8 +191,11 @@ int32_t URLLoaderResource::FinishStreamingToFile(
int32_t rv = ValidateCallback(callback);
if (rv != PP_OK)
return rv;
- if (!response_info_.get() ||
- response_info_->data().body_as_file_ref.resource.is_null())
+ if (!response_info_.get())
+ return PP_ERROR_FAILED;
+
+ // Fail if we do not have a valid file ref.
+ if (!response_info_->data().body_as_file_ref.IsValid())
return PP_ERROR_FAILED;
// We may have already reached EOF.
@@ -357,10 +365,10 @@ void URLLoaderResource::RunCallback(int32_t result) {
void URLLoaderResource::SaveResponseInfo(const URLResponseInfoData& data) {
// Create a proxy resource for the the file ref host resource if needed.
PP_Resource body_as_file_ref = 0;
- if (!data.body_as_file_ref.resource.is_null()) {
- thunk::EnterResourceCreationNoLock enter(pp_instance());
- body_as_file_ref =
- enter.functions()->CreateFileRef(data.body_as_file_ref);
+ if (data.body_as_file_ref.IsValid()) {
+ body_as_file_ref = FileRefResource::CreateFileRef(connection(),
+ pp_instance(),
+ data.body_as_file_ref);
}
response_info_ = new URLResponseInfoResource(
connection(), pp_instance(), data, body_as_file_ref);
« no previous file with comments | « ppapi/proxy/resource_creation_proxy.cc ('k') | ppapi/proxy/url_response_info_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698