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

Side by Side Diff: content/common/sandbox_win.cc

Issue 2680123003: Multi-Process Tracking Support (Closed)
Patch Set: move tracking from target_process to sandbox_win Created 3 years, 9 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 | « content/app/content_main.cc ('k') | no next file » | 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 "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
11 #include "base/base_switches.h" 11 #include "base/base_switches.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/debug/activity_tracker.h"
13 #include "base/debug/profiler.h" 14 #include "base/debug/profiler.h"
14 #include "base/files/file_util.h" 15 #include "base/files/file_util.h"
15 #include "base/hash.h" 16 #include "base/hash.h"
16 #include "base/logging.h" 17 #include "base/logging.h"
17 #include "base/macros.h" 18 #include "base/macros.h"
18 #include "base/memory/shared_memory.h" 19 #include "base/memory/shared_memory.h"
19 #include "base/metrics/field_trial.h" 20 #include "base/metrics/field_trial.h"
20 #include "base/metrics/histogram_macros.h" 21 #include "base/metrics/histogram_macros.h"
21 #include "base/path_service.h" 22 #include "base/path_service.h"
22 #include "base/process/launch.h" 23 #include "base/process/launch.h"
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 DWORD last_error = ERROR_SUCCESS; 830 DWORD last_error = ERROR_SUCCESS;
830 result = g_broker_services->SpawnTarget( 831 result = g_broker_services->SpawnTarget(
831 cmd_line->GetProgram().value().c_str(), 832 cmd_line->GetProgram().value().c_str(),
832 cmd_line->GetCommandLineString().c_str(), policy, &last_warning, 833 cmd_line->GetCommandLineString().c_str(), policy, &last_warning,
833 &last_error, &temp_process_info); 834 &last_error, &temp_process_info);
834 835
835 base::win::ScopedProcessInformation target(temp_process_info); 836 base::win::ScopedProcessInformation target(temp_process_info);
836 837
837 TRACE_EVENT_END0("startup", "StartProcessWithAccess::LAUNCHPROCESS"); 838 TRACE_EVENT_END0("startup", "StartProcessWithAccess::LAUNCHPROCESS");
838 839
840 base::debug::GlobalActivityTracker* tracker =
841 base::debug::GlobalActivityTracker::Get();
842 if (tracker) {
843 tracker->RecordProcessLaunch(target.process_id(),
844 cmd_line->GetCommandLineString());
845 }
846
839 if (sandbox::SBOX_ALL_OK != result) { 847 if (sandbox::SBOX_ALL_OK != result) {
840 UMA_HISTOGRAM_SPARSE_SLOWLY("Process.Sandbox.Launch.Error", last_error); 848 UMA_HISTOGRAM_SPARSE_SLOWLY("Process.Sandbox.Launch.Error", last_error);
841 if (result == sandbox::SBOX_ERROR_GENERIC) 849 if (result == sandbox::SBOX_ERROR_GENERIC)
842 DPLOG(ERROR) << "Failed to launch process"; 850 DPLOG(ERROR) << "Failed to launch process";
843 else 851 else
844 DLOG(ERROR) << "Failed to launch process. Error: " << result; 852 DLOG(ERROR) << "Failed to launch process. Error: " << result;
845 853
846 return result; 854 return result;
847 } 855 }
848 856
849 if (sandbox::SBOX_ALL_OK != last_warning) { 857 if (sandbox::SBOX_ALL_OK != last_warning) {
850 LogLaunchWarning(last_warning, last_error); 858 LogLaunchWarning(last_warning, last_error);
851 } 859 }
852 860
853 delegate->PostSpawnTarget(target.process_handle()); 861 delegate->PostSpawnTarget(target.process_handle());
854 862
855 CHECK(ResumeThread(target.thread_handle()) != static_cast<DWORD>(-1)); 863 CHECK(ResumeThread(target.thread_handle()) != static_cast<DWORD>(-1));
856 *process = base::Process(target.TakeProcessHandle()); 864 *process = base::Process(target.TakeProcessHandle());
857 return sandbox::SBOX_ALL_OK; 865 return sandbox::SBOX_ALL_OK;
858 } 866 }
859 867
860 } // namespace content 868 } // namespace content
OLDNEW
« no previous file with comments | « content/app/content_main.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698