| OLD | NEW |
| 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 import 'dart:math' as math; | 5 import 'dart:math' as math; |
| 6 import 'dart:sky'; | 6 import 'dart:sky'; |
| 7 | 7 |
| 8 import 'package:sky/mojo/net/image_cache.dart' as image_cache; | 8 import 'package:sky/mojo/net/image_cache.dart' as image_cache; |
| 9 | 9 |
| 10 double timeBase = null; | 10 double timeBase = null; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 print("Existing image was loaded again"); | 52 print("Existing image was loaded again"); |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 | 55 |
| 56 bool handleEvent(Event event) { | 56 bool handleEvent(Event event) { |
| 57 if (event.type == "pointerdown") { | 57 if (event.type == "pointerdown") { |
| 58 return true; | 58 return true; |
| 59 } | 59 } |
| 60 | 60 |
| 61 if (event.type == "pointerup") { | 61 if (event.type == "pointerup") { |
| 62 image_cache.load(url2, handleImageLoad); | 62 image_cache.load(url2).then(handleImageLoad); |
| 63 return true; | 63 return true; |
| 64 } | 64 } |
| 65 | 65 |
| 66 return false; | 66 return false; |
| 67 } | 67 } |
| 68 | 68 |
| 69 void main() { | 69 void main() { |
| 70 image_cache.load(url1, handleImageLoad); | 70 image_cache.load(url1).then(handleImageLoad); |
| 71 image_cache.load(url1, handleImageLoad); | |
| 72 view.setEventCallback(handleEvent); | 71 view.setEventCallback(handleEvent); |
| 73 view.setBeginFrameCallback(beginFrame); | 72 view.setBeginFrameCallback(beginFrame); |
| 74 } | 73 } |
| OLD | NEW |