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

Side by Side Diff: sky/engine/core/dom/custom/custom_element.cc

Issue 946083003: Rename Sky's custom2 to custom (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sky/engine/config.h" 5 #include "sky/engine/config.h"
6 #include "sky/engine/core/dom/custom2/new_custom_element.h" 6 #include "sky/engine/core/dom/custom/custom_element.h"
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "dart/runtime/include/dart_api.h" 9 #include "dart/runtime/include/dart_api.h"
10 #include "sky/engine/core/dom/Document.h" 10 #include "sky/engine/core/dom/Document.h"
11 #include "sky/engine/core/dom/Element.h" 11 #include "sky/engine/core/dom/Element.h"
12 #include "sky/engine/core/dom/Microtask.h" 12 #include "sky/engine/core/dom/Microtask.h"
13 #include "sky/engine/core/dom/custom2/new_custom_element_callback_scope.h" 13 #include "sky/engine/core/dom/custom/custom_element_callback_scope.h"
14 #include "sky/engine/core/dom/custom2/new_custom_element_registry.h" 14 #include "sky/engine/core/dom/custom/custom_element_registry.h"
15 #include "sky/engine/tonic/dart_converter.h" 15 #include "sky/engine/tonic/dart_converter.h"
16 #include "sky/engine/tonic/dart_state.h" 16 #include "sky/engine/tonic/dart_state.h"
17 #include "sky/engine/wtf/text/AtomicString.h" 17 #include "sky/engine/wtf/text/AtomicString.h"
18 18
19 namespace blink { 19 namespace blink {
20 namespace { 20 namespace {
21 21
22 void ScheduleCallback(const base::Closure& callback) { 22 void ScheduleCallback(const base::Closure& callback) {
23 if (auto* scope = NewCustomElementCallbackScope::Current()) { 23 if (auto* scope = CustomElementCallbackScope::Current()) {
24 scope->Enqueue(callback); 24 scope->Enqueue(callback);
25 } else { 25 } else {
26 Microtask::enqueueMicrotask(callback); 26 Microtask::enqueueMicrotask(callback);
27 } 27 }
28 } 28 }
29 29
30 void CallAttributeDidChangedCallback(RefPtr<Element> element, 30 void CallAttributeDidChangedCallback(RefPtr<Element> element,
31 AtomicString name, 31 AtomicString name,
32 AtomicString oldValue, 32 AtomicString oldValue,
33 AtomicString newValue) { 33 AtomicString newValue) {
(...skipping 26 matching lines...) Expand all
60 if (!dart_state) 60 if (!dart_state)
61 return; 61 return;
62 DartState::Scope scope(dart_state); 62 DartState::Scope scope(dart_state);
63 Dart_Handle wrapper = ToDart(element); 63 Dart_Handle wrapper = ToDart(element);
64 Dart_Handle callback = Dart_NewStringFromCString("detachedCallback"); 64 Dart_Handle callback = Dart_NewStringFromCString("detachedCallback");
65 LogIfError(Dart_Invoke(wrapper, callback, 0, nullptr)); 65 LogIfError(Dart_Invoke(wrapper, callback, 0, nullptr));
66 } 66 }
67 67
68 } // namespace 68 } // namespace
69 69
70 void NewCustomElement::AttributeDidChange(Element* element, 70 void CustomElement::AttributeDidChange(Element* element,
71 const AtomicString& name, 71 const AtomicString& name,
72 const AtomicString& oldValue, 72 const AtomicString& oldValue,
73 const AtomicString& newValue) { 73 const AtomicString& newValue) {
74 ScheduleCallback(base::Bind(CallAttributeDidChangedCallback, 74 ScheduleCallback(base::Bind(CallAttributeDidChangedCallback,
75 element, name, oldValue, newValue)); 75 element, name, oldValue, newValue));
76 } 76 }
77 77
78 void NewCustomElement::DidAttach(Element* element, Document& document) { 78 void CustomElement::DidAttach(Element* element, Document& document) {
79 ScheduleCallback(base::Bind(CallDidAttachedCallback, element, &document)); 79 ScheduleCallback(base::Bind(CallDidAttachedCallback, element, &document));
80 } 80 }
81 81
82 void NewCustomElement::DidDetach(Element* element, Document& document) { 82 void CustomElement::DidDetach(Element* element, Document& document) {
83 ScheduleCallback(base::Bind(CallDidDetachedCallback, element, &document)); 83 ScheduleCallback(base::Bind(CallDidDetachedCallback, element, &document));
84 } 84 }
85 85
86 } // namespace blink 86 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/dom/custom/custom_element.h ('k') | sky/engine/core/dom/custom/custom_element_callback_scope.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698