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

Unified Diff: components/nacl/renderer/manifest_service_channel.h

Issue 249183004: Implement open_resource in non-SFI mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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/manifest_service_channel.h
diff --git a/components/nacl/renderer/manifest_service_channel.h b/components/nacl/renderer/manifest_service_channel.h
index 6dc394fe7f4dd53571781d417844cc3007134a99..c75b35ad00934d225e5cbafa4c876f5955e234f7 100644
--- a/components/nacl/renderer/manifest_service_channel.h
+++ b/components/nacl/renderer/manifest_service_channel.h
@@ -8,6 +8,10 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "base/platform_file.h"
+#include "base/process/process.h"
+#include "base/synchronization/lock.h"
#include "ipc/ipc_listener.h"
namespace base {
@@ -24,6 +28,8 @@ namespace nacl {
class ManifestServiceChannel : public IPC::Listener {
public:
+ typedef base::Callback<void(const base::PlatformFile&)> OpenResourceCallback;
+
class Delegate {
public:
virtual ~Delegate() {}
@@ -31,7 +37,11 @@ class ManifestServiceChannel : public IPC::Listener {
// Called when PPAPI initialization in the NaCl plugin is finished.
virtual void StartupInitializationComplete() = 0;
- // TODO(hidehiko): Add OpenResource() here.
+ // Called when irt_open_resource() is invoked in the NaCl plugin.
+ // Upon completion, callback is invoked with the platform file.
+ virtual void OpenResource(
+ const std::string& key,
+ const OpenResourceCallback& callback) = 0;
};
ManifestServiceChannel(
@@ -41,6 +51,8 @@ class ManifestServiceChannel : public IPC::Listener {
base::WaitableEvent* waitable_event);
virtual ~ManifestServiceChannel();
+ void Send(IPC::Message* message);
+
// Listener implementation.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
@@ -48,11 +60,20 @@ class ManifestServiceChannel : public IPC::Listener {
private:
void OnStartupInitializationComplete();
+ void OnOpenResource(const std::string& key, IPC::Message* reply);
+#if !defined(OS_WIN)
+ void DidOpenResource(
+ IPC::Message* reply, const base::PlatformFile& platform_file);
+#endif
base::Callback<void(int32_t)> connected_callback_;
scoped_ptr<Delegate> delegate_;
scoped_ptr<IPC::SyncChannel> channel_;
+ // Note: This should remain the last member so it'll be destroyed and
+ // invalidate the weak pointers before any other members are destroyed.
+ base::WeakPtrFactory<ManifestServiceChannel> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(ManifestServiceChannel);
};
« no previous file with comments | « components/nacl/loader/nonsfi/irt_resource_open.cc ('k') | components/nacl/renderer/manifest_service_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698