| OLD | NEW |
| 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 #ifndef PaintArtifact_h | 5 #ifndef PaintArtifact_h |
| 6 #define PaintArtifact_h | 6 #define PaintArtifact_h |
| 7 | 7 |
| 8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "platform/graphics/paint/DisplayItemList.h" | 9 #include "platform/graphics/paint/DisplayItemList.h" |
| 10 #include "platform/graphics/paint/PaintChunk.h" | 10 #include "platform/graphics/paint/PaintChunk.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // | 23 // |
| 24 // It represents a particular state of the world, and should be immutable | 24 // It represents a particular state of the world, and should be immutable |
| 25 // (const) to most of its users. | 25 // (const) to most of its users. |
| 26 class PLATFORM_EXPORT PaintArtifact final { | 26 class PLATFORM_EXPORT PaintArtifact final { |
| 27 DISALLOW_NEW(); | 27 DISALLOW_NEW(); |
| 28 WTF_MAKE_NONCOPYABLE(PaintArtifact); | 28 WTF_MAKE_NONCOPYABLE(PaintArtifact); |
| 29 public: | 29 public: |
| 30 PaintArtifact(); | 30 PaintArtifact(); |
| 31 ~PaintArtifact(); | 31 ~PaintArtifact(); |
| 32 | 32 |
| 33 typedef WTF::HashMap<DisplayItemClient, IntRect> DisplayItemRectMap; |
| 34 |
| 33 bool isEmpty() const { return m_displayItemList.isEmpty(); } | 35 bool isEmpty() const { return m_displayItemList.isEmpty(); } |
| 34 | 36 |
| 35 DisplayItemList& displayItemList() { return m_displayItemList; } | 37 DisplayItemList& displayItemList() { return m_displayItemList; } |
| 36 const DisplayItemList& displayItemList() const { return m_displayItemList; } | 38 const DisplayItemList& displayItemList() const { return m_displayItemList; } |
| 37 | 39 |
| 38 Vector<PaintChunk>& paintChunks() { return m_paintChunks; } | 40 Vector<PaintChunk>& paintChunks() { return m_paintChunks; } |
| 39 const Vector<PaintChunk>& paintChunks() const { return m_paintChunks; } | 41 const Vector<PaintChunk>& paintChunks() const { return m_paintChunks; } |
| 40 | 42 |
| 41 // Resets to an empty paint artifact. | 43 // Resets to an empty paint artifact. |
| 42 void reset(); | 44 void reset(); |
| 43 | 45 |
| 44 // Returns the approximate memory usage, excluding memory likely to be | 46 // Returns the approximate memory usage, excluding memory likely to be |
| 45 // shared with the embedder after copying to WebDisplayItemList. | 47 // shared with the embedder after copying to WebDisplayItemList. |
| 46 size_t approximateUnsharedMemoryUsage() const; | 48 size_t approximateUnsharedMemoryUsage() const; |
| 47 | 49 |
| 48 // Draws the paint artifact to a GraphicsContext. | 50 // Draws the paint artifact to a GraphicsContext. |
| 49 void replay(GraphicsContext&) const; | 51 void replay(GraphicsContext&) const; |
| 50 | 52 |
| 51 // Writes the paint artifact into a WebDisplayItemList. | 53 // Writes the paint artifact into a WebDisplayItemList. |
| 52 void appendToWebDisplayItemList(WebDisplayItemList*) const; | 54 void appendToWebDisplayItemList(const DisplayItemRectMap& itemRects, WebDisp
layItemList*) const; |
| 53 | 55 |
| 54 private: | 56 private: |
| 55 DisplayItemList m_displayItemList; | 57 DisplayItemList m_displayItemList; |
| 56 Vector<PaintChunk> m_paintChunks; | 58 Vector<PaintChunk> m_paintChunks; |
| 57 }; | 59 }; |
| 58 | 60 |
| 59 } // namespace blink | 61 } // namespace blink |
| 60 | 62 |
| 61 #endif // PaintArtifact_h | 63 #endif // PaintArtifact_h |
| OLD | NEW |