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

Unified Diff: Source/core/html/canvas/CanvasRenderingContext2D.cpp

Issue 211073002: [Oilpan]: Move CSSFontSelectorClient to the oilpan heap using transition types. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Adding StyleEngine.cpp change (forgot to upload diff again with WTF change) Created 6 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
Index: Source/core/html/canvas/CanvasRenderingContext2D.cpp
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
index 4c0249c7642642b0074c48fe03eea3aadf8daaa2..5dc0caf0938bc32c080403237af222466bd122a6 100644
--- a/Source/core/html/canvas/CanvasRenderingContext2D.cpp
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
@@ -79,10 +79,10 @@ static const char defaultFont[] = "10px sans-serif";
CanvasRenderingContext2D::CanvasRenderingContext2D(HTMLCanvasElement* canvas, const Canvas2DContextAttributes* attrs, bool usesCSSCompatibilityParseMode)
: CanvasRenderingContext(canvas)
- , m_stateStack(1)
, m_usesCSSCompatibilityParseMode(usesCSSCompatibilityParseMode)
, m_hasAlpha(!attrs || attrs->alpha())
{
+ m_stateStack.append(adoptPtrWillBeNoop(new State()));
ScriptWrappable::init(this);
}
@@ -118,7 +118,7 @@ void CanvasRenderingContext2D::reset()
{
unwindStateStack();
m_stateStack.resize(1);
- m_stateStack.first() = State();
+ m_stateStack.first() = adoptPtrWillBeNoop(new State());
m_path.clear();
}
@@ -185,8 +185,10 @@ CanvasRenderingContext2D::State& CanvasRenderingContext2D::State::operator=(cons
if (this == &other)
return *this;
+#if !ENABLE(OILPAN)
if (m_realizedFont)
static_cast<CSSFontSelector*>(m_font.fontSelector())->unregisterForInvalidationCallbacks(this);
+#endif
m_unrealizedSaveCount = other.m_unrealizedSaveCount;
m_unparsedStrokeColor = other.m_unparsedStrokeColor;
@@ -220,8 +222,10 @@ CanvasRenderingContext2D::State& CanvasRenderingContext2D::State::operator=(cons
CanvasRenderingContext2D::State::~State()
{
+#if !ENABLE(OILPAN)
if (m_realizedFont)
static_cast<CSSFontSelector*>(m_font.fontSelector())->unregisterForInvalidationCallbacks(this);
+#endif
}
void CanvasRenderingContext2D::State::fontsNeedUpdate(CSSFontSelector* fontSelector)
@@ -238,13 +242,13 @@ void CanvasRenderingContext2D::realizeSaves()
ASSERT(m_stateStack.size() >= 1);
// Reduce the current state's unrealized count by one now,
// to reflect the fact we are saving one state.
- m_stateStack.last().m_unrealizedSaveCount--;
- m_stateStack.append(state());
+ m_stateStack.last()->m_unrealizedSaveCount--;
+ m_stateStack.append(adoptPtrWillBeNoop(new State(state())));
// Set the new state's unrealized count to 0, because it has no outstanding saves.
// We need to do this explicitly because the copy constructor and operator= used
// by the Vector operations copy the unrealized count from the previous state (in
// turn necessary to support correct resizing and unwinding of the stack).
- m_stateStack.last().m_unrealizedSaveCount = 0;
+ m_stateStack.last()->m_unrealizedSaveCount = 0;
GraphicsContext* context = drawingContext();
if (context)
context->save();
@@ -255,7 +259,7 @@ void CanvasRenderingContext2D::restore()
{
if (state().m_unrealizedSaveCount) {
// We never realized the save, so just record that it was unnecessary.
- --m_stateStack.last().m_unrealizedSaveCount;
+ --m_stateStack.last()->m_unrealizedSaveCount;
return;
}
ASSERT(m_stateStack.size() >= 1);
@@ -1924,8 +1928,10 @@ void CanvasRenderingContext2D::setFont(const String& newFont)
StyleResolver& styleResolver = canvas()->document().ensureStyleResolver();
styleResolver.applyPropertiesToStyle(properties, WTF_ARRAY_LENGTH(properties), newStyle.get());
+#if !ENABLE(OILPAN)
if (state().m_realizedFont)
static_cast<CSSFontSelector*>(state().m_font.fontSelector())->unregisterForInvalidationCallbacks(&modifiableState());
+#endif
modifiableState().m_font = newStyle->font();
modifiableState().m_font.update(canvas()->document().styleEngine()->fontSelector());
modifiableState().m_realizedFont = true;

Powered by Google App Engine
This is Rietveld 408576698