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

Side by Side Diff: cc/scoped_resource.cc

Issue 11578019: Remove the pools from the ResourceProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-resolve against HEAD Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/scoped_resource.h ('k') | cc/scoped_resource_unittest.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 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/scoped_resource.h" 5 #include "cc/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) {
11 DCHECK(resource_provider_); 11 DCHECK(resource_provider_);
12 } 12 }
13 13
14 ScopedResource::~ScopedResource() { 14 ScopedResource::~ScopedResource() {
15 Free(); 15 Free();
16 } 16 }
17 17
18 bool ScopedResource::Allocate(int pool, const gfx::Size& size, GLenum format, 18 bool ScopedResource::Allocate(const gfx::Size& size, GLenum format,
19 ResourceProvider::TextureUsageHint hint) { 19 ResourceProvider::TextureUsageHint hint) {
20 DCHECK(!id()); 20 DCHECK(!id());
21 DCHECK(!size.IsEmpty()); 21 DCHECK(!size.IsEmpty());
22 22
23 set_dimensions(size, format); 23 set_dimensions(size, format);
24 set_id(resource_provider_->createResource(pool, size, format, hint)); 24 set_id(resource_provider_->createResource(size, format, hint));
25 25
26 #ifndef NDEBUG 26 #ifndef NDEBUG
27 allocate_thread_id_ = base::PlatformThread::CurrentId(); 27 allocate_thread_id_ = base::PlatformThread::CurrentId();
28 #endif 28 #endif
29 29
30 return id(); 30 return id();
31 } 31 }
32 32
33 void ScopedResource::Free() { 33 void ScopedResource::Free() {
34 if (id()) { 34 if (id()) {
35 #ifndef NDEBUG 35 #ifndef NDEBUG
36 DCHECK(allocate_thread_id_ == base::PlatformThread::CurrentId()); 36 DCHECK(allocate_thread_id_ == base::PlatformThread::CurrentId());
37 #endif 37 #endif
38 resource_provider_->deleteResource(id()); 38 resource_provider_->deleteResource(id());
39 } 39 }
40 set_id(0); 40 set_id(0);
41 } 41 }
42 42
43 void ScopedResource::Leak() { 43 void ScopedResource::Leak() {
44 set_id(0); 44 set_id(0);
45 } 45 }
46 46
47 } // namespace cc 47 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scoped_resource.h ('k') | cc/scoped_resource_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698