servo: Delete commented-out code
authorPatrick Walton <pcwalton@mimiga.net>
Thu, 12 Jul 2012 13:03:28 -0700
changeset 470858 9501ef0bfe071ce5abcb535f5b9ca77142023ddc
parent 470857 1d698756ba98ed76ae5bf0aff1ab7353be92114c
child 470859 4897576929fafc5a8129e34168783ebf8f6c05e3
push id44079
push userbmo:gps@mozilla.com
push dateSat, 04 Feb 2017 00:14:49 +0000
servo: Delete commented-out code Source-Repo: https://github.com/servo/servo Source-Revision: 62396c1cb96299527141d64123eb32e51a72c7ae
servo/src/servo/platform/osmain.rs
--- a/servo/src/servo/platform/osmain.rs
+++ b/servo/src/servo/platform/osmain.rs
@@ -67,17 +67,16 @@ fn mainloop(po: port<Msg>) {
                 key_handlers += [key_ch];
               }
               BeginDrawing(sender) {
                 lend_surface(surfaces, sender);
               }
               Draw(sender, dt) {
                 return_surface(surfaces, dt);
                 lend_surface(surfaces, sender);
-                //assert surfaces.s1.surf.az_target == dt;
 
                 let mut image_data;
                 unsafe {
                     let buffer = cairo_image_surface_get_data(surfaces.s1.surf.cairo_surf);
                     image_data = vec::unsafe::from_buf(buffer, 800 * 600 * 4);
                 }
 
                 let image =
@@ -204,140 +203,8 @@ fn on_osmain<T: send>(+f: fn~(comm::port
 
 // #[cfg(target_os = "linux")]
 mod platform {
     fn runmain(f: fn()) {
         f()
     }
 }
 
-/*
-#[cfg(target_os = "macos")]
-mod platform {
-    use cocoa;
-    import cocoa::base::*;
-
-    mod NSApplication {
-        fn sharedApplication() -> id {
-            let klass = str::as_c_str("NSApplication", |s| objc::objc_getClass(s));
-
-            let sel = str::as_c_str("sharedApplication", |s| objc::sel_registerName(s));
-
-            let nsapp = objc::objc_msgSend(klass, sel);
-            #debug("nsapp: %d", (nsapp as int));
-
-	    ret nsapp;
-        }
-    }
-
-    mod NSAutoreleasePool {
-        fn alloc() -> id {
-            let klass = str::as_c_str("NSAutoreleasePool", |s| objc::objc_getClass(s));
-            let sel = str::as_c_str("alloc", |s| objc::sel_registerName(s));
-            let pool = objc::objc_msgSend(klass, sel);
-            #debug("autorelease pool: %?", pool);
-            ret pool;
-        }
-        fn init(pool: id) {
-            let sel = str::as_c_str("init", |s| objc::sel_registerName(s));
-            objc::objc_msgSend(pool, sel);
-        }
-        fn release(pool: id) {
-            let sel = str::as_c_str("release", |s| objc::sel_registerName(s));
-            objc::objc_msgSend(pool, sel);
-        }
-    }
-
-    mod NSApp {
-         fn setDelegate(nsapp: id, main: id) {
-	         #debug("NSApp::setDelegate");
-	         let sel = str::as_c_str("setDelegate:", |s| objc::sel_registerName(s));
-	         cocoa::msgSend1Id(nsapp, sel, main);
-         }
-
-        fn run(nsapp: id) {
-	        #debug("NSApp::run");
-            let sel = str::as_c_str("run", |s| objc::sel_registerName(s));
-            objc::objc_msgSend(nsapp, sel);
-         }
-    }
-
-    mod MainObj {
-         extern fn applicationDidFinishLaunching(this: id, _sel: SEL) {
-	         #debug("applicationDidFinishLaunching");
-
-	         let fptr: *fn() = ptr::null();
-	         str::as_c_str("fptr", |name| {
-	             let outValue = unsafe { unsafe::reinterpret_cast(ptr::addr_of(fptr)) };
-                 #debug("*fptr %?", outValue);
-                 objc::object_getInstanceVariable(this, name, outValue)
-             });
-
-	         #debug("getting osmain fptr: %?", fptr);
-
-	         unsafe {
-	             // FIXME: We probably don't want to run the main routine in a foreign function
-                 (*fptr)();
-             }
-	     }
-
-    	fn create(f: fn()) -> id {
-            let NSObject = str::as_c_str("NSObject", |s| objc::objc_getClass(s));
-	        let MainObj = str::as_c_str("MainObj", |s| {
-	            objc::objc_allocateClassPair(NSObject, s, 0 as libc::size_t)
-	        });
-
-             // Add a field to our class to contain a pointer to a rust closure
-	        let res = str::as_c_str("fptr", |name| {
-                str::as_c_str("^i", |types| {
-                     objc::class_addIvar(MainObj, name,
-                                         sys::size_of::<libc::uintptr_t>() as libc::size_t,
-                                         16u8, types)
-                })
-            });
- 	        assert res == true;
-
-	        let launchfn = str::as_c_str("applicationDidFinishLaunching:", |s| {
-	            objc::sel_registerName(s)
-	        });
-	        let _ = str::as_c_str("@@:", |types| {
-	            objc::class_addMethod(MainObj, launchfn, applicationDidFinishLaunching, types)
-	        });
-
-	        objc::objc_registerClassPair(MainObj);
-
-            let sel = str::as_c_str("alloc", |s| objc::sel_registerName(s));
-            let mainobj = objc::objc_msgSend(MainObj, sel);
-
-            let sel = str::as_c_str("init", |s| objc::sel_registerName(s));
-            objc::objc_msgSend(mainobj, sel);
-
-	        let fptr = ptr::addr_of(f);
-	        str::as_c_str("fptr", |name| {
-	            #debug("setting osmain fptr: %?", fptr);
-		        let value = unsafe { unsafe::reinterpret_cast(fptr) };
-                #debug("*fptr: %?", value);
-                objc::object_setInstanceVariable(mainobj, name, value)
-            });
-
-	        ret mainobj;
-	    }
-	    fn release(mainobj: id) {
-            let sel = str::as_c_str("release", |s| objc::sel_registerName(s));
-            objc::objc_msgSend(mainobj, sel);
-	    }
-    }
-
-    fn runmain(f: fn()) {
-	let pool = NSAutoreleasePool::alloc();
-	NSAutoreleasePool::init(pool);
-        let NSApp = NSApplication::sharedApplication();
-
-        let mainobj = MainObj::create(f);
-	NSApp::setDelegate(NSApp, mainobj);
-	NSApp::run(NSApp);
-	
-	MainObj::release(mainobj);	
-	NSAutoreleasePool::release(pool);
-    }
-}
-*/
-