Index: trunk/src/ppapi/proxy/url_loader_resource.cc |
=================================================================== |
--- trunk/src/ppapi/proxy/url_loader_resource.cc (revision 218542) |
+++ trunk/src/ppapi/proxy/url_loader_resource.cc (working copy) |
@@ -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,14 +158,9 @@ |
int32_t rv = ValidateCallback(callback); |
if (rv != PP_OK) |
return rv; |
- if (!response_info_.get()) |
+ if (!response_info_.get() || |
+ !response_info_->data().body_as_file_ref.resource.is_null()) |
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; |
@@ -191,13 +186,10 @@ |
int32_t rv = ValidateCallback(callback); |
if (rv != PP_OK) |
return rv; |
- if (!response_info_.get()) |
+ if (!response_info_.get() || |
+ response_info_->data().body_as_file_ref.resource.is_null()) |
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. |
if (done_status_ != PP_OK_COMPLETIONPENDING) |
return done_status_; |
@@ -365,10 +357,10 @@ |
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.IsValid()) { |
- body_as_file_ref = FileRefResource::CreateFileRef(connection(), |
- pp_instance(), |
- data.body_as_file_ref); |
+ 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); |
} |
response_info_ = new URLResponseInfoResource( |
connection(), pp_instance(), data, body_as_file_ref); |
@@ -397,4 +389,4 @@ |
} |
} // namespace proxy |
-} // namespace ppapi |
+} // namespace ppapi |