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

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

Issue 429053002: Use HighResNow whenever possible on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 << user_shortcut_locations[i]; 145 << user_shortcut_locations[i];
146 } 146 }
147 } 147 }
148 } else { 148 } else {
149 NOTREACHED(); 149 NOTREACHED();
150 } 150 }
151 } 151 }
152 return result; 152 return result;
153 } 153 }
154 154
155 void MaybeEnableHighResolutionTimeEverywhere() {
156 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
157 bool user_enabled = CommandLine::ForCurrentProcess()->HasSwitch(
158 switches::kEnableHighResolutionTime);
159 if (user_enabled || channel == chrome::VersionInfo::CHANNEL_CANARY) {
160 bool is_enabled = base::TimeTicks::SetNowIsHighResNowIfSupported();
161 if (is_enabled && !user_enabled) {
162 // Ensure that all of the renderers will enable it too.
163 CommandLine::ForCurrentProcess()->AppendSwitch(
164 switches::kEnableHighResolutionTime);
165 }
166 }
167 }
168
169 // ChromeBrowserMainPartsWin --------------------------------------------------- 155 // ChromeBrowserMainPartsWin ---------------------------------------------------
170 156
171 ChromeBrowserMainPartsWin::ChromeBrowserMainPartsWin( 157 ChromeBrowserMainPartsWin::ChromeBrowserMainPartsWin(
172 const content::MainFunctionParams& parameters) 158 const content::MainFunctionParams& parameters)
173 : ChromeBrowserMainParts(parameters) { 159 : ChromeBrowserMainParts(parameters) {
174 MaybeEnableHighResolutionTimeEverywhere(); 160 base::TimeTicks::SetNowIsHighResNowIfSupported();
175 if (base::win::IsMetroProcess()) { 161 if (base::win::IsMetroProcess()) {
176 typedef const wchar_t* (*GetMetroSwitches)(void); 162 typedef const wchar_t* (*GetMetroSwitches)(void);
177 GetMetroSwitches metro_switches_proc = reinterpret_cast<GetMetroSwitches>( 163 GetMetroSwitches metro_switches_proc = reinterpret_cast<GetMetroSwitches>(
178 GetProcAddress(base::win::GetMetroModule(), 164 GetProcAddress(base::win::GetMetroModule(),
179 "GetMetroCommandLineSwitches")); 165 "GetMetroCommandLineSwitches"));
180 if (metro_switches_proc) { 166 if (metro_switches_proc) {
181 base::string16 metro_switches = (*metro_switches_proc)(); 167 base::string16 metro_switches = (*metro_switches_proc)();
182 if (!metro_switches.empty()) { 168 if (!metro_switches.empty()) {
183 CommandLine extra_switches(CommandLine::NO_PROGRAM); 169 CommandLine extra_switches(CommandLine::NO_PROGRAM);
184 extra_switches.ParseFromString(metro_switches); 170 extra_switches.ParseFromString(metro_switches);
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 if (resource_id) 424 if (resource_id)
439 return l10n_util::GetStringUTF16(resource_id); 425 return l10n_util::GetStringUTF16(resource_id);
440 return base::string16(); 426 return base::string16();
441 } 427 }
442 428
443 // static 429 // static
444 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { 430 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() {
445 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); 431 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ());
446 installer::SetTranslationDelegate(&delegate); 432 installer::SetTranslationDelegate(&delegate);
447 } 433 }
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