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

Side by Side Diff: sky/framework/fn.dart

Issue 983793004: Prevent already scheduled-for-render fn components which become removed from rendering (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: 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 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 // 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 library fn; 5 library fn;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:sky' as sky; 9 import 'dart:sky' as sky;
10 import 'reflect.dart' as reflect; 10 import 'reflect.dart' as reflect;
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 } 629 }
630 _root = _rendered._root; 630 _root = _rendered._root;
631 assert(_rendered._root is sky.Node); 631 assert(_rendered._root is sky.Node);
632 632
633 if (mounting) { 633 if (mounting) {
634 didMount(); 634 didMount();
635 } 635 }
636 } 636 }
637 637
638 void _renderIfDirty() { 638 void _renderIfDirty() {
639 if (_removed)
640 return;
641
639 assert(_rendered != null); 642 assert(_rendered != null);
640 assert(!_removed);
641 643
642 var rendered = _rendered; 644 var rendered = _rendered;
643 while (rendered is Component) { 645 while (rendered is Component) {
644 rendered = rendered._rendered; 646 rendered = rendered._rendered;
645 } 647 }
648
649 assert(rendered._root != null);
646 sky.Node root = rendered._root; 650 sky.Node root = rendered._root;
647 651
648 _renderInternal(root.parentNode, root.nextSibling); 652 _renderInternal(root.parentNode, root.nextSibling);
649 } 653 }
650 654
651 void setState(Function fn()) { 655 void setState(Function fn()) {
652 assert(_rendered != null || _removed); // cannot setState before mounting. 656 assert(_rendered != null || _removed); // cannot setState before mounting.
653 _stateful = true; 657 _stateful = true;
654 fn(); 658 fn();
655 if (!_removed && _currentlyRendering != this) { 659 if (!_removed && _currentlyRendering != this) {
(...skipping 16 matching lines...) Expand all
672 676
673 _sync(null, _host, null); 677 _sync(null, _host, null);
674 assert(_root is sky.Node); 678 assert(_root is sky.Node);
675 679
676 sw.stop(); 680 sw.stop();
677 if (_shouldLogRenderDuration) 681 if (_shouldLogRenderDuration)
678 print("Initial render: ${sw.elapsedMicroseconds} microseconds"); 682 print("Initial render: ${sw.elapsedMicroseconds} microseconds");
679 }); 683 });
680 } 684 }
681 } 685 }
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