| Index: Source/platform/graphics/paint/DisplayItemListPictureRecorder.h
|
| diff --git a/Source/platform/graphics/paint/DisplayItemListPictureRecorder.h b/Source/platform/graphics/paint/DisplayItemListPictureRecorder.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..80091e18ae6e88219aa09e6f9b90812f98b81dfa
|
| --- /dev/null
|
| +++ b/Source/platform/graphics/paint/DisplayItemListPictureRecorder.h
|
| @@ -0,0 +1,60 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef DisplayItemListPictureRecorder_h
|
| +#define DisplayItemListPictureRecorder_h
|
| +
|
| +#include "platform/RuntimeEnabledFeatures.h"
|
| +#include "platform/graphics/GraphicsContext.h"
|
| +#include "platform/graphics/paint/DisplayItemList.h"
|
| +#include "wtf/OwnPtr.h"
|
| +
|
| +namespace blink {
|
| +
|
| +class DisplayItemListPictureRecorder {
|
| + WTF_MAKE_NONCOPYABLE(DisplayItemListPictureRecorder);
|
| + STACK_ALLOCATED();
|
| +public:
|
| + DisplayItemListPictureRecorder(const FloatRect& bounds)
|
| + : m_displayItemList(RuntimeEnabledFeatures::slimmingPaintEnabled() ? DisplayItemList::create() : nullptr)
|
| + , m_context(nullptr, m_displayItemList.get())
|
| +#if ENABLE(ASSERT)
|
| + , m_recordingEnded(false)
|
| +#endif
|
| + {
|
| + m_context.beginRecording(bounds);
|
| + }
|
| +
|
| + ~DisplayItemListPictureRecorder()
|
| + {
|
| + ASSERT(m_recordingEnded);
|
| + }
|
| +
|
| + GraphicsContext& context() { return m_context; }
|
| +
|
| + PassRefPtr<const SkPicture> endRecording()
|
| + {
|
| +#if ENABLE(ASSERT)
|
| + ASSERT(!m_recordingEnded);
|
| + m_recordingEnded = true;
|
| +#endif
|
| +
|
| + if (m_displayItemList)
|
| + m_displayItemList->replay(&m_context);
|
| +
|
| + return m_context.endRecording();
|
| + }
|
| +
|
| +private:
|
| + OwnPtr<DisplayItemList> m_displayItemList;
|
| + GraphicsContext m_context;
|
| +
|
| +#if ENABLE(ASSERT)
|
| + bool m_recordingEnded;
|
| +#endif
|
| +};
|
| +
|
| +} // namespace blink
|
| +
|
| +#endif // DisplayItemListPictureRecorder_h
|
|
|