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

Unified Diff: third_party/go/src/golang.org/x/mobile/bind/seq/ref.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/bind/seq/ref.go
diff --git a/third_party/go/src/golang.org/x/mobile/bind/seq/ref.go b/third_party/go/src/golang.org/x/mobile/bind/seq/ref.go
deleted file mode 100644
index 0ebd89654f89af6e9e2c2369a1df8c0d4442dc56..0000000000000000000000000000000000000000
--- a/third_party/go/src/golang.org/x/mobile/bind/seq/ref.go
+++ /dev/null
@@ -1,60 +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 seq
-
-//#cgo LDFLAGS: -llog
-//#include <android/log.h>
-//#include <string.h>
-//import "C"
-
-import (
- "fmt"
- "sync"
-)
-
-// refs stores Go objects that have been passed to another language.
-var refs struct {
- sync.Mutex
- next int32 // next reference number to use for Go object, always negative
- refs map[interface{}]int32
- objs map[int32]interface{}
-}
-
-func init() {
- refs.Lock()
- refs.next = -24 // Go objects get negative reference numbers. Arbitrary starting point.
- refs.refs = make(map[interface{}]int32)
- refs.objs = make(map[int32]interface{})
- refs.Unlock()
-}
-
-// A Ref represents a Java or Go object passed across the language
-// boundary.
-type Ref struct {
- Num int32
-}
-
-// Get returns the underlying object.
-func (r *Ref) Get() interface{} {
- refs.Lock()
- obj, ok := refs.objs[r.Num]
- refs.Unlock()
- if !ok {
- panic(fmt.Sprintf("unknown ref %d", r.Num))
- }
- return obj
-}
-
-// Delete remove the reference to the underlying object.
-func Delete(num int32) {
- refs.Lock()
- obj, ok := refs.objs[num]
- if !ok {
- panic(fmt.Sprintf("seq.Delete unknown refnum: %d", num))
- }
- delete(refs.objs, num)
- delete(refs.refs, obj)
- refs.Unlock()
-}
« no previous file with comments | « third_party/go/src/golang.org/x/mobile/bind/seq/buffer.go ('k') | third_party/go/src/golang.org/x/mobile/bind/seq/seq.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698