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

Side by Side Diff: cc/layer_impl.cc

Issue 11412255: cc: Use skia::RefPtr in place of raw pointers and SkAutoTUnref. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ref() Created 8 years 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 | « cc/layer_impl.h ('k') | cc/layer_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/layer_impl.h" 5 #include "cc/layer_impl.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "cc/debug_border_draw_quad.h" 9 #include "cc/debug_border_draw_quad.h"
10 #include "cc/debug_colors.h" 10 #include "cc/debug_colors.h"
11 #include "cc/layer_sorter.h" 11 #include "cc/layer_sorter.h"
12 #include "cc/layer_tree_host_impl.h" 12 #include "cc/layer_tree_host_impl.h"
13 #include "cc/math_util.h" 13 #include "cc/math_util.h"
14 #include "cc/proxy.h" 14 #include "cc/proxy.h"
15 #include "cc/quad_sink.h" 15 #include "cc/quad_sink.h"
16 #include "cc/scrollbar_animation_controller.h" 16 #include "cc/scrollbar_animation_controller.h"
17 #include "third_party/skia/include/core/SkImageFilter.h"
18 #include "ui/gfx/point_conversions.h" 17 #include "ui/gfx/point_conversions.h"
19 #include "ui/gfx/rect_conversions.h" 18 #include "ui/gfx/rect_conversions.h"
20 19
21 namespace cc { 20 namespace cc {
22 21
23 LayerImpl::LayerImpl(int id) 22 LayerImpl::LayerImpl(int id)
24 : m_parent(0) 23 : m_parent(0)
25 , m_maskLayerId(-1) 24 , m_maskLayerId(-1)
26 , m_replicaLayerId(-1) 25 , m_replicaLayerId(-1)
27 , m_layerId(id) 26 , m_layerId(id)
(...skipping 17 matching lines...) Expand all
45 , m_drawCheckerboardForMissingTiles(false) 44 , m_drawCheckerboardForMissingTiles(false)
46 , m_useLCDText(false) 45 , m_useLCDText(false)
47 , m_drawsContent(false) 46 , m_drawsContent(false)
48 , m_forceRenderSurface(false) 47 , m_forceRenderSurface(false)
49 , m_isContainerForFixedPositionLayers(false) 48 , m_isContainerForFixedPositionLayers(false)
50 , m_fixedToContainerLayer(false) 49 , m_fixedToContainerLayer(false)
51 , m_renderTarget(0) 50 , m_renderTarget(0)
52 , m_drawDepth(0) 51 , m_drawDepth(0)
53 , m_drawOpacity(0) 52 , m_drawOpacity(0)
54 , m_drawOpacityIsAnimating(false) 53 , m_drawOpacityIsAnimating(false)
55 , m_filter(0)
56 , m_drawTransformIsAnimating(false) 54 , m_drawTransformIsAnimating(false)
57 , m_screenSpaceTransformIsAnimating(false) 55 , m_screenSpaceTransformIsAnimating(false)
58 , m_isClipped(false) 56 , m_isClipped(false)
59 #ifndef NDEBUG 57 #ifndef NDEBUG
60 , m_betweenWillDrawAndDidDraw(false) 58 , m_betweenWillDrawAndDidDraw(false)
61 #endif 59 #endif
62 , m_layerAnimationController(LayerAnimationController::create(this)) 60 , m_layerAnimationController(LayerAnimationController::create(this))
63 { 61 {
64 DCHECK(m_layerId > 0); 62 DCHECK(m_layerId > 0);
65 } 63 }
66 64
67 LayerImpl::~LayerImpl() 65 LayerImpl::~LayerImpl()
68 { 66 {
69 #ifndef NDEBUG 67 #ifndef NDEBUG
70 DCHECK(!m_betweenWillDrawAndDidDraw); 68 DCHECK(!m_betweenWillDrawAndDidDraw);
71 #endif 69 #endif
72 SkSafeUnref(m_filter);
73 } 70 }
74 71
75 void LayerImpl::addChild(scoped_ptr<LayerImpl> child) 72 void LayerImpl::addChild(scoped_ptr<LayerImpl> child)
76 { 73 {
77 child->setParent(this); 74 child->setParent(this);
78 m_children.append(child.Pass()); 75 m_children.append(child.Pass());
79 } 76 }
80 77
81 void LayerImpl::removeFromParent() 78 void LayerImpl::removeFromParent()
82 { 79 {
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 527
531 void LayerImpl::setBackgroundFilters(const WebKit::WebFilterOperations& backgrou ndFilters) 528 void LayerImpl::setBackgroundFilters(const WebKit::WebFilterOperations& backgrou ndFilters)
532 { 529 {
533 if (m_backgroundFilters == backgroundFilters) 530 if (m_backgroundFilters == backgroundFilters)
534 return; 531 return;
535 532
536 m_backgroundFilters = backgroundFilters; 533 m_backgroundFilters = backgroundFilters;
537 m_layerPropertyChanged = true; 534 m_layerPropertyChanged = true;
538 } 535 }
539 536
540 void LayerImpl::setFilter(SkImageFilter* filter) 537 void LayerImpl::setFilter(const skia::RefPtr<SkImageFilter>& filter)
541 { 538 {
542 if (m_filter == filter) 539 if (m_filter.get() == filter.get())
543 return; 540 return;
544 541
545 DCHECK(m_filters.isEmpty()); 542 DCHECK(m_filters.isEmpty());
546 SkRefCnt_SafeAssign(m_filter, filter); 543 m_filter = filter;
547 noteLayerPropertyChangedForSubtree(); 544 noteLayerPropertyChangedForSubtree();
548 } 545 }
549 546
550 void LayerImpl::setMasksToBounds(bool masksToBounds) 547 void LayerImpl::setMasksToBounds(bool masksToBounds)
551 { 548 {
552 if (m_masksToBounds == masksToBounds) 549 if (m_masksToBounds == masksToBounds)
553 return; 550 return;
554 551
555 m_masksToBounds = masksToBounds; 552 m_masksToBounds = masksToBounds;
556 noteLayerPropertyChangedForSubtree(); 553 noteLayerPropertyChangedForSubtree();
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 723
727 void LayerImpl::setVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer) 724 void LayerImpl::setVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer)
728 { 725 {
729 if (!m_scrollbarAnimationController) 726 if (!m_scrollbarAnimationController)
730 m_scrollbarAnimationController = ScrollbarAnimationController::create(th is); 727 m_scrollbarAnimationController = ScrollbarAnimationController::create(th is);
731 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer); 728 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer);
732 m_scrollbarAnimationController->updateScrollOffset(this); 729 m_scrollbarAnimationController->updateScrollOffset(this);
733 } 730 }
734 731
735 } // namespace cc 732 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_impl.h ('k') | cc/layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698