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

Side by Side Diff: chrome/browser/chromeos/memory/oom_priority_manager.cc

Issue 635573005: Cleanup: Better constify some strings in chrome/browser/{chromeos,extensions}. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, nit Created 6 years, 1 month 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 "chrome/browser/chromeos/memory/oom_priority_manager.h" 5 #include "chrome/browser/chromeos/memory/oom_priority_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 details->StartFetch(MemoryDetails::SKIP_USER_METRICS); 265 details->StartFetch(MemoryDetails::SKIP_USER_METRICS);
266 } 266 }
267 267
268 /////////////////////////////////////////////////////////////////////////////// 268 ///////////////////////////////////////////////////////////////////////////////
269 // OomPriorityManager, private: 269 // OomPriorityManager, private:
270 270
271 // static 271 // static
272 bool OomPriorityManager::IsReloadableUI(const GURL& url) { 272 bool OomPriorityManager::IsReloadableUI(const GURL& url) {
273 // There are many chrome:// UI URLs, but only look for the ones that users 273 // There are many chrome:// UI URLs, but only look for the ones that users
274 // are likely to have open. Most of the benefit is the from NTP URL. 274 // are likely to have open. Most of the benefit is the from NTP URL.
275 const char* kReloadableUrlPrefixes[] = { 275 const char* const kReloadableUrlPrefixes[] = {
276 chrome::kChromeUIDownloadsURL, 276 chrome::kChromeUIDownloadsURL,
277 chrome::kChromeUIHistoryURL, 277 chrome::kChromeUIHistoryURL,
278 chrome::kChromeUINewTabURL, 278 chrome::kChromeUINewTabURL,
279 chrome::kChromeUISettingsURL, 279 chrome::kChromeUISettingsURL,
280 }; 280 };
281 // Prefix-match against the table above. Use strncmp to avoid allocating 281 // Prefix-match against the table above. Use strncmp to avoid allocating
282 // memory to convert the URL prefix constants into std::strings. 282 // memory to convert the URL prefix constants into std::strings.
283 for (size_t i = 0; i < arraysize(kReloadableUrlPrefixes); ++i) { 283 for (size_t i = 0; i < arraysize(kReloadableUrlPrefixes); ++i) {
284 if (!strncmp(url.spec().c_str(), 284 if (!strncmp(url.spec().c_str(),
285 kReloadableUrlPrefixes[i], 285 kReloadableUrlPrefixes[i],
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 if (it == pid_to_oom_score_.end() || it->second != score) { 654 if (it == pid_to_oom_score_.end() || it->second != score) {
655 content::ZygoteHost::GetInstance()->AdjustRendererOOMScore(*iterator, 655 content::ZygoteHost::GetInstance()->AdjustRendererOOMScore(*iterator,
656 score); 656 score);
657 pid_to_oom_score_[*iterator] = score; 657 pid_to_oom_score_[*iterator] = score;
658 } 658 }
659 priority += priority_increment; 659 priority += priority_increment;
660 } 660 }
661 } 661 }
662 662
663 } // namespace chromeos 663 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698