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

Unified Diff: mojo/public/python/src/common.h

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/python/rules.gni ('k') | mojo/public/python/src/common.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/python/src/common.h
diff --git a/mojo/public/python/src/common.h b/mojo/public/python/src/common.h
deleted file mode 100644
index 230a70b5cbebfd3831854e1b1f92620036d60205..0000000000000000000000000000000000000000
--- a/mojo/public/python/src/common.h
+++ /dev/null
@@ -1,109 +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.
-
-#ifndef MOJO_PUBLIC_PYTHON_SRC_COMMON_H_
-#define MOJO_PUBLIC_PYTHON_SRC_COMMON_H_
-
-#include <mojo/environment/async_waiter.h>
-#include <mojo/system/handle.h>
-#include <mojo/system/time.h>
-#include <Python.h>
-
-#include <map>
-
-#include "mojo/public/cpp/bindings/callback.h"
-#include "mojo/public/cpp/bindings/lib/shared_ptr.h"
-#include "mojo/public/cpp/system/macros.h"
-
-namespace mojo {
-namespace python {
-
-class ScopedGIL {
- public:
- ScopedGIL();
-
- ~ScopedGIL();
-
- private:
- PyGILState_STATE state_;
-
- MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedGIL);
-};
-
-enum ScopedPyRefAcquire {
- kAcquire,
-};
-
-class ScopedPyRef {
- public:
- explicit ScopedPyRef(PyObject* object);
- ScopedPyRef(PyObject* object, ScopedPyRefAcquire);
- ScopedPyRef(const ScopedPyRef& other);
-
- ~ScopedPyRef();
-
- // Releases ownership of the python object contained by this instance.
- PyObject* Release();
-
- operator PyObject*() const { return object_; }
-
- ScopedPyRef& operator=(const ScopedPyRef& other);
-
- private:
- PyObject* object_;
-};
-
-
-class PythonClosure : public mojo::Closure::Runnable {
- public:
- PythonClosure(PyObject* callable, const mojo::Closure& quit);
- ~PythonClosure() override;
-
- void Run() const override;
-
- private:
- ScopedPyRef callable_;
- const mojo::Closure quit_;
-
- MOJO_DISALLOW_COPY_AND_ASSIGN(PythonClosure);
-};
-
-// Create a mojo::Closure from a callable python object.
-Closure::Runnable* NewRunnableFromCallable(PyObject* callable,
- const Closure& quit_closure);
-
-// AsyncWaiter for python, used to execute a python closure after waiting. If an
-// error occurs while executing the closure, the current message loop will be
-// exited. See |AsyncWaiter| in mojo/public/c/environment/async_waiter.h for
-// more details.
-class PythonAsyncWaiter {
- public:
- explicit PythonAsyncWaiter(const mojo::Closure& quit_closure);
- ~PythonAsyncWaiter();
- MojoAsyncWaitID AsyncWait(MojoHandle handle,
- MojoHandleSignals signals,
- MojoDeadline deadline,
- PyObject* callable);
-
- void CancelWait(MojoAsyncWaitID wait_id);
-
- private:
- class AsyncWaiterRunnable;
-
- typedef std::map<MojoAsyncWaitID,
- internal::SharedPtr<mojo::Callback<void(MojoResult)> > >
- CallbackMap;
-
- CallbackMap callbacks_;
- const MojoAsyncWaiter* async_waiter_;
- const mojo::Closure quit_;
-
- MOJO_DISALLOW_COPY_AND_ASSIGN(PythonAsyncWaiter);
-};
-
-} // namespace python
-} // namespace mojo
-
-#endif // MOJO_PUBLIC_PYTHON_SRC_COMMON_H_
-
« no previous file with comments | « mojo/public/python/rules.gni ('k') | mojo/public/python/src/common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698