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

Unified Diff: mojo/public/go/bindings/util.go

Issue 2250183003: Make the fuchsia mojo/public repo the source of truth. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 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
« no previous file with comments | « mojo/public/go/bindings/stub.go ('k') | mojo/public/go/system/core.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/go/bindings/util.go
diff --git a/mojo/public/go/bindings/util.go b/mojo/public/go/bindings/util.go
deleted file mode 100644
index 3b40c64d523f8c5b14d1c731cabb0ceb35e9cda1..0000000000000000000000000000000000000000
--- a/mojo/public/go/bindings/util.go
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2015 The Chromium 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 bindings
-
-import (
- "sync/atomic"
-
- "mojo/public/go/system"
-)
-
-func align(size, alignment int) int {
- return ((size - 1) | (alignment - 1)) + 1
-}
-
-// bytesForBits returns minimum number of bytes required to store provided
-// number of bits.
-func bytesForBits(bits uint64) int {
- return int((bits + 7) / 8)
-}
-
-// WriteMessage writes a message to a message pipe.
-func WriteMessage(handle system.MessagePipeHandle, message *Message) error {
- result := handle.WriteMessage(message.Bytes, message.Handles, system.MOJO_WRITE_MESSAGE_FLAG_NONE)
- if result != system.MOJO_RESULT_OK {
- return &ConnectionError{result}
- }
- return nil
-}
-
-// StringPointer converts provided string to *string.
-func StringPointer(s string) *string {
- return &s
-}
-
-// Counter is a simple thread-safe lock-free counter that can issue unique
-// numbers starting from 1 to callers.
-type Counter interface {
- // Count returns next unused value, each value is returned only once.
- Count() uint64
-}
-
-// NewCounter return a new counter that returns numbers starting from 1.
-func NewCounter() Counter {
- return &counterImpl{}
-}
-
-// counterImpl implements Counter interface.
-// This implementation uses atomic operations on an uint64, it should be always
-// allocated separatelly to be 8-aligned in order to work correctly on ARM.
-// See http://golang.org/pkg/sync/atomic/#pkg-note-BUG.
-type counterImpl struct {
- last uint64
-}
-
-func (c *counterImpl) Count() uint64 {
- return atomic.AddUint64(&c.last, 1)
-}
« no previous file with comments | « mojo/public/go/bindings/stub.go ('k') | mojo/public/go/system/core.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698