Chromium Code Reviews| 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 19 matching lines...) Expand all Loading... | |
| 30 client_(client), | 30 client_(client), |
| 31 uses_mailbox_(uses_mailbox), | 31 uses_mailbox_(uses_mailbox), |
| 32 flipped_(true), | 32 flipped_(true), |
| 33 uv_top_left_(0.f, 0.f), | 33 uv_top_left_(0.f, 0.f), |
| 34 uv_bottom_right_(1.f, 1.f), | 34 uv_bottom_right_(1.f, 1.f), |
| 35 premultiplied_alpha_(true), | 35 premultiplied_alpha_(true), |
| 36 blend_background_color_(false), | 36 blend_background_color_(false), |
| 37 rate_limit_context_(false), | 37 rate_limit_context_(false), |
| 38 content_committed_(false), | 38 content_committed_(false), |
| 39 texture_id_(0), | 39 texture_id_(0), |
| 40 needs_set_mailbox_(false) { | 40 needs_set_mailbox_(false), |
| 41 did_use_shared_memory_resources_(false) { | |
| 41 vertex_opacity_[0] = 1.0f; | 42 vertex_opacity_[0] = 1.0f; |
| 42 vertex_opacity_[1] = 1.0f; | 43 vertex_opacity_[1] = 1.0f; |
| 43 vertex_opacity_[2] = 1.0f; | 44 vertex_opacity_[2] = 1.0f; |
| 44 vertex_opacity_[3] = 1.0f; | 45 vertex_opacity_[3] = 1.0f; |
| 45 } | 46 } |
| 46 | 47 |
| 47 TextureLayer::~TextureLayer() { | 48 TextureLayer::~TextureLayer() { |
| 48 } | 49 } |
| 49 | 50 |
| 50 void TextureLayer::ClearClient() { | 51 void TextureLayer::ClearClient() { |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 | 215 |
| 215 bool TextureLayer::DrawsContent() const { | 216 bool TextureLayer::DrawsContent() const { |
| 216 return (client_ || texture_id_ || holder_ref_) && Layer::DrawsContent(); | 217 return (client_ || texture_id_ || holder_ref_) && Layer::DrawsContent(); |
| 217 } | 218 } |
| 218 | 219 |
| 219 bool TextureLayer::Update(ResourceUpdateQueue* queue, | 220 bool TextureLayer::Update(ResourceUpdateQueue* queue, |
| 220 const OcclusionTracker* occlusion) { | 221 const OcclusionTracker* occlusion) { |
| 221 bool updated = Layer::Update(queue, occlusion); | 222 bool updated = Layer::Update(queue, occlusion); |
| 222 if (client_) { | 223 if (client_) { |
| 223 if (uses_mailbox_) { | 224 if (uses_mailbox_) { |
| 225 bool use_shared_memory_resources = | |
| 226 layer_tree_host()->UsingSharedMemoryResources(); | |
| 227 if (did_use_shared_memory_resources_ != use_shared_memory_resources) { | |
| 228 holder_ref_.reset(); | |
|
danakj
2014/02/14 19:38:50
Now that we're here, I wonder.. the call to Prepar
boliu
2014/02/14 22:03:08
Good point...removed all this code and just make t
| |
| 229 } | |
| 230 did_use_shared_memory_resources_ = use_shared_memory_resources; | |
| 231 | |
| 224 TextureMailbox mailbox; | 232 TextureMailbox mailbox; |
| 225 scoped_ptr<SingleReleaseCallback> release_callback; | 233 scoped_ptr<SingleReleaseCallback> release_callback; |
| 226 if (client_->PrepareTextureMailbox( | 234 if (client_->PrepareTextureMailbox( |
| 227 &mailbox, | 235 &mailbox, |
| 228 &release_callback, | 236 &release_callback, |
| 229 layer_tree_host()->UsingSharedMemoryResources())) { | 237 layer_tree_host()->UsingSharedMemoryResources())) { |
| 230 // Already within a commit, no need to do another one immediately. | 238 // Already within a commit, no need to do another one immediately. |
| 231 SetTextureMailboxInternal( | 239 SetTextureMailboxInternal( |
| 232 mailbox, | 240 mailbox, |
| 233 release_callback.Pass(), | 241 release_callback.Pass(), |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 | 359 |
| 352 void TextureLayer::TextureMailboxHolder::ReturnAndReleaseOnImplThread( | 360 void TextureLayer::TextureMailboxHolder::ReturnAndReleaseOnImplThread( |
| 353 uint32 sync_point, | 361 uint32 sync_point, |
| 354 bool is_lost) { | 362 bool is_lost) { |
| 355 Return(sync_point, is_lost); | 363 Return(sync_point, is_lost); |
| 356 message_loop_->PostTask( | 364 message_loop_->PostTask( |
| 357 FROM_HERE, base::Bind(&TextureMailboxHolder::InternalRelease, this)); | 365 FROM_HERE, base::Bind(&TextureMailboxHolder::InternalRelease, this)); |
| 358 } | 366 } |
| 359 | 367 |
| 360 } // namespace cc | 368 } // namespace cc |
| OLD | NEW |