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

Unified Diff: sky/engine/core/painting/PaintingContext.cpp

Issue 1027563002: Integrate custom paint with the DocumentLifecycle (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: nits Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/engine/core/painting/PaintingContext.h ('k') | sky/engine/core/painting/PaintingTasks.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/painting/PaintingContext.cpp
diff --git a/sky/engine/core/painting/PaintingContext.cpp b/sky/engine/core/painting/PaintingContext.cpp
index f31484580de8feef857985bf9be93099af2553f5..0bac4898e52ba248bbd421c8bbed01ef0073a218 100644
--- a/sky/engine/core/painting/PaintingContext.cpp
+++ b/sky/engine/core/painting/PaintingContext.cpp
@@ -5,19 +5,25 @@
#include "sky/engine/config.h"
#include "sky/engine/core/painting/PaintingContext.h"
-#include "base/bind.h"
-#include "sky/engine/core/dom/Microtask.h"
+#include "sky/engine/core/dom/Document.h"
+#include "sky/engine/core/dom/Element.h"
+#include "sky/engine/core/painting/PaintingTasks.h"
#include "sky/engine/platform/geometry/IntRect.h"
#include "third_party/skia/include/core/SkCanvas.h"
namespace blink {
-PaintingContext::PaintingContext(const FloatSize& size, const CommitCallback& commitCallback)
- : m_size(size)
- , m_commitCallback(commitCallback)
+PassRefPtr<PaintingContext> PaintingContext::create(PassRefPtr<Element> element, const FloatSize& size)
+{
+ return adoptRef(new PaintingContext(element, size));
+}
+
+PaintingContext::PaintingContext(PassRefPtr<Element> element, const FloatSize& size)
+ : m_element(element)
+ , m_size(size)
{
m_displayList = adoptRef(new DisplayList);
- m_canvas = m_displayList->beginRecording(expandedIntSize(size));
+ m_canvas = m_displayList->beginRecording(expandedIntSize(m_size));
}
PaintingContext::~PaintingContext()
@@ -39,7 +45,8 @@ void PaintingContext::commit()
return;
m_displayList->endRecording();
m_canvas = nullptr;
- Microtask::enqueueMicrotask(base::Bind(m_commitCallback, this));
+ PaintingTasks::enqueueCommit(m_element, m_displayList.release());
+ m_element->document().scheduleVisualUpdate();
}
} // namespace blink
« no previous file with comments | « sky/engine/core/painting/PaintingContext.h ('k') | sky/engine/core/painting/PaintingTasks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698