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

Side by Side Diff: pkg/mdv/lib/src/template_iterator.dart

Issue 23890008: Revert "Make LinkedHashMap also have a factory constructor and be customizable" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of mdv; 5 part of mdv;
6 6
7 // This code is a port of Model-Driven-Views: 7 // This code is a port of Model-Driven-Views:
8 // https://github.com/polymer-project/mdv 8 // https://github.com/polymer-project/mdv
9 // The code mostly comes from src/template_element.js 9 // The code mostly comes from src/template_element.js
10 10
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 var delegate = template.bindingDelegate; 337 var delegate = template.bindingDelegate;
338 338
339 if (template.parentNode == null || template.document.window == null) { 339 if (template.parentNode == null || template.document.window == null) {
340 close(); 340 close();
341 // TODO(jmesserly): MDV calls templateIteratorTable.delete(this) here, 341 // TODO(jmesserly): MDV calls templateIteratorTable.delete(this) here,
342 // but I think that's a no-op because only nodes are used as keys. 342 // but I think that's a no-op because only nodes are used as keys.
343 // See https://github.com/Polymer/mdv/pull/114. 343 // See https://github.com/Polymer/mdv/pull/114.
344 return; 344 return;
345 } 345 }
346 346
347 var instanceCache = new HashMap(equals: identical); 347 // TODO(jmesserly): IdentityMap matches JS semantics, but it's O(N) right
348 // now. See http://dartbug.com/4161.
349 var instanceCache = new IdentityMap();
348 var removeDelta = 0; 350 var removeDelta = 0;
349 for (var splice in splices) { 351 for (var splice in splices) {
350 for (int i = 0; i < splice.removedCount; i++) { 352 for (int i = 0; i < splice.removedCount; i++) {
351 var instanceNodes = extractInstanceAt(splice.index + removeDelta); 353 var instanceNodes = extractInstanceAt(splice.index + removeDelta);
352 if (instanceNodes.length == 0) continue; 354 if (instanceNodes.length == 0) continue;
353 var model = _mdv(instanceNodes.first)._templateInstance.model; 355 var model = _mdv(instanceNodes.first)._templateInstance.model;
354 instanceCache[model] = instanceNodes; 356 instanceCache[model] = instanceNodes;
355 } 357 }
356 358
357 removeDelta -= splice.addedCount; 359 removeDelta -= splice.addedCount;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 nodeExt._templateIterator = null; 407 nodeExt._templateIterator = null;
406 } 408 }
407 } 409 }
408 410
409 _nodeOrCustom(node).unbindAll(); 411 _nodeOrCustom(node).unbindAll();
410 for (var c = node.firstChild; c != null; c = c.nextNode) { 412 for (var c = node.firstChild; c != null; c = c.nextNode) {
411 _unbindAllRecursively(c); 413 _unbindAllRecursively(c);
412 } 414 }
413 } 415 }
414 } 416 }
OLDNEW
« no previous file with comments | « pkg/analyzer_experimental/lib/src/generated/java_core.dart ('k') | pkg/serialization/lib/src/reader_writer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698