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

Unified Diff: ppapi/native_client/src/trusted/plugin/service_runtime.cc

Issue 10689012: Add ability to load pnacl resources from DIR_PNACL_COMPONENT. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: PP_FileHandle Created 8 years, 4 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
Index: ppapi/native_client/src/trusted/plugin/service_runtime.cc
diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.cc b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
index 3ea07ee48ac183fb331a44d3fd51c2867684e153..9ea98167e40c2d57c55a5e4181dc04c11e421b3c 100644
--- a/ppapi/native_client/src/trusted/plugin/service_runtime.cc
+++ b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
@@ -44,6 +44,7 @@
#include "native_client/src/trusted/plugin/plugin.h"
#include "native_client/src/trusted/plugin/plugin_error.h"
#include "native_client/src/trusted/plugin/pnacl_coordinator.h"
+#include "native_client/src/trusted/plugin/pnacl_resources.h"
#include "native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h"
#include "native_client/src/trusted/plugin/srpc_client.h"
#include "native_client/src/trusted/plugin/utility.h"
@@ -280,21 +281,45 @@ void PluginReverseInterface::OpenManifestEntry_MainThreadContinuation(
this,
&PluginReverseInterface::StreamAsFile_MainThreadContinuation,
open_cont);
- if (!plugin_->StreamAsFile(mapped_url,
- stream_cc.pp_completion_callback())) {
+ //
+ if (!PnaclUrls::IsPnaclComponent(mapped_url)) {
+ if (!plugin_->StreamAsFile(mapped_url,
+ stream_cc.pp_completion_callback())) {
+ NaClLog(4,
+ "OpenManifestEntry_MainThreadContinuation: "
+ "StreamAsFile failed\n");
+ nacl::MutexLocker take(&mu_);
+ *p->op_complete_ptr = true; // done...
+ *p->out_desc = -1; // but failed.
+ p->error_info->SetReport(ERROR_MANIFEST_OPEN,
+ "ServiceRuntime: StreamAsFile failed");
+ NaClXCondVarBroadcast(&cv_);
robertm 2012/08/08 21:51:11 add comment for what is being woken up here
jvoung - send to chromium... 2012/08/08 22:47:04 There's a bunch of these Broadcasts all over the f
+ return;
+ }
NaClLog(4,
- "OpenManifestEntry_MainThreadContinuation: "
- "StreamAsFile failed\n");
+ "OpenManifestEntry_MainThreadContinuation: StreamAsFile okay\n");
+ } else {
+ int32_t fd = PnaclResources::GetPnaclFD(
+ plugin_,
+ PnaclUrls::StripPnaclComponentPrefix(mapped_url).c_str());
+ if (fd < 0) {
+ // We should check earlier if the pnacl component wasn't installed
+ // yet. At this point, we can't do much anymore, so just continue
+ // with an invalid fd.
+ NaClLog(4,
+ "OpenManifestEntry_MainThreadContinuation: "
+ "GetReadonlyPnaclFd failed\n");
+ // TODO(jvoung): Separate the error codes?
+ p->error_info->SetReport(ERROR_MANIFEST_OPEN,
+ "ServiceRuntime: GetPnaclFd failed");
+ }
nacl::MutexLocker take(&mu_);
- *p->op_complete_ptr = true; // done...
- *p->out_desc = -1; // but failed.
- p->error_info->SetReport(ERROR_MANIFEST_OPEN,
- "ServiceRuntime: StreamAsFile failed");
+ *p->op_complete_ptr = true; // done!
+ *p->out_desc = fd;
NaClXCondVarBroadcast(&cv_);
robertm 2012/08/08 21:51:11 dito
jvoung - send to chromium... 2012/08/08 22:47:04 Done.
- return;
+ NaClLog(4,
+ "OpenManifestEntry_MainThreadContinuation: GetPnaclFd okay\n");
}
- NaClLog(4,
- "OpenManifestEntry_MainThreadContinuation: StreamAsFile okay\n");
} else {
NaClLog(4,
"OpenManifestEntry_MainThreadContinuation: "

Powered by Google App Engine
This is Rietveld 408576698