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

Side by Side Diff: cc/layers/texture_layer.cc

Issue 51653008: Remove WGC3D::isContextLost references from cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 1 month 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 | « no previous file | cc/layers/texture_layer_client.h » ('j') | cc/output/gl_renderer.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 vertex_opacity_[1] = 1.0f; 43 vertex_opacity_[1] = 1.0f;
44 vertex_opacity_[2] = 1.0f; 44 vertex_opacity_[2] = 1.0f;
45 vertex_opacity_[3] = 1.0f; 45 vertex_opacity_[3] = 1.0f;
46 } 46 }
47 47
48 TextureLayer::~TextureLayer() { 48 TextureLayer::~TextureLayer() {
49 } 49 }
50 50
51 void TextureLayer::ClearClient() { 51 void TextureLayer::ClearClient() {
52 if (rate_limit_context_ && client_ && layer_tree_host()) 52 if (rate_limit_context_ && client_ && layer_tree_host())
53 layer_tree_host()->StopRateLimiter(client_->Context3d()); 53 layer_tree_host()->StopRateLimiter(client_);
54 client_ = NULL; 54 client_ = NULL;
55 if (uses_mailbox_) 55 if (uses_mailbox_)
56 SetTextureMailbox(TextureMailbox(), scoped_ptr<SingleReleaseCallback>()); 56 SetTextureMailbox(TextureMailbox(), scoped_ptr<SingleReleaseCallback>());
57 else 57 else
58 SetTextureId(0); 58 SetTextureId(0);
59 } 59 }
60 60
61 scoped_ptr<LayerImpl> TextureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { 61 scoped_ptr<LayerImpl> TextureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) {
62 return TextureLayerImpl::Create(tree_impl, id(), uses_mailbox_). 62 return TextureLayerImpl::Create(tree_impl, id(), uses_mailbox_).
63 PassAs<LayerImpl>(); 63 PassAs<LayerImpl>();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 void TextureLayer::SetBlendBackgroundColor(bool blend) { 108 void TextureLayer::SetBlendBackgroundColor(bool blend) {
109 if (blend_background_color_ == blend) 109 if (blend_background_color_ == blend)
110 return; 110 return;
111 blend_background_color_ = blend; 111 blend_background_color_ = blend;
112 SetNeedsCommit(); 112 SetNeedsCommit();
113 } 113 }
114 114
115 void TextureLayer::SetRateLimitContext(bool rate_limit) { 115 void TextureLayer::SetRateLimitContext(bool rate_limit) {
116 if (!rate_limit && rate_limit_context_ && client_ && layer_tree_host()) 116 if (!rate_limit && rate_limit_context_ && client_ && layer_tree_host())
117 layer_tree_host()->StopRateLimiter(client_->Context3d()); 117 layer_tree_host()->StopRateLimiter(client_);
118 118
119 rate_limit_context_ = rate_limit; 119 rate_limit_context_ = rate_limit;
120 } 120 }
121 121
122 void TextureLayer::SetTextureId(unsigned id) { 122 void TextureLayer::SetTextureId(unsigned id) {
123 DCHECK(!uses_mailbox_); 123 DCHECK(!uses_mailbox_);
124 if (texture_id_ == id) 124 if (texture_id_ == id)
125 return; 125 return;
126 if (texture_id_ && layer_tree_host()) 126 if (texture_id_ && layer_tree_host())
127 layer_tree_host()->AcquireLayerTextures(); 127 layer_tree_host()->AcquireLayerTextures();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 if (layer_tree_host() && (DrawsContent() || content_committed_)) { 171 if (layer_tree_host() && (DrawsContent() || content_committed_)) {
172 layer_tree_host()->AcquireLayerTextures(); 172 layer_tree_host()->AcquireLayerTextures();
173 content_committed_ = false; 173 content_committed_ = false;
174 } 174 }
175 } 175 }
176 176
177 void TextureLayer::SetNeedsDisplayRect(const gfx::RectF& dirty_rect) { 177 void TextureLayer::SetNeedsDisplayRect(const gfx::RectF& dirty_rect) {
178 Layer::SetNeedsDisplayRect(dirty_rect); 178 Layer::SetNeedsDisplayRect(dirty_rect);
179 179
180 if (rate_limit_context_ && client_ && layer_tree_host() && DrawsContent()) 180 if (rate_limit_context_ && client_ && layer_tree_host() && DrawsContent())
181 layer_tree_host()->StartRateLimiter(client_->Context3d()); 181 layer_tree_host()->StartRateLimiter(client_);
182 } 182 }
183 183
184 void TextureLayer::SetLayerTreeHost(LayerTreeHost* host) { 184 void TextureLayer::SetLayerTreeHost(LayerTreeHost* host) {
185 if (layer_tree_host() == host) { 185 if (layer_tree_host() == host) {
186 Layer::SetLayerTreeHost(host); 186 Layer::SetLayerTreeHost(host);
187 return; 187 return;
188 } 188 }
189 189
190 if (layer_tree_host()) { 190 if (layer_tree_host()) {
191 if (texture_id_) { 191 if (texture_id_) {
192 layer_tree_host()->AcquireLayerTextures(); 192 layer_tree_host()->AcquireLayerTextures();
193 // The texture id needs to be removed from the active tree before the 193 // The texture id needs to be removed from the active tree before the
194 // commit is called complete. 194 // commit is called complete.
195 SetNextCommitWaitsForActivation(); 195 SetNextCommitWaitsForActivation();
196 } 196 }
197 if (rate_limit_context_ && client_) 197 if (rate_limit_context_ && client_)
198 layer_tree_host()->StopRateLimiter(client_->Context3d()); 198 layer_tree_host()->StopRateLimiter(client_);
199 } 199 }
200 // If we're removed from the tree, the TextureLayerImpl will be destroyed, and 200 // If we're removed from the tree, the TextureLayerImpl will be destroyed, and
201 // we will need to set the mailbox again on a new TextureLayerImpl the next 201 // we will need to set the mailbox again on a new TextureLayerImpl the next
202 // time we push. 202 // time we push.
203 if (!host && uses_mailbox_ && holder_ref_) { 203 if (!host && uses_mailbox_ && holder_ref_) {
204 needs_set_mailbox_ = true; 204 needs_set_mailbox_ = true;
205 // The active frame needs to be replaced and the mailbox returned before the 205 // The active frame needs to be replaced and the mailbox returned before the
206 // commit is called complete. 206 // commit is called complete.
207 SetNextCommitWaitsForActivation(); 207 SetNextCommitWaitsForActivation();
208 } 208 }
(...skipping 17 matching lines...) Expand all
226 layer_tree_host()->UsingSharedMemoryResources())) { 226 layer_tree_host()->UsingSharedMemoryResources())) {
227 // Already within a commit, no need to do another one immediately. 227 // Already within a commit, no need to do another one immediately.
228 SetTextureMailboxInternal( 228 SetTextureMailboxInternal(
229 mailbox, 229 mailbox,
230 release_callback.Pass(), 230 release_callback.Pass(),
231 false /* requires_commit */); 231 false /* requires_commit */);
232 updated = true; 232 updated = true;
233 } 233 }
234 } else { 234 } else {
235 texture_id_ = client_->PrepareTexture(); 235 texture_id_ = client_->PrepareTexture();
236 DCHECK_EQ(!!texture_id_, !!client_->Context3d()); 236 DCHECK_EQ(!!texture_id_, !client_->IsContextLost());
piman 2013/11/01 23:15:35 I don't think this DCHECK is valid. For example, t
237 if (client_->Context3d() && 237 if (client_->IsContextLost())
238 client_->Context3d()->getGraphicsResetStatusARB() != GL_NO_ERROR)
239 texture_id_ = 0; 238 texture_id_ = 0;
240 updated = true; 239 updated = true;
241 SetNeedsPushProperties(); 240 SetNeedsPushProperties();
242 // The texture id needs to be removed from the active tree before the 241 // The texture id needs to be removed from the active tree before the
243 // commit is called complete. 242 // commit is called complete.
244 SetNextCommitWaitsForActivation(); 243 SetNextCommitWaitsForActivation();
245 } 244 }
246 } 245 }
247 246
248 // SetTextureMailbox could be called externally and the same mailbox used for 247 // SetTextureMailbox could be called externally and the same mailbox used for
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 } 349 }
351 350
352 void TextureLayer::MailboxHolder::ReturnAndReleaseOnImplThread( 351 void TextureLayer::MailboxHolder::ReturnAndReleaseOnImplThread(
353 unsigned sync_point, bool is_lost) { 352 unsigned sync_point, bool is_lost) {
354 Return(sync_point, is_lost); 353 Return(sync_point, is_lost);
355 message_loop_->PostTask(FROM_HERE, 354 message_loop_->PostTask(FROM_HERE,
356 base::Bind(&MailboxHolder::InternalRelease, this)); 355 base::Bind(&MailboxHolder::InternalRelease, this));
357 } 356 }
358 357
359 } // namespace cc 358 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/texture_layer_client.h » ('j') | cc/output/gl_renderer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698