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

Unified Diff: components/nacl/loader/nacl_helper_linux.cc

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_helper_linux.cc
diff --git a/components/nacl/loader/nacl_helper_linux.cc b/components/nacl/loader/nacl_helper_linux.cc
index 8c042d02688e6a039b5d565f8e43eb138e00917f..e9da29942825d9b663ecbee7fa6af3de92145a34 100644
--- a/components/nacl/loader/nacl_helper_linux.cc
+++ b/components/nacl/loader/nacl_helper_linux.cc
@@ -33,9 +33,12 @@
#include "base/process/process_handle.h"
#include "base/rand_util.h"
#include "components/nacl/common/nacl_switches.h"
+#include "components/nacl/loader/listener_delegate.h"
#include "components/nacl/loader/nacl_listener.h"
#include "components/nacl/loader/nonsfi/irt_exception_handling.h"
+#include "components/nacl/loader/nonsfi_listener_delegate.h"
#include "components/nacl/loader/sandbox_linux/nacl_sandbox_linux.h"
+#include "components/nacl/loader/sfi_listener_delegate.h"
#include "content/public/common/child_process_sandbox_support_linux.h"
#include "content/public/common/content_descriptors.h"
#include "content/public/common/zygote_fork_delegate_linux.h"
@@ -106,10 +109,18 @@ void BecomeNaClLoader(base::ScopedFD browser_fd,
browser_fd.release());
base::MessageLoopForIO main_message_loop;
- NaClListener listener;
- listener.set_uses_nonsfi_mode(uses_nonsfi_mode);
- listener.set_prereserved_sandbox_size(system_info.prereserved_sandbox_size);
- listener.set_number_of_cores(system_info.number_of_cores);
+
+ scoped_ptr<nacl::ListenerDelegate> delegate;
+ if (uses_nonsfi_mode) {
+ delegate.reset(new nacl::NonSfiListenerDelegate);
+ } else {
+ nacl::SfiListenerDelegate* sfi_delegate = new nacl::SfiListenerDelegate;
+ sfi_delegate->set_prereserved_sandbox_size(
+ system_info.prereserved_sandbox_size);
+ sfi_delegate->set_number_of_cores(system_info.number_of_cores);
+ delegate.reset(sfi_delegate);
+ }
+ NaClListener listener(delegate.Pass());
listener.Listen();
_exit(0);
}

Powered by Google App Engine
This is Rietveld 408576698