| 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 "content/public/app/startup_helper_win.h" | 5 #include "content/public/app/startup_helper_win.h" |
| 6 | 6 |
| 7 #include <crtdbg.h> | 7 #include <crtdbg.h> |
| 8 #include <new.h> | 8 #include <new.h> |
| 9 | 9 |
| 10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 namespace content { | 36 namespace content { |
| 37 | 37 |
| 38 void InitializeSandboxInfo(sandbox::SandboxInterfaceInfo* info) { | 38 void InitializeSandboxInfo(sandbox::SandboxInterfaceInfo* info) { |
| 39 info->broker_services = sandbox::SandboxFactory::GetBrokerServices(); | 39 info->broker_services = sandbox::SandboxFactory::GetBrokerServices(); |
| 40 if (!info->broker_services) { | 40 if (!info->broker_services) { |
| 41 info->target_services = sandbox::SandboxFactory::GetTargetServices(); | 41 info->target_services = sandbox::SandboxFactory::GetTargetServices(); |
| 42 } else { | 42 } else { |
| 43 // Ensure the proper mitigations are enforced for the browser process. | 43 // Ensure the proper mitigations are enforced for the browser process. |
| 44 sandbox::ApplyProcessMitigationsToCurrentProcess( | 44 sandbox::ApplyProcessMitigationsToCurrentProcess( |
| 45 sandbox::MITIGATION_DEP | | 45 sandbox::MITIGATION_DEP | |
| 46 sandbox::MITIGATION_DEP_NO_ATL_THUNK); | 46 sandbox::MITIGATION_DEP_NO_ATL_THUNK | |
| 47 sandbox::MITIGATION_HARDEN_TOKEN_IL_POLICY); |
| 47 } | 48 } |
| 48 } | 49 } |
| 49 | 50 |
| 50 // Register the invalid param handler and pure call handler to be able to | 51 // Register the invalid param handler and pure call handler to be able to |
| 51 // notify breakpad when it happens. | 52 // notify breakpad when it happens. |
| 52 void RegisterInvalidParamHandler() { | 53 void RegisterInvalidParamHandler() { |
| 53 _set_invalid_parameter_handler(InvalidParameter); | 54 _set_invalid_parameter_handler(InvalidParameter); |
| 54 _set_purecall_handler(PureCall); | 55 _set_purecall_handler(PureCall); |
| 55 // Also enable the new handler for malloc() based failures. | 56 // Also enable the new handler for malloc() based failures. |
| 56 _set_new_mode(1); | 57 _set_new_mode(1); |
| 57 } | 58 } |
| 58 | 59 |
| 59 void SetupCRT(const base::CommandLine& command_line) { | 60 void SetupCRT(const base::CommandLine& command_line) { |
| 60 #if defined(_CRTDBG_MAP_ALLOC) | 61 #if defined(_CRTDBG_MAP_ALLOC) |
| 61 _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); | 62 _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); |
| 62 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); | 63 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); |
| 63 #else | 64 #else |
| 64 if (!command_line.HasSwitch(switches::kDisableBreakpad)) { | 65 if (!command_line.HasSwitch(switches::kDisableBreakpad)) { |
| 65 _CrtSetReportMode(_CRT_ASSERT, 0); | 66 _CrtSetReportMode(_CRT_ASSERT, 0); |
| 66 } | 67 } |
| 67 #endif | 68 #endif |
| 68 } | 69 } |
| 69 | 70 |
| 70 } // namespace content | 71 } // namespace content |
| OLD | NEW |