OLD | NEW |
---|---|
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 "content/common/sandbox_win.h" | 5 #include "content/common/sandbox_win.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
790 policy->SetStdoutHandle(GetStdHandle(STD_OUTPUT_HANDLE)); | 790 policy->SetStdoutHandle(GetStdHandle(STD_OUTPUT_HANDLE)); |
791 policy->SetStderrHandle(GetStdHandle(STD_ERROR_HANDLE)); | 791 policy->SetStderrHandle(GetStdHandle(STD_ERROR_HANDLE)); |
792 #endif | 792 #endif |
793 | 793 |
794 if (!delegate->PreSpawnTarget(policy)) | 794 if (!delegate->PreSpawnTarget(policy)) |
795 return sandbox::SBOX_ERROR_DELEGATE_PRE_SPAWN; | 795 return sandbox::SBOX_ERROR_DELEGATE_PRE_SPAWN; |
796 | 796 |
797 TRACE_EVENT_BEGIN0("startup", "StartProcessWithAccess::LAUNCHPROCESS"); | 797 TRACE_EVENT_BEGIN0("startup", "StartProcessWithAccess::LAUNCHPROCESS"); |
798 | 798 |
799 PROCESS_INFORMATION temp_process_info = {}; | 799 PROCESS_INFORMATION temp_process_info = {}; |
800 result = g_broker_services->SpawnTarget( | 800 sandbox::ResultCode last_warning = sandbox::SBOX_ALL_OK; |
801 cmd_line->GetProgram().value().c_str(), | 801 result = |
802 cmd_line->GetCommandLineString().c_str(), policy, &temp_process_info); | 802 g_broker_services->SpawnTarget(cmd_line->GetProgram().value().c_str(), |
803 cmd_line->GetCommandLineString().c_str(), | |
804 policy, &last_warning, &temp_process_info); | |
803 DWORD last_error = ::GetLastError(); | 805 DWORD last_error = ::GetLastError(); |
Will Harris
2016/07/12 16:10:59
Seems anachronistic to pass the last_error by SetL
| |
804 base::win::ScopedProcessInformation target(temp_process_info); | 806 base::win::ScopedProcessInformation target(temp_process_info); |
805 | 807 |
806 TRACE_EVENT_END0("startup", "StartProcessWithAccess::LAUNCHPROCESS"); | 808 TRACE_EVENT_END0("startup", "StartProcessWithAccess::LAUNCHPROCESS"); |
807 | 809 |
808 if (sandbox::SBOX_ALL_OK != result) { | 810 if (sandbox::SBOX_ALL_OK != result) { |
809 UMA_HISTOGRAM_SPARSE_SLOWLY("Process.Sandbox.Launch.Error", last_error); | 811 UMA_HISTOGRAM_SPARSE_SLOWLY("Process.Sandbox.Launch.Error", last_error); |
810 if (result == sandbox::SBOX_ERROR_GENERIC) | 812 if (result == sandbox::SBOX_ERROR_GENERIC) |
811 DPLOG(ERROR) << "Failed to launch process"; | 813 DPLOG(ERROR) << "Failed to launch process"; |
812 else | 814 else |
813 DLOG(ERROR) << "Failed to launch process. Error: " << result; | 815 DLOG(ERROR) << "Failed to launch process. Error: " << result; |
814 | 816 |
815 return result; | 817 return result; |
816 } | 818 } |
817 | 819 |
820 if (sandbox::SBOX_ALL_OK != last_warning) { | |
821 UMA_HISTOGRAM_SPARSE_SLOWLY("Process.Sandbox.Launch.WarningResultCode", | |
Will Harris
2016/07/12 16:10:59
it might be an idea to always log this first histo
| |
822 last_warning); | |
823 UMA_HISTOGRAM_SPARSE_SLOWLY("Process.Sandbox.Launch.Warning", last_error); | |
824 } | |
825 | |
818 delegate->PostSpawnTarget(target.process_handle()); | 826 delegate->PostSpawnTarget(target.process_handle()); |
819 | 827 |
820 CHECK(ResumeThread(target.thread_handle()) != static_cast<DWORD>(-1)); | 828 CHECK(ResumeThread(target.thread_handle()) != static_cast<DWORD>(-1)); |
821 *process = base::Process(target.TakeProcessHandle()); | 829 *process = base::Process(target.TakeProcessHandle()); |
822 return sandbox::SBOX_ALL_OK; | 830 return sandbox::SBOX_ALL_OK; |
823 } | 831 } |
824 | 832 |
825 } // namespace content | 833 } // namespace content |
OLD | NEW |