| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/layers/picture_layer.h" | 5 #include "cc/layers/picture_layer.h" |
| 6 | 6 |
| 7 #include "cc/debug/benchmark_instrumentation.h" | |
| 8 #include "cc/debug/devtools_instrumentation.h" | 7 #include "cc/debug/devtools_instrumentation.h" |
| 9 #include "cc/layers/content_layer_client.h" | 8 #include "cc/layers/content_layer_client.h" |
| 10 #include "cc/layers/picture_layer_impl.h" | 9 #include "cc/layers/picture_layer_impl.h" |
| 11 #include "cc/trees/layer_tree_impl.h" | 10 #include "cc/trees/layer_tree_impl.h" |
| 12 #include "ui/gfx/rect_conversions.h" | 11 #include "ui/gfx/rect_conversions.h" |
| 13 | 12 |
| 14 namespace cc { | 13 namespace cc { |
| 15 | 14 |
| 16 scoped_refptr<PictureLayer> PictureLayer::Create(ContentLayerClient* client) { | 15 scoped_refptr<PictureLayer> PictureLayer::Create(ContentLayerClient* client) { |
| 17 return make_scoped_refptr(new PictureLayer(client)); | 16 return make_scoped_refptr(new PictureLayer(client)); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 pending_invalidation_.Union(rect); | 67 pending_invalidation_.Union(rect); |
| 69 } | 68 } |
| 70 Layer::SetNeedsDisplayRect(layer_rect); | 69 Layer::SetNeedsDisplayRect(layer_rect); |
| 71 } | 70 } |
| 72 | 71 |
| 73 bool PictureLayer::Update(ResourceUpdateQueue* queue, | 72 bool PictureLayer::Update(ResourceUpdateQueue* queue, |
| 74 const OcclusionTracker* occlusion) { | 73 const OcclusionTracker* occlusion) { |
| 75 // Do not early-out of this function so that PicturePile::Update has a chance | 74 // Do not early-out of this function so that PicturePile::Update has a chance |
| 76 // to record pictures due to changing visibility of this layer. | 75 // to record pictures due to changing visibility of this layer. |
| 77 | 76 |
| 78 TRACE_EVENT1(benchmark_instrumentation::kCategory, | 77 TRACE_EVENT1("cc", "PictureLayer::Update", |
| 79 benchmark_instrumentation::kPictureLayerUpdate, | 78 "source_frame_number", |
| 80 benchmark_instrumentation::kSourceFrameNumber, | |
| 81 layer_tree_host()->source_frame_number()); | 79 layer_tree_host()->source_frame_number()); |
| 82 | 80 |
| 83 bool updated = Layer::Update(queue, occlusion); | 81 bool updated = Layer::Update(queue, occlusion); |
| 84 | 82 |
| 85 pile_->Resize(paint_properties().bounds); | 83 pile_->Resize(paint_properties().bounds); |
| 86 | 84 |
| 87 // Calling paint in WebKit can sometimes cause invalidations, so save | 85 // Calling paint in WebKit can sometimes cause invalidations, so save |
| 88 // off the invalidation prior to calling update. | 86 // off the invalidation prior to calling update. |
| 89 pending_invalidation_.Swap(&pile_invalidation_); | 87 pending_invalidation_.Swap(&pile_invalidation_); |
| 90 pending_invalidation_.Clear(); | 88 pending_invalidation_.Clear(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 gfx::RectF opaque; | 133 gfx::RectF opaque; |
| 136 | 134 |
| 137 skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture); | 135 skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture); |
| 138 SkCanvas* canvas = picture->beginRecording(width, height); | 136 SkCanvas* canvas = picture->beginRecording(width, height); |
| 139 client_->PaintContents(canvas, gfx::Rect(width, height), &opaque); | 137 client_->PaintContents(canvas, gfx::Rect(width, height), &opaque); |
| 140 picture->endRecording(); | 138 picture->endRecording(); |
| 141 return picture; | 139 return picture; |
| 142 } | 140 } |
| 143 | 141 |
| 144 } // namespace cc | 142 } // namespace cc |
| OLD | NEW |