| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:io'; | 6 import 'dart:io'; |
| 7 import 'dart:isolate'; | 7 import 'dart:isolate'; |
| 8 | 8 |
| 9 import 'package:front_end/src/incremental/byte_store.dart'; | 9 import 'package:front_end/src/incremental/byte_store.dart'; |
| 10 import 'package:path/path.dart'; | 10 import 'package:path/path.dart'; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 return _getFileForKey(key).readAsBytesSync(); | 152 return _getFileForKey(key).readAsBytesSync(); |
| 153 } catch (_) { | 153 } catch (_) { |
| 154 return null; | 154 return null; |
| 155 } | 155 } |
| 156 } | 156 } |
| 157 | 157 |
| 158 @override | 158 @override |
| 159 void put(String key, List<int> bytes) { | 159 void put(String key, List<int> bytes) { |
| 160 try { | 160 try { |
| 161 File tempFile = _getFileForKey(_tempName); | 161 File tempFile = _getFileForKey(_tempName); |
| 162 tempFile.writeAsBytesSync(bytes, flush: true); | 162 tempFile.writeAsBytesSync(bytes); |
| 163 File file = _getFileForKey(key); | 163 File file = _getFileForKey(key); |
| 164 tempFile.renameSync(file.path); | 164 tempFile.renameSync(file.path); |
| 165 } catch (_) {} | 165 } catch (_) {} |
| 166 } | 166 } |
| 167 | 167 |
| 168 File _getFileForKey(String key) { | 168 File _getFileForKey(String key) { |
| 169 return new File(join(_cachePath, key)); | 169 return new File(join(_cachePath, key)); |
| 170 } | 170 } |
| 171 } | 171 } |
| OLD | NEW |