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

Side by Side Diff: chrome/nacl/nacl_main.cc

Issue 14238013: Set up NaClChromeMainArgs number_of_cores member so apps can size threadpools appropriately (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR fb Created 7 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 unified diff | Download patch
« no previous file with comments | « chrome/nacl/nacl_listener.cc ('k') | chrome/test/data/nacl/nacl_test_data.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/hi_res_timer_manager.h" 8 #include "base/hi_res_timer_manager.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/power_monitor/power_monitor.h" 10 #include "base/power_monitor/power_monitor.h"
(...skipping 15 matching lines...) Expand all
26 base::PowerMonitor power_monitor; 26 base::PowerMonitor power_monitor;
27 HighResolutionTimerManager hi_res_timer_manager; 27 HighResolutionTimerManager hi_res_timer_manager;
28 28
29 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) 29 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)
30 NaClMainPlatformDelegate platform(parameters); 30 NaClMainPlatformDelegate platform(parameters);
31 31
32 platform.PlatformInitialize(); 32 platform.PlatformInitialize();
33 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox); 33 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox);
34 platform.InitSandboxTests(no_sandbox); 34 platform.InitSandboxTests(no_sandbox);
35 35
36 #if defined(OS_POSIX)
37 // The number of cores must be obtained before the invocation of
38 // platform.EnableSandbox(), so cannot simply be inlined below.
39 int number_of_cores = sysconf(_SC_NPROCESSORS_ONLN);
40 #endif
41
36 if (!no_sandbox) { 42 if (!no_sandbox) {
37 platform.EnableSandbox(); 43 platform.EnableSandbox();
38 } 44 }
39 bool sandbox_test_result = platform.RunSandboxTests(); 45 bool sandbox_test_result = platform.RunSandboxTests();
40 46
41 if (sandbox_test_result) { 47 if (sandbox_test_result) {
42 NaClListener listener; 48 NaClListener listener;
49 #if defined(OS_POSIX)
50 listener.set_number_of_cores(number_of_cores);
51 #endif
43 listener.Listen(); 52 listener.Listen();
44 } else { 53 } else {
45 // This indirectly prevents the test-harness-success-cookie from being set, 54 // This indirectly prevents the test-harness-success-cookie from being set,
46 // as a way of communicating test failure, because the nexe won't reply. 55 // as a way of communicating test failure, because the nexe won't reply.
47 // TODO(jvoung): find a better way to indicate failure that doesn't 56 // TODO(jvoung): find a better way to indicate failure that doesn't
48 // require waiting for a timeout. 57 // require waiting for a timeout.
49 VLOG(1) << "Sandbox test failed: Not launching NaCl process"; 58 VLOG(1) << "Sandbox test failed: Not launching NaCl process";
50 } 59 }
51 #else 60 #else
52 NOTIMPLEMENTED() << " not implemented startup, plugin startup dialog etc."; 61 NOTIMPLEMENTED() << " not implemented startup, plugin startup dialog etc.";
53 #endif 62 #endif
54 63
55 platform.PlatformUninitialize(); 64 platform.PlatformUninitialize();
56 return 0; 65 return 0;
57 } 66 }
OLDNEW
« no previous file with comments | « chrome/nacl/nacl_listener.cc ('k') | chrome/test/data/nacl/nacl_test_data.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698