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

Side by Side Diff: ui/compositor/layer.cc

Issue 10827435: aura: Fix layer type change logic. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "ui/compositor/layer.h" 5 #include "ui/compositor/layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 } 402 }
403 403
404 void Layer::SetExternalTexture(Texture* texture) { 404 void Layer::SetExternalTexture(Texture* texture) {
405 DCHECK_EQ(type_, LAYER_TEXTURED); 405 DCHECK_EQ(type_, LAYER_TEXTURED);
406 layer_updated_externally_ = !!texture; 406 layer_updated_externally_ = !!texture;
407 texture_ = texture; 407 texture_ = texture;
408 if (web_layer_is_accelerated_ != layer_updated_externally_) { 408 if (web_layer_is_accelerated_ != layer_updated_externally_) {
409 // Switch to a different type of layer. 409 // Switch to a different type of layer.
410 #if defined(WEBLAYER_IS_PURE_VIRTUAL) 410 #if defined(WEBLAYER_IS_PURE_VIRTUAL)
411 web_layer_->removeAllChildren(); 411 web_layer_->removeAllChildren();
412 content_layer_.reset(); 412 scoped_ptr<WebKit::WebContentLayer> old_content_layer(
413 solid_color_layer_.reset(); 413 content_layer_.release());
414 scoped_ptr<WebKit::WebSolidColorLayer> old_solid_layer(
415 solid_color_layer_.release());
416 scoped_ptr<WebKit::WebExternalTextureLayer> old_texture_layer(
417 texture_layer_.release());
414 WebKit::WebLayer* new_layer = NULL; 418 WebKit::WebLayer* new_layer = NULL;
415 #else 419 #else
416 web_layer_.removeAllChildren(); 420 web_layer_.removeAllChildren();
417 WebKit::WebLayer new_layer; 421 WebKit::WebLayer new_layer;
418 #endif 422 #endif
419 if (layer_updated_externally_) { 423 if (layer_updated_externally_) {
420 #if defined(WEBLAYER_IS_PURE_VIRTUAL) 424 #if defined(WEBLAYER_IS_PURE_VIRTUAL)
421 texture_layer_.reset(WebKit::WebExternalTextureLayer::create()); 425 texture_layer_.reset(WebKit::WebExternalTextureLayer::create());
422 texture_layer_->setFlipped(texture_->flipped()); 426 texture_layer_->setFlipped(texture_->flipped());
423 new_layer = texture_layer_->layer(); 427 new_layer = texture_layer_->layer();
424 #else 428 #else
425 WebKit::WebExternalTextureLayer texture_layer = 429 WebKit::WebExternalTextureLayer texture_layer =
426 WebKit::WebExternalTextureLayer::create(); 430 WebKit::WebExternalTextureLayer::create();
427 texture_layer.setFlipped(texture_->flipped()); 431 texture_layer.setFlipped(texture_->flipped());
428 new_layer = texture_layer; 432 new_layer = texture_layer;
429 #endif 433 #endif
430 } else { 434 } else {
431 #if defined(WEBLAYER_IS_PURE_VIRTUAL) 435 #if defined(WEBLAYER_IS_PURE_VIRTUAL)
432 texture_layer_.reset();
433 solid_color_layer_.reset();
434 content_layer_.reset(WebKit::WebContentLayer::create(this)); 436 content_layer_.reset(WebKit::WebContentLayer::create(this));
435 new_layer = content_layer_->layer(); 437 new_layer = content_layer_->layer();
436 #else 438 #else
437 new_layer = WebKit::WebContentLayer::create(this); 439 new_layer = WebKit::WebContentLayer::create(this);
438 #endif 440 #endif
439 } 441 }
440 if (parent_) { 442 if (parent_) {
441 #if defined(WEBLAYER_IS_PURE_VIRTUAL) 443 #if defined(WEBLAYER_IS_PURE_VIRTUAL)
442 DCHECK(parent_->web_layer_); 444 DCHECK(parent_->web_layer_);
443 parent_->web_layer_->replaceChild(web_layer_, new_layer); 445 parent_->web_layer_->replaceChild(web_layer_, new_layer);
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 if (!opaque) 915 if (!opaque)
914 color |= 0xFF; 916 color |= 0xFF;
915 #if defined(WEBLAYER_IS_PURE_VIRTUAL) 917 #if defined(WEBLAYER_IS_PURE_VIRTUAL)
916 web_layer_->setDebugBorderColor(color); 918 web_layer_->setDebugBorderColor(color);
917 #else 919 #else
918 web_layer_.setDebugBorderColor(color); 920 web_layer_.setDebugBorderColor(color);
919 #endif 921 #endif
920 } 922 }
921 923
922 } // namespace ui 924 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698