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

Unified Diff: third_party/go/src/golang.org/x/mobile/app/stdio_android.go

Issue 1275153002: Remove third_party/golang.org/x/mobile as it is no longer used with Go 1.5. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Remove golang.org/x/mobile Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/go/src/golang.org/x/mobile/app/stdio_android.go
diff --git a/third_party/go/src/golang.org/x/mobile/app/stdio_android.go b/third_party/go/src/golang.org/x/mobile/app/stdio_android.go
deleted file mode 100644
index 662840334e1fcc745280828cd58e150fc9578d5f..0000000000000000000000000000000000000000
--- a/third_party/go/src/golang.org/x/mobile/app/stdio_android.go
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package app
-
-// Android redirects stdout and stderr to /dev/null.
-// As these are common debugging utilities in Go,
-// we redirect them to logcat.
-//
-// Unfortunately, logcat is line oriented, so we must buffer.
-
-/*
-#cgo LDFLAGS: -llog
-#include <android/log.h>
-#include <string.h>
-*/
-import "C"
-
-import (
- "bufio"
- "log"
- "os"
- "unsafe"
-)
-
-var (
- ctag = C.CString("GoStdio")
- ctagLog = C.CString("GoLog")
-)
-
-type infoWriter struct{}
-
-func (infoWriter) Write(p []byte) (n int, err error) {
- cstr := C.CString(string(p))
- C.__android_log_write(C.ANDROID_LOG_INFO, ctagLog, cstr)
- C.free(unsafe.Pointer(cstr))
- return len(p), nil
-}
-
-func lineLog(f *os.File, priority C.int) {
- const logSize = 1024 // matches android/log.h.
- r := bufio.NewReaderSize(f, logSize)
- for {
- line, _, err := r.ReadLine()
- str := string(line)
- if err != nil {
- str += " " + err.Error()
- }
- cstr := C.CString(str)
- C.__android_log_write(priority, ctag, cstr)
- C.free(unsafe.Pointer(cstr))
- if err != nil {
- break
- }
- }
-}
-
-func init() {
- log.SetOutput(infoWriter{})
- // android logcat includes all of log.LstdFlags
- log.SetFlags(log.Flags() &^ log.LstdFlags)
-
- r, w, err := os.Pipe()
- if err != nil {
- panic(err)
- }
- os.Stderr = w
- go lineLog(r, C.ANDROID_LOG_ERROR)
-
- r, w, err = os.Pipe()
- if err != nil {
- panic(err)
- }
- os.Stdout = w
- go lineLog(r, C.ANDROID_LOG_INFO)
-}
« no previous file with comments | « third_party/go/src/golang.org/x/mobile/app/loop_android.go ('k') | third_party/go/src/golang.org/x/mobile/app/x11.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698