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

Unified Diff: mojo/public/cpp/bindings/lib/sync_handle_watcher.h

Issue 2114523002: Move more Mojo bindings helpers out of internal namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@group-controller
Patch Set: rebase Created 4 years, 6 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/cpp/bindings/lib/router.cc ('k') | mojo/public/cpp/bindings/lib/sync_handle_watcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/sync_handle_watcher.h
diff --git a/mojo/public/cpp/bindings/lib/sync_handle_watcher.h b/mojo/public/cpp/bindings/lib/sync_handle_watcher.h
deleted file mode 100644
index dcba8b9dec4455ea2c1dfdcddcc5744bea2824c8..0000000000000000000000000000000000000000
--- a/mojo/public/cpp/bindings/lib/sync_handle_watcher.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2016 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.
-
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_SYNC_HANDLE_WATCHER_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_SYNC_HANDLE_WATCHER_H_
-
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/threading/thread_checker.h"
-#include "mojo/public/cpp/bindings/sync_handle_registry.h"
-#include "mojo/public/cpp/system/core.h"
-
-namespace mojo {
-namespace internal {
-
-// SyncHandleWatcher supports watching a handle synchronously. It also supports
-// registering the handle with a thread-local storage (SyncHandleRegistry), so
-// that when other SyncHandleWatcher instances on the same thread perform sync
-// handle watching, this handle will be watched together.
-//
-// SyncHandleWatcher is used for sync methods. While a sync call is waiting for
-// response, we would like to block the thread. On the other hand, we need
-// incoming sync method requests on the same thread to be able to reenter. We
-// also need master interface endpoints to continue dispatching messages for
-// associated endpoints on different threads.
-//
-// This class is not thread safe.
-class SyncHandleWatcher {
- public:
- // Note: |handle| must outlive this object.
- SyncHandleWatcher(const Handle& handle,
- MojoHandleSignals handle_signals,
- const SyncHandleRegistry::HandleCallback& callback);
-
- ~SyncHandleWatcher();
-
- // Registers |handle_| with SyncHandleRegistry, so that when others perform
- // sync handle watching on the same thread, |handle_| will be watched
- // together.
- void AllowWokenUpBySyncWatchOnSameThread();
-
- // Waits on |handle_| plus all handles registered with SyncHandleRegistry and
- // runs callbacks synchronously for those ready handles.
- // This method:
- // - returns true when |should_stop| is set to true;
- // - return false when any error occurs, including this object being
- // destroyed during a callback.
- bool SyncWatch(const bool* should_stop);
-
- private:
- void IncrementRegisterCount();
- void DecrementRegisterCount();
-
- const Handle handle_;
- const MojoHandleSignals handle_signals_;
- SyncHandleRegistry::HandleCallback callback_;
-
- // Whether |handle_| has been registered with SyncHandleRegistry.
- bool registered_;
- // If non-zero, |handle_| should be registered with SyncHandleRegistry.
- size_t register_request_count_;
-
- scoped_refptr<SyncHandleRegistry> registry_;
-
- scoped_refptr<base::RefCountedData<bool>> destroyed_;
-
- base::ThreadChecker thread_checker_;
-
- DISALLOW_COPY_AND_ASSIGN(SyncHandleWatcher);
-};
-
-} // namespace internal
-} // namespace mojo
-
-#endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_SYNC_HANDLE_WATCHER_H_
« no previous file with comments | « mojo/public/cpp/bindings/lib/router.cc ('k') | mojo/public/cpp/bindings/lib/sync_handle_watcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698