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

Side by Side Diff: samples/todomvc/ios/TodoMVC/AppDelegate.mm

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
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 "AppDelegate.h" 5 #import "AppDelegate.h"
6 6
7 #include "include/fletch_api.h" 7 #include "include/dartino_api.h"
8 #include "include/service_api.h" 8 #include "include/service_api.h"
9 9
10 #include "todomvc_presenter.h" 10 #include "todomvc_presenter.h"
11 #include "todomvc_service.h" 11 #include "todomvc_service.h"
12 12
13 @interface AppDelegate () 13 @interface AppDelegate ()
14 14
15 @end 15 @end
16 16
17 @implementation AppDelegate 17 @implementation AppDelegate
18 18
19 static dispatch_queue_t queue; 19 static dispatch_queue_t queue;
20 20
21 + (void)loadAndRunDartSnapshot { 21 + (void)loadAndRunDartSnapshot {
22 // Get the path for the snapshot in the main application bundle. 22 // Get the path for the snapshot in the main application bundle.
23 NSBundle* mainBundle = [NSBundle mainBundle]; 23 NSBundle* mainBundle = [NSBundle mainBundle];
24 NSString* snapshot = 24 NSString* snapshot =
25 [mainBundle pathForResource: @"todomvc" ofType: @"snapshot"]; 25 [mainBundle pathForResource: @"todomvc" ofType: @"snapshot"];
26 // Read the snapshot and pass it to fletch. 26 // Read the snapshot and pass it to dartino.
27 NSData* data = [[NSData alloc] initWithContentsOfFile:snapshot]; 27 NSData* data = [[NSData alloc] initWithContentsOfFile:snapshot];
28 unsigned char* bytes = 28 unsigned char* bytes =
29 reinterpret_cast<unsigned char*>(const_cast<void*>(data.bytes)); 29 reinterpret_cast<unsigned char*>(const_cast<void*>(data.bytes));
30 NSLog(@"Fletch execution started\n"); 30 NSLog(@"Dartino execution started\n");
31 FletchProgram program = FletchLoadSnapshot(bytes, data.length); 31 DartinoProgram program = DartinoLoadSnapshot(bytes, data.length);
32 FletchRunMain(program); 32 DartinoRunMain(program);
33 FletchDeleteProgram(program); 33 DartinoDeleteProgram(program);
34 NSLog(@"Fletch execution terminated\n"); 34 NSLog(@"Dartino execution terminated\n");
35 } 35 }
36 36
37 - (BOOL)application:(UIApplication *)application 37 - (BOOL)application:(UIApplication *)application
38 didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 38 didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
39 39
40 // Setup Fletch and the Fletch service API. 40 // Setup Dartino and the Dartino service API.
41 FletchSetup(); 41 DartinoSetup();
42 ServiceApiSetup(); 42 ServiceApiSetup();
43 // Create dispatch queue to run the Fletch VM on a separate thread. 43 // Create dispatch queue to run the Dartino VM on a separate thread.
44 queue = dispatch_queue_create("com.google.fletch.dartQueue", 44 queue = dispatch_queue_create("com.google.dartino.dartQueue",
45 DISPATCH_QUEUE_SERIAL); 45 DISPATCH_QUEUE_SERIAL);
46 // Post task to load and run snapshot on a different thread. 46 // Post task to load and run snapshot on a different thread.
47 dispatch_async(queue, ^() { 47 dispatch_async(queue, ^() {
48 [AppDelegate loadAndRunDartSnapshot]; 48 [AppDelegate loadAndRunDartSnapshot];
49 }); 49 });
50 // Setup the concrete todo service. 50 // Setup the concrete todo service.
51 TodoMVCService::setup(); 51 TodoMVCService::setup();
52 52
53 return YES; 53 return YES;
54 } 54 }
(...skipping 23 matching lines...) Expand all
78 - (void)applicationDidBecomeActive:(UIApplication *)application { 78 - (void)applicationDidBecomeActive:(UIApplication *)application {
79 // Restart any tasks that were paused (or not yet started) while the 79 // Restart any tasks that were paused (or not yet started) while the
80 // application was inactive. If the application was previously in the 80 // application was inactive. If the application was previously in the
81 // background, optionally refresh the user interface. 81 // background, optionally refresh the user interface.
82 } 82 }
83 83
84 - (void)applicationWillTerminate:(UIApplication *)application { 84 - (void)applicationWillTerminate:(UIApplication *)application {
85 // Called when the application is about to terminate. Save data if 85 // Called when the application is about to terminate. Save data if
86 // appropriate. See also applicationDidEnterBackground:. 86 // appropriate. See also applicationDidEnterBackground:.
87 87
88 // Tear down the service API structures and Fletch. 88 // Tear down the service API structures and Dartino.
89 TodoMVCService::tearDown(); 89 TodoMVCService::tearDown();
90 ServiceApiTearDown(); 90 ServiceApiTearDown();
91 FletchTearDown(); 91 DartinoTearDown();
92 } 92 }
93 93
94 @end 94 @end
OLDNEW
« no previous file with comments | « samples/todomvc/ios/TodoMVC.xcodeproj/project.pbxproj ('k') | samples/todomvc/todomvc_shared.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698