OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/command_line.h" |
| 6 #include "base/macros.h" |
| 7 #include "base/strings/string16.h" |
| 8 #include "base/strings/string_util.h" |
| 9 |
| 10 bool HasValidWindowsPrefetchArgument(const base::CommandLine& command_line) { |
| 11 const base::char16 kPrefetchArgumentPrefix[] = L"/prefetch:"; |
| 12 |
| 13 // Check if |command_line| contains an argument "/prefetch:#" where # is |
| 14 // [1, 8]. |
| 15 for (const auto& arg : command_line.argv()) { |
| 16 if (arg.size() == arraysize(kPrefetchArgumentPrefix) && |
| 17 base::StartsWith(arg, kPrefetchArgumentPrefix, |
| 18 base::CompareCase::SENSITIVE) && |
| 19 arg[arraysize(kPrefetchArgumentPrefix) - 1] >= L'1' && |
| 20 arg[arraysize(kPrefetchArgumentPrefix) - 1] <= L'8') { |
| 21 return true; |
| 22 } |
| 23 } |
| 24 return false; |
| 25 } |
OLD | NEW |