| Index: chrome/app/prefetch_argument_win.cc
|
| diff --git a/chrome/app/prefetch_argument_win.cc b/chrome/app/prefetch_argument_win.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..66d70536aa194356386bc8bade3221caebecf165
|
| --- /dev/null
|
| +++ b/chrome/app/prefetch_argument_win.cc
|
| @@ -0,0 +1,25 @@
|
| +// Copyright (c) 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "base/command_line.h"
|
| +#include "base/macros.h"
|
| +#include "base/strings/string16.h"
|
| +#include "base/strings/string_util.h"
|
| +
|
| +bool HasValidWindowsPrefetchArgument(const base::CommandLine& command_line) {
|
| + const base::char16 kPrefetchArgumentPrefix[] = L"/prefetch:";
|
| +
|
| + // Check if |command_line| contains an argument "/prefetch:#" where # is
|
| + // [1, 8].
|
| + for (const auto& arg : command_line.argv()) {
|
| + if (arg.size() == arraysize(kPrefetchArgumentPrefix) &&
|
| + base::StartsWith(arg, kPrefetchArgumentPrefix,
|
| + base::CompareCase::SENSITIVE) &&
|
| + arg[arraysize(kPrefetchArgumentPrefix) - 1] >= L'1' &&
|
| + arg[arraysize(kPrefetchArgumentPrefix) - 1] <= L'8') {
|
| + return true;
|
| + }
|
| + }
|
| + return false;
|
| +}
|
|
|