| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 #include "platform/graphics/ContentLayerDelegate.h" | 27 #include "platform/graphics/ContentLayerDelegate.h" |
| 28 | 28 |
| 29 #include "platform/EventTracer.h" | 29 #include "platform/EventTracer.h" |
| 30 #include "platform/RuntimeEnabledFeatures.h" | 30 #include "platform/RuntimeEnabledFeatures.h" |
| 31 #include "platform/TraceEvent.h" | 31 #include "platform/TraceEvent.h" |
| 32 #include "platform/TracedValue.h" | 32 #include "platform/TracedValue.h" |
| 33 #include "platform/geometry/IntRect.h" | 33 #include "platform/geometry/IntRect.h" |
| 34 #include "platform/graphics/GraphicsContext.h" | 34 #include "platform/graphics/GraphicsContext.h" |
| 35 #include "platform/graphics/paint/DisplayItemList.h" | 35 #include "platform/graphics/paint/DisplayItemList.h" |
| 36 #include "platform/graphics/paint/PaintArtifact.h" |
| 36 #include "platform/transforms/AffineTransform.h" | 37 #include "platform/transforms/AffineTransform.h" |
| 37 #include "platform/transforms/TransformationMatrix.h" | 38 #include "platform/transforms/TransformationMatrix.h" |
| 38 #include "public/platform/WebDisplayItemList.h" | 39 #include "public/platform/WebDisplayItemList.h" |
| 39 #include "public/platform/WebFloatRect.h" | 40 #include "public/platform/WebFloatRect.h" |
| 40 #include "public/platform/WebRect.h" | 41 #include "public/platform/WebRect.h" |
| 41 #include "third_party/skia/include/core/SkCanvas.h" | 42 #include "third_party/skia/include/core/SkCanvas.h" |
| 42 #include "third_party/skia/include/core/SkPicture.h" | 43 #include "third_party/skia/include/core/SkPicture.h" |
| 43 #include "third_party/skia/include/core/SkPictureRecorder.h" | 44 #include "third_party/skia/include/core/SkPictureRecorder.h" |
| 44 | 45 |
| 45 namespace blink { | 46 namespace blink { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 void ContentLayerDelegate::paintContents( | 79 void ContentLayerDelegate::paintContents( |
| 79 WebDisplayItemList* webDisplayItemList, const WebRect& clip, | 80 WebDisplayItemList* webDisplayItemList, const WebRect& clip, |
| 80 WebContentLayerClient::PaintingControlSetting paintingControl) | 81 WebContentLayerClient::PaintingControlSetting paintingControl) |
| 81 { | 82 { |
| 82 TRACE_EVENT1("blink,benchmark", "ContentLayerDelegate::paintContents", "clip
_rect", toTracedValue(clip)); | 83 TRACE_EVENT1("blink,benchmark", "ContentLayerDelegate::paintContents", "clip
_rect", toTracedValue(clip)); |
| 83 | 84 |
| 84 // TODO(pdr): Remove when slimming paint v2 is further along. This is only | 85 // TODO(pdr): Remove when slimming paint v2 is further along. This is only |
| 85 // here so the browser is usable during development and does not crash due | 86 // here so the browser is usable during development and does not crash due |
| 86 // to committing the new display items twice. | 87 // to committing the new display items twice. |
| 87 if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) { | 88 if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) { |
| 88 m_painter->displayItemList()->appendToWebDisplayItemList(webDisplayItemL
ist); | 89 m_painter->paintArtifact()->displayItemList().appendToWebDisplayItemList
(webDisplayItemList); |
| 89 return; | 90 return; |
| 90 } | 91 } |
| 91 | 92 |
| 92 DisplayItemList* displayItemList = m_painter->displayItemList(); | 93 DisplayItemList* displayItemList = &m_painter->paintArtifact()->displayItemL
ist(); |
| 93 ASSERT(displayItemList); | 94 ASSERT(displayItemList); |
| 94 displayItemList->setDisplayItemConstructionIsDisabled( | 95 displayItemList->setDisplayItemConstructionIsDisabled( |
| 95 paintingControl == WebContentLayerClient::DisplayListConstructionDisable
d); | 96 paintingControl == WebContentLayerClient::DisplayListConstructionDisable
d); |
| 96 | 97 |
| 97 // We also disable caching when Painting or Construction are disabled. In bo
th cases we would like | 98 // We also disable caching when Painting or Construction are disabled. In bo
th cases we would like |
| 98 // to compare assuming the full cost of recording, not the cost of re-using
cached content. | 99 // to compare assuming the full cost of recording, not the cost of re-using
cached content. |
| 99 if (paintingControl != WebContentLayerClient::PaintDefaultBehavior) | 100 if (paintingControl != WebContentLayerClient::PaintDefaultBehavior) |
| 100 displayItemList->invalidateAll(); | 101 displayItemList->invalidateAll(); |
| 101 | 102 |
| 102 GraphicsContext::DisabledMode disabledMode = GraphicsContext::NothingDisable
d; | 103 GraphicsContext::DisabledMode disabledMode = GraphicsContext::NothingDisable
d; |
| 103 if (paintingControl == WebContentLayerClient::DisplayListPaintingDisabled | 104 if (paintingControl == WebContentLayerClient::DisplayListPaintingDisabled |
| 104 || paintingControl == WebContentLayerClient::DisplayListConstructionDisa
bled) | 105 || paintingControl == WebContentLayerClient::DisplayListConstructionDisa
bled) |
| 105 disabledMode = GraphicsContext::FullyDisabled; | 106 disabledMode = GraphicsContext::FullyDisabled; |
| 106 GraphicsContext context(displayItemList, disabledMode); | 107 GraphicsContext context(displayItemList, disabledMode); |
| 107 | 108 |
| 108 m_painter->paint(context, clip); | 109 m_painter->paint(context, clip); |
| 109 | 110 |
| 110 displayItemList->commitNewDisplayItemsAndAppendToWebDisplayItemList(webDispl
ayItemList); | 111 displayItemList->commitNewDisplayItemsAndAppendToWebDisplayItemList(webDispl
ayItemList); |
| 111 } | 112 } |
| 112 | 113 |
| 113 size_t ContentLayerDelegate::approximateUnsharedMemoryUsage() const | 114 size_t ContentLayerDelegate::approximateUnsharedMemoryUsage() const |
| 114 { | 115 { |
| 115 return m_painter->displayItemList()->approximateUnsharedMemoryUsage(); | 116 return m_painter->paintArtifact()->displayItemList().approximateUnsharedMemo
ryUsage(); |
| 116 } | 117 } |
| 117 | 118 |
| 118 } // namespace blink | 119 } // namespace blink |
| OLD | NEW |