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

Unified Diff: components/nacl/renderer/pnacl_translation_resource_host.cc

Issue 982663002: Rearrange PNaCl OnNexeTempFileReply file check to be *before* transferring ownership. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: narrow scope of variables Created 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/nacl/renderer/pnacl_translation_resource_host.cc
diff --git a/components/nacl/renderer/pnacl_translation_resource_host.cc b/components/nacl/renderer/pnacl_translation_resource_host.cc
index 4e9225912ec83ef5cbfab2009f9d782d82343a77..f47f1d40ec5c50c2dc0c72393cbf620afb8dbeea 100644
--- a/components/nacl/renderer/pnacl_translation_resource_host.cc
+++ b/components/nacl/renderer/pnacl_translation_resource_host.cc
@@ -116,23 +116,22 @@ void PnaclTranslationResourceHost::OnNexeTempFileReply(
DCHECK(io_message_loop_->BelongsToCurrentThread());
base::File base_file = IPC::PlatformFileForTransitToFile(file);
CacheRequestInfoMap::iterator it = pending_cache_requests_.find(instance);
- int32_t status = PP_ERROR_FAILED;
- // Handle the expected successful case first.
- PP_FileHandle file_handle = PP_kInvalidFileHandle;
- if (it != pending_cache_requests_.end() && base_file.IsValid()) {
- file_handle = base_file.TakePlatformFile();
- status = PP_OK;
+ if (!base_file.IsValid()) {
+ DLOG(ERROR) << "Got invalid platformfilefortransit";
}
- if (it == pending_cache_requests_.end()) {
- DLOG(ERROR) << "Could not find pending request for reply";
- } else {
+ if (it != pending_cache_requests_.end()) {
+ PP_FileHandle file_handle = PP_kInvalidFileHandle;
+ int32_t status = PP_ERROR_FAILED;
+ if (base_file.IsValid()) {
+ file_handle = base_file.TakePlatformFile();
+ status = PP_OK;
+ }
PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask(
FROM_HERE,
base::Bind(it->second, status, is_hit, file_handle));
pending_cache_requests_.erase(it);
- }
- if (!base_file.IsValid()) {
- DLOG(ERROR) << "Got invalid platformfilefortransit";
+ } else {
+ DLOG(ERROR) << "Could not find pending request for reply";
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698