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

Side by Side Diff: mojo/public/python/src/common.cc

Issue 855043003: Revert "Content handler for python." (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "mojo/public/python/src/common.h" 5 #include "mojo/public/python/src/common.h"
6 6
7 #include <Python.h> 7 #include <Python.h>
8 8
9 #include "mojo/public/c/environment/async_waiter.h" 9 #include "mojo/public/c/environment/async_waiter.h"
10 #include "mojo/public/cpp/bindings/callback.h" 10 #include "mojo/public/cpp/bindings/callback.h"
(...skipping 26 matching lines...) Expand all
37 } 37 }
38 38
39 ScopedPyRef::ScopedPyRef(PyObject* object) : object_(object) { 39 ScopedPyRef::ScopedPyRef(PyObject* object) : object_(object) {
40 } 40 }
41 41
42 ScopedPyRef::ScopedPyRef(PyObject* object, ScopedPyRefAcquire) 42 ScopedPyRef::ScopedPyRef(PyObject* object, ScopedPyRefAcquire)
43 : object_(object) { 43 : object_(object) {
44 Py_XINCREF(object_); 44 Py_XINCREF(object_);
45 } 45 }
46 46
47 PyObject* ScopedPyRef::Release() {
48 PyObject* object = object_;
49 object_ = nullptr;
50 return object;
51 }
52
53 ScopedPyRef::~ScopedPyRef() { 47 ScopedPyRef::~ScopedPyRef() {
54 if (object_) { 48 if (object_) {
55 ScopedGIL acquire_gil; 49 ScopedGIL acquire_gil;
56 Py_DECREF(object_); 50 Py_DECREF(object_);
57 } 51 }
58 } 52 }
59 53
60 ScopedPyRef::operator PyObject*() const { 54 ScopedPyRef::operator PyObject*() const {
61 return object_; 55 return object_;
62 } 56 }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 164
171 void PythonAsyncWaiter::CancelWait(MojoAsyncWaitID wait_id) { 165 void PythonAsyncWaiter::CancelWait(MojoAsyncWaitID wait_id) {
172 if (callbacks_.find(wait_id) != callbacks_.end()) { 166 if (callbacks_.find(wait_id) != callbacks_.end()) {
173 async_waiter_->CancelWait(wait_id); 167 async_waiter_->CancelWait(wait_id);
174 callbacks_.erase(wait_id); 168 callbacks_.erase(wait_id);
175 } 169 }
176 } 170 }
177 171
178 } // namespace python 172 } // namespace python
179 } // namespace mojo 173 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/python/src/common.h ('k') | mojo/public/tools/bindings/generators/mojom_python_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698