| 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 | |
| 46 operator PyObject*() const; | 43 operator PyObject*() const; |
| 47 | 44 |
| 48 private: | 45 private: |
| 49 PyObject* object_; | 46 PyObject* object_; |
| 50 | 47 |
| 51 MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedPyRef); | 48 MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedPyRef); |
| 52 }; | 49 }; |
| 53 | 50 |
| 54 | 51 |
| 55 class PythonClosure : public mojo::Closure::Runnable { | 52 class PythonClosure : public mojo::Closure::Runnable { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 const mojo::Closure quit_; | 94 const mojo::Closure quit_; |
| 98 | 95 |
| 99 MOJO_DISALLOW_COPY_AND_ASSIGN(PythonAsyncWaiter); | 96 MOJO_DISALLOW_COPY_AND_ASSIGN(PythonAsyncWaiter); |
| 100 }; | 97 }; |
| 101 | 98 |
| 102 } // namespace python | 99 } // namespace python |
| 103 } // namespace mojo | 100 } // namespace mojo |
| 104 | 101 |
| 105 #endif // MOJO_PUBLIC_PYTHON_SRC_COMMON_H_ | 102 #endif // MOJO_PUBLIC_PYTHON_SRC_COMMON_H_ |
| 106 | 103 |
| OLD | NEW |