OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/nacl/nacl_main_platform_delegate.h" | 5 #include "chrome/nacl/nacl_main_platform_delegate.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/native_library.h" | 10 #include "base/native_library.h" |
11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
12 #include "native_client/src/shared/srpc/nacl_srpc.h" | |
13 #include "native_client/src/trusted/desc/nrd_all_modules.h" | |
12 #include "sandbox/win/src/sandbox.h" | 14 #include "sandbox/win/src/sandbox.h" |
13 | 15 |
14 NaClMainPlatformDelegate::NaClMainPlatformDelegate( | 16 NaClMainPlatformDelegate::NaClMainPlatformDelegate( |
15 const content::MainFunctionParams& parameters) | 17 const content::MainFunctionParams& parameters) |
16 : parameters_(parameters), sandbox_test_module_(NULL) { | 18 : parameters_(parameters), sandbox_test_module_(NULL) { |
17 } | 19 } |
18 | 20 |
19 NaClMainPlatformDelegate::~NaClMainPlatformDelegate() { | 21 NaClMainPlatformDelegate::~NaClMainPlatformDelegate() { |
20 } | 22 } |
21 | 23 |
22 void NaClMainPlatformDelegate::PlatformInitialize() { | 24 void NaClMainPlatformDelegate::PlatformInitialize() { |
23 // Be mindful of what resources you acquire here. They can be used by | 25 // Be mindful of what resources you acquire here. They can be used by |
24 // malicious code if the renderer gets compromised. | 26 // malicious code if the renderer gets compromised. |
27 | |
28 NaClNrdAllModulesInit(); | |
29 NaClSrpcModuleInit(); | |
dmichael (off chromium)
2012/08/16 21:23:17
This fixes (or just works around?) a problem we're
| |
25 } | 30 } |
26 | 31 |
27 void NaClMainPlatformDelegate::PlatformUninitialize() { | 32 void NaClMainPlatformDelegate::PlatformUninitialize() { |
33 NaClSrpcModuleFini(); | |
34 NaClNrdAllModulesFini(); | |
28 } | 35 } |
29 | 36 |
30 void NaClMainPlatformDelegate::InitSandboxTests(bool no_sandbox) { | 37 void NaClMainPlatformDelegate::InitSandboxTests(bool no_sandbox) { |
31 const CommandLine& command_line = parameters_.command_line; | 38 const CommandLine& command_line = parameters_.command_line; |
32 | 39 |
33 DVLOG(1) << "Started NaClLdr with " << command_line.GetCommandLineString(); | 40 DVLOG(1) << "Started NaClLdr with " << command_line.GetCommandLineString(); |
34 | 41 |
35 sandbox::TargetServices* target_services = | 42 sandbox::TargetServices* target_services = |
36 parameters_.sandbox_info->target_services; | 43 parameters_.sandbox_info->target_services; |
37 | 44 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 result = (*run_security_tests)(); | 92 result = (*run_security_tests)(); |
86 } else { | 93 } else { |
87 VLOG(1) << "Failed to get NaCl sandbox test function"; | 94 VLOG(1) << "Failed to get NaCl sandbox test function"; |
88 result = false; | 95 result = false; |
89 } | 96 } |
90 base::UnloadNativeLibrary(sandbox_test_module_); | 97 base::UnloadNativeLibrary(sandbox_test_module_); |
91 sandbox_test_module_ = NULL; | 98 sandbox_test_module_ = NULL; |
92 } | 99 } |
93 return result; | 100 return result; |
94 } | 101 } |
OLD | NEW |