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

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

Issue 638353002: [C++11 Allowed Features] Declares a type-safe null pointer converting from NULL to nullptr in src/… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formating. Created 6 years, 2 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
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/prioritized_resource.h" 5 #include "cc/resources/prioritized_resource.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "cc/resources/platform_color.h" 9 #include "cc/resources/platform_color.h"
10 #include "cc/resources/prioritized_resource_manager.h" 10 #include "cc/resources/prioritized_resource_manager.h"
11 #include "cc/resources/priority_calculator.h" 11 #include "cc/resources/priority_calculator.h"
12 #include "cc/trees/proxy.h" 12 #include "cc/trees/proxy.h"
13 13
14 namespace cc { 14 namespace cc {
15 15
16 PrioritizedResource::PrioritizedResource(PrioritizedResourceManager* manager, 16 PrioritizedResource::PrioritizedResource(PrioritizedResourceManager* manager,
17 const gfx::Size& size, 17 const gfx::Size& size,
18 ResourceFormat format) 18 ResourceFormat format)
19 : size_(size), 19 : size_(size),
20 format_(format), 20 format_(format),
21 bytes_(0), 21 bytes_(0),
22 contents_swizzled_(false), 22 contents_swizzled_(false),
23 priority_(PriorityCalculator::LowestPriority()), 23 priority_(PriorityCalculator::LowestPriority()),
24 is_above_priority_cutoff_(false), 24 is_above_priority_cutoff_(false),
25 is_self_managed_(false), 25 is_self_managed_(false),
26 backing_(NULL), 26 backing_(nullptr),
27 manager_(NULL) { 27 manager_(nullptr) {
28 bytes_ = Resource::MemorySizeBytes(size, format); 28 bytes_ = Resource::MemorySizeBytes(size, format);
29 if (manager) 29 if (manager)
30 manager->RegisterTexture(this); 30 manager->RegisterTexture(this);
31 } 31 }
32 32
33 PrioritizedResource::~PrioritizedResource() { 33 PrioritizedResource::~PrioritizedResource() {
34 if (manager_) 34 if (manager_)
35 manager_->UnregisterTexture(this); 35 manager_->UnregisterTexture(this);
36 } 36 }
37 37
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 DCHECK(!backing_); 99 DCHECK(!backing_);
100 100
101 backing_ = backing; 101 backing_ = backing;
102 backing_->owner_ = this; 102 backing_->owner_ = this;
103 } 103 }
104 104
105 void PrioritizedResource::Unlink() { 105 void PrioritizedResource::Unlink() {
106 DCHECK(backing_); 106 DCHECK(backing_);
107 DCHECK(backing_->owner_ == this); 107 DCHECK(backing_->owner_ == this);
108 108
109 backing_->owner_ = NULL; 109 backing_->owner_ = nullptr;
110 backing_ = NULL; 110 backing_ = nullptr;
111 } 111 }
112 112
113 void PrioritizedResource::SetToSelfManagedMemoryPlaceholder(size_t bytes) { 113 void PrioritizedResource::SetToSelfManagedMemoryPlaceholder(size_t bytes) {
114 SetDimensions(gfx::Size(), RGBA_8888); 114 SetDimensions(gfx::Size(), RGBA_8888);
115 set_is_self_managed(true); 115 set_is_self_managed(true);
116 bytes_ = bytes; 116 bytes_ = bytes;
117 } 117 }
118 118
119 PrioritizedResource::Backing::Backing(unsigned id, 119 PrioritizedResource::Backing::Backing(unsigned id,
120 ResourceProvider* resource_provider, 120 ResourceProvider* resource_provider,
121 const gfx::Size& size, 121 const gfx::Size& size,
122 ResourceFormat format) 122 ResourceFormat format)
123 : Resource(id, size, format), 123 : Resource(id, size, format),
124 owner_(NULL), 124 owner_(nullptr),
125 priority_at_last_priority_update_(PriorityCalculator::LowestPriority()), 125 priority_at_last_priority_update_(PriorityCalculator::LowestPriority()),
126 was_above_priority_cutoff_at_last_priority_update_(false), 126 was_above_priority_cutoff_at_last_priority_update_(false),
127 in_drawing_impl_tree_(false), 127 in_drawing_impl_tree_(false),
128 in_parent_compositor_(false), 128 in_parent_compositor_(false),
129 #if !DCHECK_IS_ON 129 #if !DCHECK_IS_ON
130 resource_has_been_deleted_(false) { 130 resource_has_been_deleted_(false) {
131 #else 131 #else
132 resource_has_been_deleted_(false), 132 resource_has_been_deleted_(false),
133 resource_provider_(resource_provider) { 133 resource_provider_(resource_provider) {
134 #endif 134 #endif
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 } 189 }
190 190
191 void PrioritizedResource::ReturnBackingTexture() { 191 void PrioritizedResource::ReturnBackingTexture() {
192 DCHECK(manager_ || !backing_); 192 DCHECK(manager_ || !backing_);
193 if (manager_) 193 if (manager_)
194 manager_->ReturnBackingTexture(this); 194 manager_->ReturnBackingTexture(this);
195 } 195 }
196 196
197 const Proxy* PrioritizedResource::Backing::proxy() const { 197 const Proxy* PrioritizedResource::Backing::proxy() const {
198 if (!owner_ || !owner_->resource_manager()) 198 if (!owner_ || !owner_->resource_manager())
199 return NULL; 199 return nullptr;
200 return owner_->resource_manager()->ProxyForDebug(); 200 return owner_->resource_manager()->ProxyForDebug();
201 } 201 }
202 202
203 } // namespace cc 203 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698