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

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

Issue 439713002: Refactoring: Split NaClListener into two delegated classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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: components/nacl/loader/nacl_listener.h
diff --git a/components/nacl/loader/nacl_listener.h b/components/nacl/loader/nacl_listener.h
index 6ca1ec2cb792f9344fc1e604925bb5d18b8a639a..b490e2b097d3e3b69e87422a95ee19c181b893c5 100644
--- a/components/nacl/loader/nacl_listener.h
+++ b/components/nacl/loader/nacl_listener.h
@@ -16,49 +16,36 @@
namespace base {
class MessageLoopProxy;
-}
+} // namespace base
namespace IPC {
class SyncChannel;
class SyncMessageFilter;
-}
+} // namespace IPC
+
+namespace nacl {
+class ListenerDelegate;
+} // namespace nacl
// The NaClListener is an IPC channel listener that waits for a
// request to start a NaCl module.
-class NaClListener : public IPC::Listener {
+class NaClListener : public IPC::Listener, public IPC::Sender {
public:
- NaClListener();
+ explicit NaClListener(scoped_ptr<nacl::ListenerDelegate> delegate);
virtual ~NaClListener();
// Listen for a request to launch a NaCl module.
void Listen();
- bool Send(IPC::Message* msg);
-
- void set_uses_nonsfi_mode(bool uses_nonsfi_mode) {
- uses_nonsfi_mode_ = uses_nonsfi_mode;
- }
-#if defined(OS_LINUX)
- void set_prereserved_sandbox_size(size_t prereserved_sandbox_size) {
- prereserved_sandbox_size_ = prereserved_sandbox_size;
- }
-#endif
-#if defined(OS_POSIX)
- void set_number_of_cores(int number_of_cores) {
- number_of_cores_ = number_of_cores;
- }
-#endif
+ virtual bool Send(IPC::Message* msg) OVERRIDE;
private:
virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
void OnStart(const nacl::NaClStartParams& params);
- // Non-SFI version of OnStart().
- void StartNonSfi(const nacl::NaClStartParams& params);
+ IPC::ChannelHandle CreateTrustedListener();
- IPC::ChannelHandle CreateTrustedListener(
- base::MessageLoopProxy* message_loop_proxy,
- base::WaitableEvent* shutdown_event);
+ scoped_ptr<nacl::ListenerDelegate> delegate_;
// A channel back to the browser.
scoped_ptr<IPC::SyncChannel> channel_;
@@ -69,19 +56,6 @@ class NaClListener : public IPC::Listener {
base::WaitableEvent shutdown_event_;
base::Thread io_thread_;
- bool uses_nonsfi_mode_;
-#if defined(OS_LINUX)
- size_t prereserved_sandbox_size_;
-#endif
-#if defined(OS_POSIX)
- // The outer sandbox on Linux and OSX prevents
- // sysconf(_SC_NPROCESSORS) from working; in Windows, there are no
- // problems with invoking GetSystemInfo. Therefore, only in
- // OS_POSIX do we need to supply the number of cores into the
- // NaClChromeMainArgs object.
- int number_of_cores_;
-#endif
-
scoped_refptr<NaClTrustedListener> trusted_listener_;
// Used to identify what thread we're on.

Powered by Google App Engine
This is Rietveld 408576698