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

Side by Side Diff: samples/simple_todo/java/SimpleTodo.java

Issue 1659163007: Rename fletch -> dartino (Closed) Base URL: https://github.com/dartino/sdk.git@master
Patch Set: address comments Created 4 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
« no previous file with comments | « samples/simple_todo/compile.sh ('k') | samples/simple_todo/java/SnapshotRunner.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dartino 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.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 import fletch.*; 5 import dartino.*;
6 6
7 import java.io.FileInputStream; 7 import java.io.FileInputStream;
8 import java.io.FileNotFoundException; 8 import java.io.FileNotFoundException;
9 import java.io.IOException; 9 import java.io.IOException;
10 10
11 class SimpleTodo { 11 class SimpleTodo {
12 12
13 public static void main(String args[]) { 13 public static void main(String args[]) {
14 // Expecting a snapshot of the dart service code on the command line. 14 // Expecting a snapshot of the dart service code on the command line.
15 if (args.length != 1) { 15 if (args.length != 1) {
16 System.out.println("Usage: java SimpleTodo <snapshot>"); 16 System.out.println("Usage: java SimpleTodo <snapshot>");
17 System.exit(1); 17 System.exit(1);
18 } 18 }
19 19
20 // Load libfletch.so. 20 // Load libdartino.so.
21 System.loadLibrary("fletch"); 21 System.loadLibrary("dartino");
22 22
23 // Setup Fletch. 23 // Setup Dartino.
24 FletchApi.Setup(); 24 DartinoApi.Setup();
25 FletchServiceApi.Setup(); 25 DartinoServiceApi.Setup();
26 FletchApi.AddDefaultSharedLibrary("libfletch.so"); 26 DartinoApi.AddDefaultSharedLibrary("libdartino.so");
27 27
28 try { 28 try {
29 // Load snapshot and start dart code on a separate thread. 29 // Load snapshot and start dart code on a separate thread.
30 FileInputStream snapshotStream = new FileInputStream(args[0]); 30 FileInputStream snapshotStream = new FileInputStream(args[0]);
31 int available = snapshotStream.available(); 31 int available = snapshotStream.available();
32 byte[] snapshot = new byte[available]; 32 byte[] snapshot = new byte[available];
33 snapshotStream.read(snapshot); 33 snapshotStream.read(snapshot);
34 Thread dartThread = new Thread(new SnapshotRunner(snapshot)); 34 Thread dartThread = new Thread(new SnapshotRunner(snapshot));
35 dartThread.start(); 35 dartThread.start();
36 } catch (FileNotFoundException e) { 36 } catch (FileNotFoundException e) {
37 System.err.println("Failed loading snapshot: file not found."); 37 System.err.println("Failed loading snapshot: file not found.");
38 System.exit(1); 38 System.exit(1);
39 } catch (IOException e) { 39 } catch (IOException e) {
40 System.err.println("Failed loading snapshot: unknown error."); 40 System.err.println("Failed loading snapshot: unknown error.");
41 System.exit(1); 41 System.exit(1);
42 } 42 }
43 43
44 TodoController.InteractWithService(); 44 TodoController.InteractWithService();
45 } 45 }
46 } 46 }
OLDNEW
« no previous file with comments | « samples/simple_todo/compile.sh ('k') | samples/simple_todo/java/SnapshotRunner.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698