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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "platform/graphics/compositing/PaintArtifactCompositor.h" 5 #include "platform/graphics/compositing/PaintArtifactCompositor.h"
6 6
7 #include "cc/layers/content_layer_client.h" 7 #include "cc/layers/content_layer_client.h"
8 #include "cc/layers/layer.h" 8 #include "cc/layers/layer.h"
9 #include "cc/layers/picture_layer.h" 9 #include "cc/layers/picture_layer.h"
10 #include "cc/playback/display_item_list.h" 10 #include "cc/playback/display_item_list.h"
(...skipping 14 matching lines...) Expand all
25 #include "ui/gfx/geometry/point.h" 25 #include "ui/gfx/geometry/point.h"
26 #include "ui/gfx/geometry/point_f.h" 26 #include "ui/gfx/geometry/point_f.h"
27 #include "ui/gfx/geometry/rect.h" 27 #include "ui/gfx/geometry/rect.h"
28 #include "ui/gfx/geometry/rect_f.h" 28 #include "ui/gfx/geometry/rect_f.h"
29 #include "ui/gfx/geometry/size.h" 29 #include "ui/gfx/geometry/size.h"
30 #include "ui/gfx/geometry/size_conversions.h" 30 #include "ui/gfx/geometry/size_conversions.h"
31 #include "ui/gfx/geometry/size_f.h" 31 #include "ui/gfx/geometry/size_f.h"
32 #include "ui/gfx/skia_util.h" 32 #include "ui/gfx/skia_util.h"
33 #include "wtf/Allocator.h" 33 #include "wtf/Allocator.h"
34 #include "wtf/Noncopyable.h" 34 #include "wtf/Noncopyable.h"
35 #include "wtf/PtrUtil.h" 35 #include "wtf/PassOwnPtr.h"
36 #include <algorithm> 36 #include <algorithm>
37 #include <memory>
38 #include <utility> 37 #include <utility>
39 38
40 namespace blink { 39 namespace blink {
41 40
42 class PaintArtifactCompositor::ContentLayerClientImpl : public cc::ContentLayerC lient { 41 class PaintArtifactCompositor::ContentLayerClientImpl : public cc::ContentLayerC lient {
43 WTF_MAKE_NONCOPYABLE(ContentLayerClientImpl); 42 WTF_MAKE_NONCOPYABLE(ContentLayerClientImpl);
44 USING_FAST_MALLOC(ContentLayerClientImpl); 43 USING_FAST_MALLOC(ContentLayerClientImpl);
45 public: 44 public:
46 ContentLayerClientImpl(scoped_refptr<cc::DisplayItemList> list, const gfx::R ect& paintableRegion) 45 ContentLayerClientImpl(scoped_refptr<cc::DisplayItemList> list, const gfx::R ect& paintableRegion)
47 : m_ccDisplayItemList(std::move(list)), m_paintableRegion(paintableRegio n) { } 46 : m_ccDisplayItemList(std::move(list)), m_paintableRegion(paintableRegio n) { }
(...skipping 14 matching lines...) Expand all
62 private: 61 private:
63 scoped_refptr<cc::DisplayItemList> m_ccDisplayItemList; 62 scoped_refptr<cc::DisplayItemList> m_ccDisplayItemList;
64 gfx::Rect m_paintableRegion; 63 gfx::Rect m_paintableRegion;
65 }; 64 };
66 65
67 PaintArtifactCompositor::PaintArtifactCompositor() 66 PaintArtifactCompositor::PaintArtifactCompositor()
68 { 67 {
69 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) 68 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled())
70 return; 69 return;
71 m_rootLayer = cc::Layer::Create(); 70 m_rootLayer = cc::Layer::Create();
72 m_webLayer = wrapUnique(Platform::current()->compositorSupport()->createLaye rFromCCLayer(m_rootLayer.get())); 71 m_webLayer = adoptPtr(Platform::current()->compositorSupport()->createLayerF romCCLayer(m_rootLayer.get()));
73 } 72 }
74 73
75 PaintArtifactCompositor::~PaintArtifactCompositor() 74 PaintArtifactCompositor::~PaintArtifactCompositor()
76 { 75 {
77 } 76 }
78 77
79 namespace { 78 namespace {
80 79
81 static void appendDisplayItemToCcDisplayItemList(const DisplayItem& displayItem, cc::DisplayItemList* list) 80 static void appendDisplayItemToCcDisplayItemList(const DisplayItem& displayItem, cc::DisplayItemList* list)
82 { 81 {
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 { 366 {
368 DCHECK(paintChunk.size()); 367 DCHECK(paintChunk.size());
369 368
370 // If the paint chunk is a foreign layer, just return that layer. 369 // If the paint chunk is a foreign layer, just return that layer.
371 if (scoped_refptr<cc::Layer> foreignLayer = foreignLayerForPaintChunk(paintA rtifact, paintChunk, layerOffset)) 370 if (scoped_refptr<cc::Layer> foreignLayer = foreignLayerForPaintChunk(paintA rtifact, paintChunk, layerOffset))
372 return foreignLayer; 371 return foreignLayer;
373 372
374 // The common case: create a layer for painted content. 373 // The common case: create a layer for painted content.
375 gfx::Rect combinedBounds = enclosingIntRect(paintChunk.bounds); 374 gfx::Rect combinedBounds = enclosingIntRect(paintChunk.bounds);
376 scoped_refptr<cc::DisplayItemList> displayList = recordPaintChunk(paintArtif act, paintChunk, combinedBounds); 375 scoped_refptr<cc::DisplayItemList> displayList = recordPaintChunk(paintArtif act, paintChunk, combinedBounds);
377 std::unique_ptr<ContentLayerClientImpl> contentLayerClient = wrapUnique( 376 OwnPtr<ContentLayerClientImpl> contentLayerClient = adoptPtr(
378 new ContentLayerClientImpl(std::move(displayList), gfx::Rect(combinedBou nds.size()))); 377 new ContentLayerClientImpl(std::move(displayList), gfx::Rect(combinedBou nds.size())));
379 378
380 layerOffset = combinedBounds.OffsetFromOrigin(); 379 layerOffset = combinedBounds.OffsetFromOrigin();
381 scoped_refptr<cc::PictureLayer> layer = cc::PictureLayer::Create(contentLaye rClient.get()); 380 scoped_refptr<cc::PictureLayer> layer = cc::PictureLayer::Create(contentLaye rClient.get());
382 layer->SetBounds(combinedBounds.size()); 381 layer->SetBounds(combinedBounds.size());
383 layer->SetIsDrawable(true); 382 layer->SetIsDrawable(true);
384 if (paintChunk.knownToBeOpaque) 383 if (paintChunk.knownToBeOpaque)
385 layer->SetContentsOpaque(true); 384 layer->SetContentsOpaque(true);
386 m_contentLayerClients.append(std::move(contentLayerClient)); 385 m_contentLayerClients.append(std::move(contentLayerClient));
387 return layer; 386 return layer;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 layer->SetEffectTreeIndex(kSecondaryRootNodeId); 421 layer->SetEffectTreeIndex(kSecondaryRootNodeId);
423 layer->SetScrollTreeIndex(kSecondaryRootNodeId); 422 layer->SetScrollTreeIndex(kSecondaryRootNodeId);
424 } 423 }
425 424
426 // Mark the property trees as having been rebuilt. 425 // Mark the property trees as having been rebuilt.
427 host->property_trees()->sequence_number = kPropertyTreeSequenceNumber; 426 host->property_trees()->sequence_number = kPropertyTreeSequenceNumber;
428 host->property_trees()->needs_rebuild = false; 427 host->property_trees()->needs_rebuild = false;
429 } 428 }
430 429
431 } // namespace blink 430 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698