Chromium Code Reviews| 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 1892b05947548b5e96920077c41123c06d1be7ac..d4a29c373e3afdc6c28fbe81efc44534f4ab2eb0 100644 |
| --- a/components/nacl/renderer/ppb_nacl_private_impl.cc |
| +++ b/components/nacl/renderer/ppb_nacl_private_impl.cc |
| @@ -154,13 +154,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) { |
| @@ -180,7 +180,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 it succeeds or fails. |
|
Mark Seaborn
2014/04/30 21:20:58
'it' -> 'OpenResource()' to be clearer?
hidehiko
2014/05/01 05:20:31
Done.
|
| + 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; |
| @@ -190,7 +213,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); |
| }; |
| @@ -205,7 +228,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, |