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

Side by Side Diff: components/nacl/loader/nacl_main.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/memory/scoped_ptr.h"
8 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
9 #include "base/power_monitor/power_monitor.h" 10 #include "base/power_monitor/power_monitor.h"
10 #include "base/power_monitor/power_monitor_device_source.h" 11 #include "base/power_monitor/power_monitor_device_source.h"
11 #include "base/timer/hi_res_timer_manager.h" 12 #include "base/timer/hi_res_timer_manager.h"
13 #include "components/nacl/loader/listener_delegate.h"
12 #include "components/nacl/loader/nacl_listener.h" 14 #include "components/nacl/loader/nacl_listener.h"
13 #include "components/nacl/loader/nacl_main_platform_delegate.h" 15 #include "components/nacl/loader/nacl_main_platform_delegate.h"
16 #include "components/nacl/loader/sfi_listener_delegate.h"
14 #include "content/public/common/content_switches.h" 17 #include "content/public/common/content_switches.h"
15 #include "content/public/common/main_function_params.h" 18 #include "content/public/common/main_function_params.h"
16 19
17 // main() routine for the NaCl loader process. 20 // main() routine for the NaCl loader process.
18 int NaClMain(const content::MainFunctionParams& parameters) { 21 int NaClMain(const content::MainFunctionParams& parameters) {
19 const CommandLine& parsed_command_line = parameters.command_line; 22 const CommandLine& parsed_command_line = parameters.command_line;
20 23
21 // The main thread of the plugin services IO. 24 // The main thread of the plugin services IO.
22 base::MessageLoopForIO main_message_loop; 25 base::MessageLoopForIO main_message_loop;
23 base::PlatformThread::SetName("CrNaClMain"); 26 base::PlatformThread::SetName("CrNaClMain");
(...skipping 10 matching lines...) Expand all
34 37
35 #if defined(OS_POSIX) 38 #if defined(OS_POSIX)
36 // The number of cores must be obtained before the invocation of 39 // The number of cores must be obtained before the invocation of
37 // platform.EnableSandbox(), so cannot simply be inlined below. 40 // platform.EnableSandbox(), so cannot simply be inlined below.
38 int number_of_cores = sysconf(_SC_NPROCESSORS_ONLN); 41 int number_of_cores = sysconf(_SC_NPROCESSORS_ONLN);
39 #endif 42 #endif
40 43
41 if (!no_sandbox) { 44 if (!no_sandbox) {
42 platform.EnableSandbox(); 45 platform.EnableSandbox();
43 } 46 }
44 NaClListener listener; 47
48 nacl::SfiListenerDelegate* delegate = new nacl::SfiListenerDelegate;
45 #if defined(OS_POSIX) 49 #if defined(OS_POSIX)
46 listener.set_number_of_cores(number_of_cores); 50 delegate->set_number_of_cores(number_of_cores);
47 #endif 51 #endif
48 52
53 NaClListener listener(make_scoped_ptr<nacl::ListenerDelegate>(delegate));
49 listener.Listen(); 54 listener.Listen();
50 #else 55 #else
51 NOTIMPLEMENTED() << " not implemented startup, plugin startup dialog etc."; 56 NOTIMPLEMENTED() << " not implemented startup, plugin startup dialog etc.";
52 #endif 57 #endif
53 return 0; 58 return 0;
54 } 59 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698