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

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

Issue 952893003: Update from https://crrev.com/317530 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix gn for nacl Created 5 years, 10 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/resources/resource_provider_unittest.cc ('k') | cc/resources/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/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 20 matching lines...) Expand all
31 } 31 }
32 32
33 void ScopedResource::AllocateManaged(const gfx::Size& size, 33 void ScopedResource::AllocateManaged(const gfx::Size& size,
34 GLenum target, 34 GLenum target,
35 ResourceFormat format) { 35 ResourceFormat format) {
36 DCHECK(!id()); 36 DCHECK(!id());
37 DCHECK(!size.IsEmpty()); 37 DCHECK(!size.IsEmpty());
38 38
39 set_dimensions(size, format); 39 set_dimensions(size, format);
40 set_id(resource_provider_->CreateManagedResource( 40 set_id(resource_provider_->CreateManagedResource(
41 size, 41 size, target, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE,
42 target,
43 GL_CLAMP_TO_EDGE,
44 ResourceProvider::TextureHintImmutable,
45 format)); 42 format));
46 43
47 #if DCHECK_IS_ON() 44 #if DCHECK_IS_ON()
48 allocate_thread_id_ = base::PlatformThread::CurrentId(); 45 allocate_thread_id_ = base::PlatformThread::CurrentId();
49 #endif 46 #endif
50 } 47 }
51 48
52 void ScopedResource::Free() { 49 void ScopedResource::Free() {
53 if (id()) { 50 if (id()) {
54 #if DCHECK_IS_ON() 51 #if DCHECK_IS_ON()
55 DCHECK(allocate_thread_id_ == base::PlatformThread::CurrentId()); 52 DCHECK(allocate_thread_id_ == base::PlatformThread::CurrentId());
56 #endif 53 #endif
57 resource_provider_->DeleteResource(id()); 54 resource_provider_->DeleteResource(id());
58 } 55 }
59 set_id(0); 56 set_id(0);
60 } 57 }
61 58
62 } // namespace cc 59 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider_unittest.cc ('k') | cc/resources/scoped_resource_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698