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

Unified Diff: components/nacl/loader/nacl_ipc_adapter.h

Issue 1010183002: SFI NaCl: Batch-open resource files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address all comments Created 5 years, 7 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 | « components/nacl/browser/nacl_process_host.cc ('k') | components/nacl/loader/nacl_ipc_adapter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/nacl/loader/nacl_ipc_adapter.h
diff --git a/components/nacl/loader/nacl_ipc_adapter.h b/components/nacl/loader/nacl_ipc_adapter.h
index ece964ea2802bd4e101908003fbfc82da6e2e5a0..f8d93ff9804ecf5f730fa348748f962ddab42b27 100644
--- a/components/nacl/loader/nacl_ipc_adapter.h
+++ b/components/nacl/loader/nacl_ipc_adapter.h
@@ -80,6 +80,14 @@ class NaClIPCAdapter : public base::RefCountedThreadSafe<NaClIPCAdapter>,
ResolveFileTokenReplyCallback)>
ResolveFileTokenCallback;
+ typedef base::Callback<void(const IPC::Message&,
+ IPC::PlatformFileForTransit,
+ base::FilePath)> OpenResourceReplyCallback;
+
+ typedef base::Callback<bool(const IPC::Message&,
+ const std::string&, // key
+ OpenResourceReplyCallback)> OpenResourceCallback;
+
// Creates an adapter, using the thread associated with the given task
// runner for posting messages. In normal use, the task runner will post to
// the I/O thread of the process.
@@ -91,11 +99,16 @@ class NaClIPCAdapter : public base::RefCountedThreadSafe<NaClIPCAdapter>,
// |resolve_file_token_cb| is an optional callback to be invoked for
// resolving file tokens received from the renderer. When the file token
// is resolved, the ResolveFileTokenReplyCallback passed inside the
- // ResolveFileTokenCallback will be invoked.
+ // ResolveFileTokenCallback will be invoked. |open_resource_cb| is also an
+ // optional callback to be invoked for intercepting open_resource IRT calls.
+ // |open_resource_cb| may immediately call a OpenResourceReplyCallback
+ // function to send a pre-opened resource descriptor to the untrusted side.
+ // OpenResourceCallback returns true when OpenResourceReplyCallback is called.
NaClIPCAdapter(
const IPC::ChannelHandle& handle,
base::TaskRunner* runner,
- ResolveFileTokenCallback resolve_file_token_cb);
+ ResolveFileTokenCallback resolve_file_token_cb,
+ OpenResourceCallback open_resource_cb);
// Initializes with a given channel that's already created for testing
// purposes. This function will take ownership of the given channel.
@@ -177,9 +190,9 @@ class NaClIPCAdapter : public base::RefCountedThreadSafe<NaClIPCAdapter>,
~NaClIPCAdapter() override;
- void OnFileTokenResolved(const IPC::Message& orig_msg,
- IPC::PlatformFileForTransit ipc_fd,
- base::FilePath file_path);
+ void SaveOpenResourceMessage(const IPC::Message& orig_msg,
+ IPC::PlatformFileForTransit ipc_fd,
+ base::FilePath file_path);
bool RewriteMessage(const IPC::Message& msg, uint32_t type);
@@ -209,6 +222,7 @@ class NaClIPCAdapter : public base::RefCountedThreadSafe<NaClIPCAdapter>,
scoped_refptr<base::TaskRunner> task_runner_;
ResolveFileTokenCallback resolve_file_token_cb_;
+ OpenResourceCallback open_resource_cb_;
// To be accessed inside of lock_ only.
LockedData locked_data_;
« no previous file with comments | « components/nacl/browser/nacl_process_host.cc ('k') | components/nacl/loader/nacl_ipc_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698