| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MOJO_PUBLIC_PYTHON_SRC_COMMON_H_ | 5 #ifndef MOJO_PUBLIC_PYTHON_SRC_COMMON_H_ |
| 6 #define MOJO_PUBLIC_PYTHON_SRC_COMMON_H_ | 6 #define MOJO_PUBLIC_PYTHON_SRC_COMMON_H_ |
| 7 | 7 |
| 8 #include <Python.h> | 8 #include <Python.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 kAcquire, | 33 kAcquire, |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 class ScopedPyRef { | 36 class ScopedPyRef { |
| 37 public: | 37 public: |
| 38 explicit ScopedPyRef(PyObject* object); | 38 explicit ScopedPyRef(PyObject* object); |
| 39 ScopedPyRef(PyObject* object, ScopedPyRefAcquire); | 39 ScopedPyRef(PyObject* object, ScopedPyRefAcquire); |
| 40 | 40 |
| 41 ~ScopedPyRef(); | 41 ~ScopedPyRef(); |
| 42 | 42 |
| 43 // Releases ownership of the python object contained by this instance. |
| 44 PyObject* Release(); |
| 45 |
| 43 operator PyObject*() const; | 46 operator PyObject*() const; |
| 44 | 47 |
| 45 private: | 48 private: |
| 46 PyObject* object_; | 49 PyObject* object_; |
| 47 | 50 |
| 48 MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedPyRef); | 51 MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedPyRef); |
| 49 }; | 52 }; |
| 50 | 53 |
| 51 | 54 |
| 52 class PythonClosure : public mojo::Closure::Runnable { | 55 class PythonClosure : public mojo::Closure::Runnable { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 const mojo::Closure quit_; | 97 const mojo::Closure quit_; |
| 95 | 98 |
| 96 MOJO_DISALLOW_COPY_AND_ASSIGN(PythonAsyncWaiter); | 99 MOJO_DISALLOW_COPY_AND_ASSIGN(PythonAsyncWaiter); |
| 97 }; | 100 }; |
| 98 | 101 |
| 99 } // namespace python | 102 } // namespace python |
| 100 } // namespace mojo | 103 } // namespace mojo |
| 101 | 104 |
| 102 #endif // MOJO_PUBLIC_PYTHON_SRC_COMMON_H_ | 105 #endif // MOJO_PUBLIC_PYTHON_SRC_COMMON_H_ |
| 103 | 106 |
| OLD | NEW |