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

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

Issue 249183004: Implement open_resource in non-SFI mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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: components/nacl/renderer/ppb_nacl_private_impl.cc
diff --git a/components/nacl/renderer/ppb_nacl_private_impl.cc b/components/nacl/renderer/ppb_nacl_private_impl.cc
index 85ff3227ed91ade21a0a43591d5d99c1e8ed79a1..719aba391afb8deaad05f1208283148ff5720f19 100644
--- a/components/nacl/renderer/ppb_nacl_private_impl.cc
+++ b/components/nacl/renderer/ppb_nacl_private_impl.cc
@@ -158,13 +158,13 @@ class ChannelConnectedCallback {
DISALLOW_COPY_AND_ASSIGN(ChannelConnectedCallback);
};
-// Thin adapter from PP_ManifestService to ManifestServiceChannel::Delegate.
+// Thin adapter from PPP_ManifestService to ManifestServiceChannel::Delegate.
// Note that user_data is managed by the caller of LaunchSelLdr. Please see
// also PP_ManifestService's comment for more details about resource
// management.
class ManifestServiceProxy : public ManifestServiceChannel::Delegate {
public:
- ManifestServiceProxy(const PP_ManifestService* manifest_service,
+ ManifestServiceProxy(const PPP_ManifestService* manifest_service,
void* user_data)
: manifest_service_(*manifest_service),
user_data_(user_data) {
@@ -184,7 +184,30 @@ class ManifestServiceProxy : public ManifestServiceChannel::Delegate {
}
}
+ virtual void OpenResource(
+ const std::string& key,
+ const ManifestServiceChannel::OpenResourceCallback& callback) OVERRIDE {
+ if (!user_data_)
+ return;
+
+ // The allocated callback will be freed in DidOpenResource, which is always
+ // called regardless whether OpenResource() succeeds or fails.
+ if (!PP_ToBool(manifest_service_.OpenResource(
+ user_data_,
+ key.c_str(),
+ DidOpenResource,
+ new ManifestServiceChannel::OpenResourceCallback(callback)))) {
+ user_data_ = NULL;
+ }
+ }
+
private:
+ static void DidOpenResource(void* user_data, PP_FileHandle file_handle) {
+ scoped_ptr<ManifestServiceChannel::OpenResourceCallback> callback(
+ static_cast<ManifestServiceChannel::OpenResourceCallback*>(user_data));
+ callback->Run(file_handle);
+ }
+
void Quit() {
if (!user_data_)
return;
@@ -194,7 +217,7 @@ class ManifestServiceProxy : public ManifestServiceChannel::Delegate {
user_data_ = NULL;
}
- PP_ManifestService manifest_service_;
+ PPP_ManifestService manifest_service_;
void* user_data_;
DISALLOW_COPY_AND_ASSIGN(ManifestServiceProxy);
};
@@ -209,7 +232,7 @@ void LaunchSelLdr(PP_Instance instance,
PP_Bool enable_dyncode_syscalls,
PP_Bool enable_exception_handling,
PP_Bool enable_crash_throttling,
- const PP_ManifestService* manifest_service_interface,
+ const PPP_ManifestService* manifest_service_interface,
void* manifest_service_user_data,
void* imc_handle,
struct PP_Var* error_message,
@@ -326,6 +349,7 @@ void LaunchSelLdr(PP_Instance instance,
launch_result.manifest_service_ipc_channel_handle)) {
scoped_ptr<ManifestServiceChannel> manifest_service_channel(
new ManifestServiceChannel(
+ !enable_dyncode_syscalls, // true, on a plugin in PNaCl mode.
Mark Seaborn 2014/05/01 06:32:35 Actually, let's make this stricter and use: !ena
hidehiko 2014/05/01 13:05:40 Done.
launch_result.manifest_service_ipc_channel_handle,
connected_callback,
manifest_service_proxy.Pass(),

Powered by Google App Engine
This is Rietveld 408576698