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

Unified Diff: third_party/mojo/src/mojo/public/go/bindings/router.go

Issue 1019173002: Update mojo sdk to rev 7214b7ec7d27563b2666afad86cf1c5895c56c18 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Keep permission service alive if embedder drops requests Created 5 years, 9 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/mojo/src/mojo/public/go/bindings/router.go
diff --git a/third_party/mojo/src/mojo/public/go/bindings/router.go b/third_party/mojo/src/mojo/public/go/bindings/router.go
index 84a5d3c0dbd0f78d32327e2b57d2ed8588610d0b..64849455103ac7b01c67330967999dbdda219886 100644
--- a/third_party/mojo/src/mojo/public/go/bindings/router.go
+++ b/third_party/mojo/src/mojo/public/go/bindings/router.go
@@ -120,6 +120,8 @@ type Router struct {
// Channel to communicate with worker.
requestChan chan<- routeRequest
+ // Makes sure that the done channel is closed once.
+ closeOnce sync.Once
// Channel to stop the worker.
done chan<- struct{}
}
@@ -147,10 +149,11 @@ func NewRouter(handle system.MessagePipeHandle, waiter AsyncWaiter) *Router {
}
// Close closes the router and the underlying message pipe. All new incoming
-// requests are returned with an error. Panics if you try to close the router
-// more than once.
+// requests are returned with an error.
func (r *Router) Close() {
- close(r.done)
+ r.closeOnce.Do(func() {
+ close(r.done)
+ })
}
// Accept sends a message to the message pipe. The message should have a
« no previous file with comments | « third_party/mojo/src/mojo/public/go/bindings/message.go ('k') | third_party/mojo/src/mojo/public/go/bindings/stub.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698