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

Unified Diff: chrome/app/prefetch_argument_win.cc

Issue 1612663002: Use a valid /prefetch argument when launching a process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bit
Patch Set: address comments from gab #13 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 side-by-side diff with in-line comments
Download patch
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) {
gab 2016/01/29 19:39:28 This is only used for a DCHECK, how about moving i
fdoray 2016/02/01 13:28:26 Done.
+ 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' &&
gab 2016/01/29 19:39:28 return arg[arraysize(kPrefetchArgumentPrefix) - 1]
fdoray 2016/02/01 13:28:26 Done.
+ arg[arraysize(kPrefetchArgumentPrefix) - 1] <= L'8') {
+ return true;
+ }
+ }
+ return false;
+}

Powered by Google App Engine
This is Rietveld 408576698