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

Unified Diff: content/browser/gpu/gpu_data_manager.cc

Issue 8772031: Add a JS API for detecting WebGL availability. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years 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: content/browser/gpu/gpu_data_manager.cc
===================================================================
--- content/browser/gpu/gpu_data_manager.cc (revision 112547)
+++ content/browser/gpu/gpu_data_manager.cc (working copy)
@@ -196,6 +196,7 @@
GpuDataManager::GpuDataManager()
: complete_gpu_info_already_requested_(false),
+ complete_gpu_info_available_(false),
observer_list_(new GpuDataManagerObserverList),
software_rendering_(false) {
Initialize();
@@ -208,7 +209,10 @@
if (!user_flags_.skip_gpu_data_loading()) {
content::GPUInfo gpu_info;
gpu_info_collector::CollectPreliminaryGraphicsInfo(&gpu_info);
- UpdateGpuInfo(gpu_info);
+ {
+ base::AutoLock auto_lock(gpu_info_lock_);
+ gpu_info_ = gpu_info;
+ }
}
#if defined(OS_MACOSX)
@@ -229,7 +233,7 @@
void GpuDataManager::RequestCompleteGpuInfoIfNeeded() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (complete_gpu_info_already_requested_)
+ if (complete_gpu_info_already_requested_ || complete_gpu_info_available_)
return;
complete_gpu_info_already_requested_ = true;
@@ -240,20 +244,18 @@
}
void GpuDataManager::UpdateGpuInfo(const content::GPUInfo& gpu_info) {
+ complete_gpu_info_available_ = true;
+ complete_gpu_info_already_requested_ = true;
{
base::AutoLock auto_lock(gpu_info_lock_);
if (!Merge(&gpu_info_, gpu_info))
return;
- }
-
- NotifyGpuInfoUpdate();
-
- {
- base::AutoLock auto_lock(gpu_info_lock_);
content::GetContentClient()->SetGpuInfo(gpu_info_);
}
UpdateGpuFeatureFlags();
+ // We have to update GpuFeatureFlags before notify all the observers.
+ NotifyGpuInfoUpdate();
}
const content::GPUInfo& GpuDataManager::gpu_info() const {
« content/browser/gpu/gpu_data_manager.h ('K') | « content/browser/gpu/gpu_data_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698