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

Side by Side Diff: third_party/WebKit/Source/core/dom/custom/CustomElementCreationScope.h

Issue 2279703002: Add a scoped context object for synchronous CE creation (Closed)
Patch Set: Clean up Created 4 years, 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CustomElementCreationScope_h
6 #define CustomElementCreationScope_h
7
8 #include "core/frame/LocalDOMWindow.h"
9 #include "platform/heap/Handle.h"
10
11 namespace blink {
12
13 class Document;
14
15 class CustomElementCreationScope {
16 STACK_ALLOCATED();
17 public:
18 explicit CustomElementCreationScope(Document* document)
19 : m_document(document)
20 {
21 if (LocalDOMWindow* window = m_document->executingWindow()) {
22 m_prev = window->customElementCreationContext();
23 window->setCustomElementCreationContext(m_document);
24 }
25 }
26
27 ~CustomElementCreationScope()
28 {
29 if (LocalDOMWindow* window = m_document->executingWindow())
30 window->setCustomElementCreationContext(m_prev);
31 }
32
33 private:
34 Member<Document> m_document;
35 Member<Document> m_prev = nullptr;
36 };
37
38 } // namespace blink
39
40 #endif // CustomElementCreationScope_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/frame/LocalDOMWindow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698