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

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

Issue 1595633002: Use valid /prefetch arguments for process launches on Windows. - do not submit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move
Patch Set: format Created 4 years, 11 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
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/profiler.h" 13 #include "base/debug/profiler.h"
14 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
15 #include "base/hash.h" 15 #include "base/hash.h"
gab 2016/01/18 19:10:52 Also remove this.
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/shared_memory.h" 18 #include "base/memory/shared_memory.h"
19 #include "base/metrics/field_trial.h" 19 #include "base/metrics/field_trial.h"
20 #include "base/metrics/sparse_histogram.h" 20 #include "base/metrics/sparse_histogram.h"
21 #include "base/path_service.h" 21 #include "base/path_service.h"
22 #include "base/process/launch.h" 22 #include "base/process/launch.h"
23 #include "base/strings/string_number_conversions.h" 23 #include "base/strings/string_number_conversions.h"
24 #include "base/strings/string_util.h" 24 #include "base/strings/string_util.h"
25 #include "base/strings/stringprintf.h" 25 #include "base/strings/stringprintf.h"
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 TRACE_EVENT1("startup", "StartProcessWithAccess", "type", type_str); 674 TRACE_EVENT1("startup", "StartProcessWithAccess", "type", type_str);
675 675
676 // Propagate the --allow-no-job flag if present. 676 // Propagate the --allow-no-job flag if present.
677 if (browser_command_line.HasSwitch(switches::kAllowNoSandboxJob) && 677 if (browser_command_line.HasSwitch(switches::kAllowNoSandboxJob) &&
678 !cmd_line->HasSwitch(switches::kAllowNoSandboxJob)) { 678 !cmd_line->HasSwitch(switches::kAllowNoSandboxJob)) {
679 cmd_line->AppendSwitch(switches::kAllowNoSandboxJob); 679 cmd_line->AppendSwitch(switches::kAllowNoSandboxJob);
680 } 680 }
681 681
682 ProcessDebugFlags(cmd_line); 682 ProcessDebugFlags(cmd_line);
683 683
684 // Prefetch hints on windows:
685 // Using a different prefetch profile per process type will allow Windows
686 // to create separate pretetch settings for browser, renderer etc.
687 cmd_line->AppendArg(base::StringPrintf("/prefetch:%d", base::Hash(type_str)));
688
689 if ((!delegate->ShouldSandbox()) || 684 if ((!delegate->ShouldSandbox()) ||
690 browser_command_line.HasSwitch(switches::kNoSandbox) || 685 browser_command_line.HasSwitch(switches::kNoSandbox) ||
691 cmd_line->HasSwitch(switches::kNoSandbox)) { 686 cmd_line->HasSwitch(switches::kNoSandbox)) {
692 base::Process process = 687 base::Process process =
693 base::LaunchProcess(*cmd_line, base::LaunchOptions()); 688 base::LaunchProcess(*cmd_line, base::LaunchOptions());
694 // TODO(rvargas) crbug.com/417532: Don't share a raw handle. 689 // TODO(rvargas) crbug.com/417532: Don't share a raw handle.
695 g_broker_services->AddTargetPeer(process.Handle()); 690 g_broker_services->AddTargetPeer(process.Handle());
696 return process.Pass(); 691 return process.Pass();
697 } 692 }
698 693
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 } 854 }
860 855
861 return false; 856 return false;
862 } 857 }
863 858
864 bool BrokerAddTargetPeer(HANDLE peer_process) { 859 bool BrokerAddTargetPeer(HANDLE peer_process) {
865 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; 860 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK;
866 } 861 }
867 862
868 } // namespace content 863 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698