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

Side by Side Diff: cc/resources/scoped_resource.cc

Issue 1415583004: cc: Remove references to managed resources (and cleanup) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: protected -> private Created 5 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
« no previous file with comments | « cc/resources/scoped_resource.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/resources/scoped_resource.h" 5 #include "cc/resources/scoped_resource.h"
6 6
7 namespace cc { 7 namespace cc {
8 8
9 ScopedResource::ScopedResource(ResourceProvider* resource_provider) 9 ScopedResource::ScopedResource(ResourceProvider* resource_provider)
10 : resource_provider_(resource_provider) { 10 : resource_provider_(resource_provider) {
(...skipping 11 matching lines...) Expand all
22 DCHECK(!size.IsEmpty()); 22 DCHECK(!size.IsEmpty());
23 23
24 set_dimensions(size, format); 24 set_dimensions(size, format);
25 set_id(resource_provider_->CreateResource(size, hint, format)); 25 set_id(resource_provider_->CreateResource(size, hint, format));
26 26
27 #if DCHECK_IS_ON() 27 #if DCHECK_IS_ON()
28 allocate_thread_id_ = base::PlatformThread::CurrentId(); 28 allocate_thread_id_ = base::PlatformThread::CurrentId();
29 #endif 29 #endif
30 } 30 }
31 31
32 void ScopedResource::AllocateManaged(const gfx::Size& size, 32 void ScopedResource::AllocateWithTextureTarget(const gfx::Size& size,
33 GLenum target, 33 GLenum target,
34 ResourceFormat format) { 34 ResourceFormat format) {
35 DCHECK(!id()); 35 DCHECK(!id());
36 DCHECK(!size.IsEmpty()); 36 DCHECK(!size.IsEmpty());
37 37
38 set_dimensions(size, format); 38 set_dimensions(size, format);
39 set_id(resource_provider_->CreateManagedResource( 39 set_id(resource_provider_->CreateResourceWithTextureTarget(
40 size, target, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format)); 40 size, target, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format));
41 41
42 #if DCHECK_IS_ON() 42 #if DCHECK_IS_ON()
43 allocate_thread_id_ = base::PlatformThread::CurrentId(); 43 allocate_thread_id_ = base::PlatformThread::CurrentId();
44 #endif 44 #endif
45 } 45 }
46 46
47 void ScopedResource::Free() { 47 void ScopedResource::Free() {
48 if (id()) { 48 if (id()) {
49 #if DCHECK_IS_ON() 49 #if DCHECK_IS_ON()
50 DCHECK(allocate_thread_id_ == base::PlatformThread::CurrentId()); 50 DCHECK(allocate_thread_id_ == base::PlatformThread::CurrentId());
51 #endif 51 #endif
52 resource_provider_->DeleteResource(id()); 52 resource_provider_->DeleteResource(id());
53 } 53 }
54 set_id(0); 54 set_id(0);
55 } 55 }
56 56
57 } // namespace cc 57 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/scoped_resource.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698