summaryrefslogtreecommitdiffstats
path: root/chrome/nacl
diff options
context:
space:
mode:
authornoelallen@google.com <noelallen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-28 22:55:28 +0000
committernoelallen@google.com <noelallen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-28 22:55:28 +0000
commita63736b3293cec5d2f1ad3588dc15aa54ae74c6b (patch)
tree822afb79561c2986d55bbd8171971f504dcf4f7b /chrome/nacl
parentd4799a3bf70ecc62ab702150cae1d1e925b14938 (diff)
downloadchromium_src-a63736b3293cec5d2f1ad3588dc15aa54ae74c6b.zip
chromium_src-a63736b3293cec5d2f1ad3588dc15aa54ae74c6b.tar.gz
chromium_src-a63736b3293cec5d2f1ad3588dc15aa54ae74c6b.tar.bz2
Update the interface between Chrome and sel_main_chrome. Added a debug flag in the nacl_thread class.
Moved static LaunchNaClChildProcess inline since we need access to variables from the single caller. BUG=http://code.google.com/p/nativeclient/issues/detail?id=728 TEST=none Test to be added to NaCl integration bots. Review URL: http://codereview.chromium.org/3527001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60864 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/nacl')
-rw-r--r--chrome/nacl/nacl_main.cc11
-rw-r--r--chrome/nacl/nacl_thread.cc9
-rw-r--r--chrome/nacl/nacl_thread.h4
3 files changed, 13 insertions, 11 deletions
diff --git a/chrome/nacl/nacl_main.cc b/chrome/nacl/nacl_main.cc
index 24d8b1d..4477494 100644
--- a/chrome/nacl/nacl_main.cc
+++ b/chrome/nacl/nacl_main.cc
@@ -88,12 +88,6 @@ static void HandleNaClTestParameters(const CommandLine& command_line) {
}
}
-static void LaunchNaClChildProcess() {
- ChildProcess nacl_process;
- nacl_process.set_main_thread(new NaClThread());
- MessageLoop::current()->Run();
-}
-
// main() routine for the NaCl loader process.
int NaClMain(const MainFunctionParams& parameters) {
const CommandLine& parsed_command_line = parameters.command_line_;
@@ -124,7 +118,10 @@ int NaClMain(const MainFunctionParams& parameters) {
bool sandbox_test_result = platform.RunSandboxTests();
if (sandbox_test_result) {
- LaunchNaClChildProcess();
+ ChildProcess nacl_process;
+ bool debug = parsed_command_line.HasSwitch(switches::kEnableNaClDebug);
+ nacl_process.set_main_thread(new NaClThread(debug));
+ MessageLoop::current()->Run();
} else {
// This indirectly prevents the test-harness-success-cookie from being set,
// as a way of communicating test failure, because the nexe won't reply.
diff --git a/chrome/nacl/nacl_thread.cc b/chrome/nacl/nacl_thread.cc
index c1ab76d..c0a64a7 100644
--- a/chrome/nacl/nacl_thread.cc
+++ b/chrome/nacl/nacl_thread.cc
@@ -19,9 +19,11 @@ typedef int NaClHandle;
// This is currently necessary because we have a conflict between
// NaCl's "struct NaClThread" and Chromium's "class NaClThread".
-extern "C" int NaClMainForChromium(int handle_count, const NaClHandle* handles);
+extern "C" int NaClMainForChromium(int handle_count, const NaClHandle* handles,
+ int debug);
-NaClThread::NaClThread() {
+NaClThread::NaClThread(bool debug) {
+ debug_enabled_ = debug ? 1 : 0;
}
NaClThread::~NaClThread() {
@@ -42,5 +44,6 @@ void NaClThread::OnStartSelLdr(std::vector<nacl::FileDescriptor> handles) {
for (size_t i = 0; i < handles.size(); i++) {
array[i] = nacl::ToNativeHandle(handles[i]);
}
- NaClMainForChromium(static_cast<int>(handles.size()), array.get());
+ NaClMainForChromium(static_cast<int>(handles.size()), array.get(),
+ debug_enabled_);
}
diff --git a/chrome/nacl/nacl_thread.h b/chrome/nacl/nacl_thread.h
index f7272d1..f87fc969 100644
--- a/chrome/nacl/nacl_thread.h
+++ b/chrome/nacl/nacl_thread.h
@@ -14,7 +14,7 @@
// started.
class NaClThread : public ChildThread {
public:
- NaClThread();
+ explicit NaClThread(bool debug);
~NaClThread();
// Returns the one NaCl thread.
static NaClThread* current();
@@ -23,6 +23,8 @@ class NaClThread : public ChildThread {
virtual void OnControlMessageReceived(const IPC::Message& msg);
void OnStartSelLdr(std::vector<nacl::FileDescriptor> handles);
+ int debug_enabled_;
+
// TODO(gregoryd): do we need to override Cleanup as in PluginThread?
DISALLOW_COPY_AND_ASSIGN(NaClThread);
};