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

Side by Side Diff: content/browser/gpu/gpu_data_manager_impl.cc

Issue 2666423002: Assert sequence validity on non-thread-safe RefCount manipulations (2) (Closed)
Patch Set: remove DisableSequenceConsistencyAssertions Created 3 years, 8 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 | « cc/trees/proxy_impl.cc ('k') | gpu/command_buffer/service/mailbox_manager_sync.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/browser/gpu/gpu_data_manager_impl.h" 5 #include "content/browser/gpu/gpu_data_manager_impl.h"
6 6
7 #include "content/browser/gpu/gpu_data_manager_impl_private.h" 7 #include "content/browser/gpu/gpu_data_manager_impl_private.h"
8 #include "gpu/ipc/common/memory_stats.h" 8 #include "gpu/ipc/common/memory_stats.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 // static 12 // static
13 GpuDataManager* GpuDataManager::GetInstance() { 13 GpuDataManager* GpuDataManager::GetInstance() {
14 return GpuDataManagerImpl::GetInstance(); 14 return GpuDataManagerImpl::GetInstance();
15 } 15 }
16 16
17 // static 17 // static
18 GpuDataManagerImpl* GpuDataManagerImpl::GetInstance() { 18 GpuDataManagerImpl* GpuDataManagerImpl::GetInstance() {
19 return base::Singleton<GpuDataManagerImpl>::get(); 19 return base::Singleton<GpuDataManagerImpl>::get();
20 } 20 }
21 21
22 void GpuDataManagerImpl::InitializeForTesting( 22 void GpuDataManagerImpl::InitializeForTesting(
23 const std::string& gpu_blacklist_json, const gpu::GPUInfo& gpu_info) { 23 const std::string& gpu_blacklist_json, const gpu::GPUInfo& gpu_info) {
24 base::AutoLock auto_lock(lock_); 24 base::AutoLock auto_lock(lock_);
25 // Relax the cross-thread access restriction to non-thread-safe RefCount.
26 // See the comment in Initialize().
27 base::ScopedAllowCrossThreadRefCountAccess
28 allow_cross_thread_ref_count_access;
25 private_->InitializeForTesting(gpu_blacklist_json, gpu_info); 29 private_->InitializeForTesting(gpu_blacklist_json, gpu_info);
26 } 30 }
27 31
28 bool GpuDataManagerImpl::IsFeatureBlacklisted(int feature) const { 32 bool GpuDataManagerImpl::IsFeatureBlacklisted(int feature) const {
29 base::AutoLock auto_lock(lock_); 33 base::AutoLock auto_lock(lock_);
30 return private_->IsFeatureBlacklisted(feature); 34 return private_->IsFeatureBlacklisted(feature);
31 } 35 }
32 36
33 bool GpuDataManagerImpl::IsFeatureEnabled(int feature) const { 37 bool GpuDataManagerImpl::IsFeatureEnabled(int feature) const {
34 base::AutoLock auto_lock(lock_); 38 base::AutoLock auto_lock(lock_);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 private_->GetDisabledExtensions(disabled_extensions); 143 private_->GetDisabledExtensions(disabled_extensions);
140 } 144 }
141 145
142 void GpuDataManagerImpl::SetGpuInfo(const gpu::GPUInfo& gpu_info) { 146 void GpuDataManagerImpl::SetGpuInfo(const gpu::GPUInfo& gpu_info) {
143 base::AutoLock auto_lock(lock_); 147 base::AutoLock auto_lock(lock_);
144 private_->SetGpuInfo(gpu_info); 148 private_->SetGpuInfo(gpu_info);
145 } 149 }
146 150
147 void GpuDataManagerImpl::Initialize() { 151 void GpuDataManagerImpl::Initialize() {
148 base::AutoLock auto_lock(lock_); 152 base::AutoLock auto_lock(lock_);
153 // Relax the cross-thread access restriction to non-thread-safe RefCount.
154 // GpuDataManagerImplPrivate has GpuControlLists, which touches
155 // non-thread-safe GpuControlListEntry RefCount in the lock.
156 base::ScopedAllowCrossThreadRefCountAccess
157 allow_cross_thread_ref_count_access;
149 private_->Initialize(); 158 private_->Initialize();
150 } 159 }
151 160
152 void GpuDataManagerImpl::UpdateGpuInfo(const gpu::GPUInfo& gpu_info) { 161 void GpuDataManagerImpl::UpdateGpuInfo(const gpu::GPUInfo& gpu_info) {
153 base::AutoLock auto_lock(lock_); 162 base::AutoLock auto_lock(lock_);
163 // Relax the cross-thread access restriction to non-thread-safe RefCount.
164 // See the comment in Initialize().
165 base::ScopedAllowCrossThreadRefCountAccess
166 allow_cross_thread_ref_count_access;
154 private_->UpdateGpuInfo(gpu_info); 167 private_->UpdateGpuInfo(gpu_info);
155 } 168 }
156 169
157 void GpuDataManagerImpl::UpdateGpuFeatureInfo( 170 void GpuDataManagerImpl::UpdateGpuFeatureInfo(
158 const gpu::GpuFeatureInfo& gpu_feature_info) { 171 const gpu::GpuFeatureInfo& gpu_feature_info) {
159 base::AutoLock auto_lock(lock_); 172 base::AutoLock auto_lock(lock_);
160 private_->UpdateGpuFeatureInfo(gpu_feature_info); 173 private_->UpdateGpuFeatureInfo(gpu_feature_info);
161 } 174 }
162 175
163 void GpuDataManagerImpl::UpdateVideoMemoryUsageStats( 176 void GpuDataManagerImpl::UpdateVideoMemoryUsageStats(
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 } 262 }
250 263
251 size_t GpuDataManagerImpl::GetBlacklistedFeatureCount() const { 264 size_t GpuDataManagerImpl::GetBlacklistedFeatureCount() const {
252 base::AutoLock auto_lock(lock_); 265 base::AutoLock auto_lock(lock_);
253 return private_->GetBlacklistedFeatureCount(); 266 return private_->GetBlacklistedFeatureCount();
254 } 267 }
255 268
256 bool GpuDataManagerImpl::UpdateActiveGpu(uint32_t vendor_id, 269 bool GpuDataManagerImpl::UpdateActiveGpu(uint32_t vendor_id,
257 uint32_t device_id) { 270 uint32_t device_id) {
258 base::AutoLock auto_lock(lock_); 271 base::AutoLock auto_lock(lock_);
272 // Relax the cross-thread access restriction to non-thread-safe RefCount.
273 // See the comment in Initialize().
274 base::ScopedAllowCrossThreadRefCountAccess
275 allow_cross_thread_ref_count_access;
259 return private_->UpdateActiveGpu(vendor_id, device_id); 276 return private_->UpdateActiveGpu(vendor_id, device_id);
260 } 277 }
261 278
262 void GpuDataManagerImpl::Notify3DAPIBlocked(const GURL& top_origin_url, 279 void GpuDataManagerImpl::Notify3DAPIBlocked(const GURL& top_origin_url,
263 int render_process_id, 280 int render_process_id,
264 int render_frame_id, 281 int render_frame_id,
265 ThreeDAPIType requester) { 282 ThreeDAPIType requester) {
266 base::AutoLock auto_lock(lock_); 283 base::AutoLock auto_lock(lock_);
267 private_->Notify3DAPIBlocked( 284 private_->Notify3DAPIBlocked(
268 top_origin_url, render_process_id, render_frame_id, requester); 285 top_origin_url, render_process_id, render_frame_id, requester);
269 } 286 }
270 287
271 void GpuDataManagerImpl::OnGpuProcessInitFailure() { 288 void GpuDataManagerImpl::OnGpuProcessInitFailure() {
272 base::AutoLock auto_lock(lock_); 289 base::AutoLock auto_lock(lock_);
273 private_->OnGpuProcessInitFailure(); 290 private_->OnGpuProcessInitFailure();
274 } 291 }
275 292
276 GpuDataManagerImpl::GpuDataManagerImpl() 293 GpuDataManagerImpl::GpuDataManagerImpl()
277 : private_(GpuDataManagerImplPrivate::Create(this)) { 294 : private_(GpuDataManagerImplPrivate::Create(this)) {
278 } 295 }
279 296
280 GpuDataManagerImpl::~GpuDataManagerImpl() { 297 GpuDataManagerImpl::~GpuDataManagerImpl() {
281 } 298 }
282 299
283 } // namespace content 300 } // namespace content
OLDNEW
« no previous file with comments | « cc/trees/proxy_impl.cc ('k') | gpu/command_buffer/service/mailbox_manager_sync.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698