OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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/layers/texture_layer.h" | 5 #include "cc/layers/texture_layer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 } | 38 } |
39 | 39 |
40 TextureLayer::~TextureLayer() { | 40 TextureLayer::~TextureLayer() { |
41 } | 41 } |
42 | 42 |
43 void TextureLayer::ClearClient() { | 43 void TextureLayer::ClearClient() { |
44 if (rate_limit_context_ && client_ && layer_tree_host()) | 44 if (rate_limit_context_ && client_ && layer_tree_host()) |
45 layer_tree_host()->StopRateLimiter(); | 45 layer_tree_host()->StopRateLimiter(); |
46 client_ = NULL; | 46 client_ = NULL; |
47 ClearTexture(); | 47 ClearTexture(); |
| 48 UpdateDrawsContent(HasDrawableContent()); |
48 } | 49 } |
49 | 50 |
50 void TextureLayer::ClearTexture() { | 51 void TextureLayer::ClearTexture() { |
51 SetTextureMailbox(TextureMailbox(), scoped_ptr<SingleReleaseCallback>()); | 52 SetTextureMailbox(TextureMailbox(), scoped_ptr<SingleReleaseCallback>()); |
52 } | 53 } |
53 | 54 |
54 scoped_ptr<LayerImpl> TextureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { | 55 scoped_ptr<LayerImpl> TextureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { |
55 return TextureLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); | 56 return TextureLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); |
56 } | 57 } |
57 | 58 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } else { | 130 } else { |
130 holder_ref_.reset(); | 131 holder_ref_.reset(); |
131 } | 132 } |
132 needs_set_mailbox_ = true; | 133 needs_set_mailbox_ = true; |
133 // If we are within a commit, no need to do it again immediately after. | 134 // If we are within a commit, no need to do it again immediately after. |
134 if (requires_commit) | 135 if (requires_commit) |
135 SetNeedsCommit(); | 136 SetNeedsCommit(); |
136 else | 137 else |
137 SetNeedsPushProperties(); | 138 SetNeedsPushProperties(); |
138 | 139 |
| 140 UpdateDrawsContent(HasDrawableContent()); |
139 // The active frame needs to be replaced and the mailbox returned before the | 141 // The active frame needs to be replaced and the mailbox returned before the |
140 // commit is called complete. | 142 // commit is called complete. |
141 SetNextCommitWaitsForActivation(); | 143 SetNextCommitWaitsForActivation(); |
142 } | 144 } |
143 | 145 |
144 void TextureLayer::SetTextureMailbox( | 146 void TextureLayer::SetTextureMailbox( |
145 const TextureMailbox& mailbox, | 147 const TextureMailbox& mailbox, |
146 scoped_ptr<SingleReleaseCallback> release_callback) { | 148 scoped_ptr<SingleReleaseCallback> release_callback) { |
147 bool requires_commit = true; | 149 bool requires_commit = true; |
148 bool allow_mailbox_reuse = false; | 150 bool allow_mailbox_reuse = false; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // time we push. | 193 // time we push. |
192 if (!host && holder_ref_) { | 194 if (!host && holder_ref_) { |
193 needs_set_mailbox_ = true; | 195 needs_set_mailbox_ = true; |
194 // The active frame needs to be replaced and the mailbox returned before the | 196 // The active frame needs to be replaced and the mailbox returned before the |
195 // commit is called complete. | 197 // commit is called complete. |
196 SetNextCommitWaitsForActivation(); | 198 SetNextCommitWaitsForActivation(); |
197 } | 199 } |
198 Layer::SetLayerTreeHost(host); | 200 Layer::SetLayerTreeHost(host); |
199 } | 201 } |
200 | 202 |
201 bool TextureLayer::DrawsContent() const { | 203 bool TextureLayer::HasDrawableContent() const { |
202 return (client_ || holder_ref_) && Layer::DrawsContent(); | 204 return (client_ || holder_ref_) && Layer::HasDrawableContent(); |
203 } | 205 } |
204 | 206 |
205 bool TextureLayer::Update(ResourceUpdateQueue* queue, | 207 bool TextureLayer::Update(ResourceUpdateQueue* queue, |
206 const OcclusionTracker<Layer>* occlusion) { | 208 const OcclusionTracker<Layer>* occlusion) { |
207 bool updated = Layer::Update(queue, occlusion); | 209 bool updated = Layer::Update(queue, occlusion); |
208 if (client_) { | 210 if (client_) { |
209 TextureMailbox mailbox; | 211 TextureMailbox mailbox; |
210 scoped_ptr<SingleReleaseCallback> release_callback; | 212 scoped_ptr<SingleReleaseCallback> release_callback; |
211 if (client_->PrepareTextureMailbox( | 213 if (client_->PrepareTextureMailbox( |
212 &mailbox, | 214 &mailbox, |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 | 329 |
328 void TextureLayer::TextureMailboxHolder::ReturnAndReleaseOnImplThread( | 330 void TextureLayer::TextureMailboxHolder::ReturnAndReleaseOnImplThread( |
329 uint32 sync_point, | 331 uint32 sync_point, |
330 bool is_lost) { | 332 bool is_lost) { |
331 Return(sync_point, is_lost); | 333 Return(sync_point, is_lost); |
332 message_loop_->PostTask( | 334 message_loop_->PostTask( |
333 FROM_HERE, base::Bind(&TextureMailboxHolder::InternalRelease, this)); | 335 FROM_HERE, base::Bind(&TextureMailboxHolder::InternalRelease, this)); |
334 } | 336 } |
335 | 337 |
336 } // namespace cc | 338 } // namespace cc |
OLD | NEW |