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

Unified Diff: mojo/public/java/bindings/src/org/chromium/mojo/bindings/AutoCloseableRouter.java

Issue 814543006: Move //mojo/{public, edk} underneath //third_party (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 11 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: mojo/public/java/bindings/src/org/chromium/mojo/bindings/AutoCloseableRouter.java
diff --git a/mojo/public/java/bindings/src/org/chromium/mojo/bindings/AutoCloseableRouter.java b/mojo/public/java/bindings/src/org/chromium/mojo/bindings/AutoCloseableRouter.java
deleted file mode 100644
index 8a83be928e9e2babf7b6468c4ee7930e4d43f4d9..0000000000000000000000000000000000000000
--- a/mojo/public/java/bindings/src/org/chromium/mojo/bindings/AutoCloseableRouter.java
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright 2014 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 org.chromium.mojo.bindings;
-
-import org.chromium.mojo.system.Core;
-import org.chromium.mojo.system.MessagePipeHandle;
-
-import java.util.concurrent.Executor;
-
-/**
- * Wrapper around {@link Router} that will close the connection when not referenced anymore.
- */
-class AutoCloseableRouter implements Router {
-
- /**
- * The underlying router.
- */
- private final Router mRouter;
-
- /**
- * The executor to close the underlying router.
- */
- private final Executor mExecutor;
-
- /**
- * Flags to keep track if this router has been correctly closed.
- */
- private boolean mClosed;
-
- /**
- * Constructor.
- */
- public AutoCloseableRouter(Core core, Router router) {
- mRouter = router;
- mExecutor = ExecutorFactory.getExecutorForCurrentThread(core);
- }
-
- /**
- * @see Router#setIncomingMessageReceiver(MessageReceiverWithResponder)
- */
- @Override
- public void setIncomingMessageReceiver(MessageReceiverWithResponder incomingMessageReceiver) {
- mRouter.setIncomingMessageReceiver(incomingMessageReceiver);
- }
-
- /**
- * @see HandleOwner#passHandle()
- */
- @Override
- public MessagePipeHandle passHandle() {
- return mRouter.passHandle();
- }
-
- /**
- * @see MessageReceiver#accept(Message)
- */
- @Override
- public boolean accept(Message message) {
- return mRouter.accept(message);
- }
-
- /**
- * @see MessageReceiverWithResponder#acceptWithResponder(Message, MessageReceiver)
- */
- @Override
- public boolean acceptWithResponder(Message message, MessageReceiver responder) {
- return mRouter.acceptWithResponder(message, responder);
-
- }
-
- /**
- * @see Router#start()
- */
- @Override
- public void start() {
- mRouter.start();
- }
-
- /**
- * @see Router#setErrorHandler(ConnectionErrorHandler)
- */
- @Override
- public void setErrorHandler(ConnectionErrorHandler errorHandler) {
- mRouter.setErrorHandler(errorHandler);
- }
-
- /**
- * @see java.io.Closeable#close()
- */
- @Override
- public void close() {
- mRouter.close();
- mClosed = true;
- }
-
- /**
- * @see Object#finalize()
- */
- @Override
- protected void finalize() throws Throwable {
- if (!mClosed) {
- mExecutor.execute(new Runnable() {
-
- @Override
- public void run() {
- close();
- }
- });
- throw new IllegalStateException("Warning: Router objects should be explicitly closed " +
- "when no longer required otherwise you may leak handles.");
- }
- super.finalize();
- }
-}
« no previous file with comments | « mojo/public/java/BUILD.gn ('k') | mojo/public/java/bindings/src/org/chromium/mojo/bindings/BindingsHelper.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698