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

Side by Side Diff: chrome/browser/web_resource/gpu_blacklist_updater.cc

Issue 8383008: Add a command-line switch --skip-gpu-data-loading. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/test/base/test_launcher_utils.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/web_resource/gpu_blacklist_updater.h" 5 #include "chrome/browser/web_resource/gpu_blacklist_updater.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/prefs/pref_service.h" 11 #include "chrome/browser/prefs/pref_service.h"
12 #include "chrome/browser/prefs/scoped_user_pref_update.h" 12 #include "chrome/browser/prefs/scoped_user_pref_update.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/profiles/profile_manager.h" 14 #include "chrome/browser/profiles/profile_manager.h"
15 #include "chrome/common/chrome_notification_types.h" 15 #include "chrome/common/chrome_notification_types.h"
16 #include "chrome/common/chrome_version_info.h" 16 #include "chrome/common/chrome_version_info.h"
17 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
18 #include "content/browser/browser_thread.h" 18 #include "content/browser/browser_thread.h"
19 #include "content/browser/gpu/gpu_blacklist.h" 19 #include "content/browser/gpu/gpu_blacklist.h"
20 #include "content/browser/gpu/gpu_data_manager.h" 20 #include "content/browser/gpu/gpu_data_manager.h"
21 #include "content/public/common/content_switches.h"
21 #include "grit/browser_resources.h" 22 #include "grit/browser_resources.h"
22 #include "ui/base/resource/resource_bundle.h" 23 #include "ui/base/resource/resource_bundle.h"
23 #include "ui/gfx/gl/gl_implementation.h" 24 #include "ui/gfx/gl/gl_implementation.h"
24 #include "ui/gfx/gl/gl_switches.h" 25 #include "ui/gfx/gl/gl_switches.h"
25 26
26 namespace { 27 namespace {
27 28
28 // Delay on first fetch so we don't interfere with startup. 29 // Delay on first fetch so we don't interfere with startup.
29 static const int kStartGpuBlacklistFetchDelay = 6000; 30 static const int kStartGpuBlacklistFetchDelay = 6000;
30 31
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 GpuBlacklistUpdater::~GpuBlacklistUpdater() { } 78 GpuBlacklistUpdater::~GpuBlacklistUpdater() { }
78 79
79 // static 80 // static
80 void GpuBlacklistUpdater::SetupOnFileThread() { 81 void GpuBlacklistUpdater::SetupOnFileThread() {
81 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 82 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
82 83
83 // Initialize GpuDataManager instance, which collects preliminary 84 // Initialize GpuDataManager instance, which collects preliminary
84 // graphics information. This has to happen on FILE thread. 85 // graphics information. This has to happen on FILE thread.
85 GpuDataManager::GetInstance(); 86 GpuDataManager::GetInstance();
86 87
87 // Skip auto updates in tests.
88 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
89 if ((command_line.GetSwitchValueASCII(switches::kUseGL) ==
90 gfx::kGLImplementationOSMesaName))
91 return;
92
93 // Cache the chrome version string. This has to happen on FILE thread 88 // Cache the chrome version string. This has to happen on FILE thread
94 // because of chrome::VersionInfo::GetChannel(). 89 // because of chrome::VersionInfo::GetChannel().
95 GetChromeVersionString(); 90 GetChromeVersionString();
96 91
92 // Skip auto updates in tests.
93 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
94 if (command_line.HasSwitch(switches::kSkipGpuDataLoading))
95 return;
96
97 // Post GpuBlacklistUpdate task on UI thread. This has to happen 97 // Post GpuBlacklistUpdate task on UI thread. This has to happen
98 // after GpuDataManager is initialized, otherwise it might be 98 // after GpuDataManager is initialized, otherwise it might be
99 // initialzed on UI thread. 99 // initialzed on UI thread.
100 BrowserThread::PostTask( 100 BrowserThread::PostTask(
101 BrowserThread::UI, FROM_HERE, 101 BrowserThread::UI, FROM_HERE,
102 NewRunnableFunction(&GpuBlacklistUpdater::SetupOnUIThread)); 102 NewRunnableFunction(&GpuBlacklistUpdater::SetupOnUIThread));
103 } 103 }
104 104
105 // static 105 // static
106 void GpuBlacklistUpdater::SetupOnUIThread() { 106 void GpuBlacklistUpdater::SetupOnUIThread() {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 scoped_ptr<GpuBlacklist> gpu_blacklist( 147 scoped_ptr<GpuBlacklist> gpu_blacklist(
148 new GpuBlacklist(GetChromeVersionString())); 148 new GpuBlacklist(GetChromeVersionString()));
149 bool success = gpu_blacklist->LoadGpuBlacklist( 149 bool success = gpu_blacklist->LoadGpuBlacklist(
150 gpu_blacklist_cache, GpuBlacklist::kCurrentOsOnly); 150 gpu_blacklist_cache, GpuBlacklist::kCurrentOsOnly);
151 if (success) { 151 if (success) {
152 GpuDataManager::GetInstance()->UpdateGpuBlacklist( 152 GpuDataManager::GetInstance()->UpdateGpuBlacklist(
153 gpu_blacklist.release(), preliminary); 153 gpu_blacklist.release(), preliminary);
154 } 154 }
155 } 155 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/base/test_launcher_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698