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

Side by Side Diff: chrome/browser/chrome_browser_main_win.cc

Issue 41953002: Use HighResNow whenever possible on Windows. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/app/content_main_runner.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/chrome_browser_main_win.h" 5 #include "chrome/browser/chrome_browser_main_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 << user_shortcut_locations[i]; 137 << user_shortcut_locations[i];
138 } 138 }
139 } 139 }
140 } else { 140 } else {
141 NOTREACHED(); 141 NOTREACHED();
142 } 142 }
143 } 143 }
144 return result; 144 return result;
145 } 145 }
146 146
147 void MaybeEnableHighResolutionTimeEverywhere() {
148 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
149 bool user_enabled = CommandLine::ForCurrentProcess()->HasSwitch(
150 switches::kEnableHighResolutionTime);
151 if (user_enabled || channel == chrome::VersionInfo::CHANNEL_CANARY) {
152 bool is_enabled = base::TimeTicks::SetNowIsHighResNowIfSupported();
153 if (is_enabled && !user_enabled) {
154 // Ensure that all of the renderers will enable it too.
155 CommandLine::ForCurrentProcess()->AppendSwitch(
156 switches::kEnableHighResolutionTime);
157 }
158 }
159 }
160
161 // ChromeBrowserMainPartsWin --------------------------------------------------- 147 // ChromeBrowserMainPartsWin ---------------------------------------------------
162 148
163 ChromeBrowserMainPartsWin::ChromeBrowserMainPartsWin( 149 ChromeBrowserMainPartsWin::ChromeBrowserMainPartsWin(
164 const content::MainFunctionParams& parameters) 150 const content::MainFunctionParams& parameters)
165 : ChromeBrowserMainParts(parameters) { 151 : ChromeBrowserMainParts(parameters) {
166 MaybeEnableHighResolutionTimeEverywhere(); 152 base::TimeTicks::SetNowIsHighResNowIfSupported();
167 if (base::win::IsMetroProcess()) { 153 if (base::win::IsMetroProcess()) {
168 typedef const wchar_t* (*GetMetroSwitches)(void); 154 typedef const wchar_t* (*GetMetroSwitches)(void);
169 GetMetroSwitches metro_switches_proc = reinterpret_cast<GetMetroSwitches>( 155 GetMetroSwitches metro_switches_proc = reinterpret_cast<GetMetroSwitches>(
170 GetProcAddress(base::win::GetMetroModule(), 156 GetProcAddress(base::win::GetMetroModule(),
171 "GetMetroCommandLineSwitches")); 157 "GetMetroCommandLineSwitches"));
172 if (metro_switches_proc) { 158 if (metro_switches_proc) {
173 string16 metro_switches = (*metro_switches_proc)(); 159 string16 metro_switches = (*metro_switches_proc)();
174 if (!metro_switches.empty()) { 160 if (!metro_switches.empty()) {
175 CommandLine extra_switches(CommandLine::NO_PROGRAM); 161 CommandLine extra_switches(CommandLine::NO_PROGRAM);
176 extra_switches.ParseFromString(metro_switches); 162 extra_switches.ParseFromString(metro_switches);
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 if (resource_id) 393 if (resource_id)
408 return l10n_util::GetStringUTF16(resource_id); 394 return l10n_util::GetStringUTF16(resource_id);
409 return string16(); 395 return string16();
410 } 396 }
411 397
412 // static 398 // static
413 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { 399 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() {
414 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); 400 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ());
415 installer::SetTranslationDelegate(&delegate); 401 installer::SetTranslationDelegate(&delegate);
416 } 402 }
OLDNEW
« no previous file with comments | « no previous file | content/app/content_main_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698