Chromium Code Reviews| 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 const size_t kPrefetchArgumentSize = arraysize(kPrefetchArgumentPrefix); | |
|
gab
2016/01/26 21:40:26
arraysize() is a compile-time constant, no need to
fdoray
2016/01/27 20:12:19
Done.
| |
| 13 | |
| 14 // Check if |command_line| contains an argument "/prefetch:#" where # is | |
| 15 // [1, 8]. | |
| 16 for (const auto& arg : command_line.argv()) { | |
| 17 if (arg.size() == kPrefetchArgumentSize && | |
| 18 base::StartsWith(arg, kPrefetchArgumentPrefix, | |
| 19 base::CompareCase::SENSITIVE) && | |
| 20 arg[kPrefetchArgumentSize - 1] >= L'1' && | |
| 21 arg[kPrefetchArgumentSize - 1] <= L'8') { | |
| 22 return true; | |
| 23 } | |
| 24 } | |
| 25 return false; | |
| 26 } | |
| OLD | NEW |