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

Side by Side Diff: sky/engine/core/dom/shadow/ShadowRoot.cpp

Issue 814713002: Null check StyleEngine in ~ShadowRoot. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 ShadowRoot::ShadowRoot(Document& document) 49 ShadowRoot::ShadowRoot(Document& document)
50 : DocumentFragment(0, CreateShadowRoot) 50 : DocumentFragment(0, CreateShadowRoot)
51 , TreeScope(*this, document) 51 , TreeScope(*this, document)
52 , m_registeredWithParentShadowRoot(false) 52 , m_registeredWithParentShadowRoot(false)
53 , m_descendantInsertionPointsIsValid(false) 53 , m_descendantInsertionPointsIsValid(false)
54 { 54 {
55 } 55 }
56 56
57 ShadowRoot::~ShadowRoot() 57 ShadowRoot::~ShadowRoot()
58 { 58 {
59 document().styleEngine()->didRemoveShadowRoot(this); 59 if (StyleEngine* styleEngine = document().styleEngine())
60 styleEngine->didRemoveShadowRoot(this);
60 61
61 // We cannot let ContainerNode destructor call willBeDeletedFromDocument() 62 // We cannot let ContainerNode destructor call willBeDeletedFromDocument()
62 // for this ShadowRoot instance because TreeScope destructor 63 // for this ShadowRoot instance because TreeScope destructor
63 // clears Node::m_treeScope thus ContainerNode is no longer able 64 // clears Node::m_treeScope thus ContainerNode is no longer able
64 // to access it Document reference after that. 65 // to access it Document reference after that.
65 willBeDeletedFromDocument(); 66 willBeDeletedFromDocument();
66 67
67 // We must remove all of our children first before the TreeScope destructor 68 // We must remove all of our children first before the TreeScope destructor
68 // runs so we don't go through TreeScopeAdopter for each child with a 69 // runs so we don't go through TreeScopeAdopter for each child with a
69 // destructed tree scope in each descendant. 70 // destructed tree scope in each descendant.
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 Vector<RefPtr<InsertionPoint> > insertionPoints; 214 Vector<RefPtr<InsertionPoint> > insertionPoints;
214 for (InsertionPoint* insertionPoint = Traversal<InsertionPoint>::firstWithin (*this); insertionPoint; insertionPoint = Traversal<InsertionPoint>::next(*inser tionPoint, this)) 215 for (InsertionPoint* insertionPoint = Traversal<InsertionPoint>::firstWithin (*this); insertionPoint; insertionPoint = Traversal<InsertionPoint>::next(*inser tionPoint, this))
215 insertionPoints.append(insertionPoint); 216 insertionPoints.append(insertionPoint);
216 217
217 ensureShadowRootRareData()->setDescendantInsertionPoints(insertionPoints); 218 ensureShadowRootRareData()->setDescendantInsertionPoints(insertionPoints);
218 219
219 return m_shadowRootRareData->descendantInsertionPoints(); 220 return m_shadowRootRareData->descendantInsertionPoints();
220 } 221 }
221 222
222 } 223 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698