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

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

Issue 617503003: Mojo: MOJO_OVERRIDE -> override in mojo/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 6 years, 2 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 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 #include "mojo/public/python/src/python_system_helper.h" 5 #include "mojo/public/python/src/python_system_helper.h"
6 6
7 #include "Python.h" 7 #include "Python.h"
8 8
9 #include "mojo/public/cpp/environment/environment.h" 9 #include "mojo/public/cpp/environment/environment.h"
10 #include "mojo/public/cpp/environment/logging.h" 10 #include "mojo/public/cpp/environment/logging.h"
(...skipping 19 matching lines...) Expand all
30 PythonClosure(PyObject* callable) : callable_(callable) { 30 PythonClosure(PyObject* callable) : callable_(callable) {
31 MOJO_DCHECK(callable); 31 MOJO_DCHECK(callable);
32 Py_XINCREF(callable); 32 Py_XINCREF(callable);
33 } 33 }
34 34
35 virtual ~PythonClosure() { 35 virtual ~PythonClosure() {
36 ScopedGIL acquire_gil; 36 ScopedGIL acquire_gil;
37 Py_DECREF(callable_); 37 Py_DECREF(callable_);
38 } 38 }
39 39
40 virtual void Run() const MOJO_OVERRIDE { 40 virtual void Run() const override {
41 ScopedGIL acquire_gil; 41 ScopedGIL acquire_gil;
42 PyObject* empty_tuple = PyTuple_New(0); 42 PyObject* empty_tuple = PyTuple_New(0);
43 if (!empty_tuple) { 43 if (!empty_tuple) {
44 mojo::RunLoop::current()->Quit(); 44 mojo::RunLoop::current()->Quit();
45 return; 45 return;
46 } 46 }
47 47
48 PyObject* result = PyObject_CallObject(callable_, empty_tuple); 48 PyObject* result = PyObject_CallObject(callable_, empty_tuple);
49 Py_DECREF(empty_tuple); 49 Py_DECREF(empty_tuple);
50 if (result) { 50 if (result) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 Py_XINCREF(callable); 83 Py_XINCREF(callable);
84 } 84 }
85 85
86 virtual ~AsyncWaiterRunnable() { 86 virtual ~AsyncWaiterRunnable() {
87 ScopedGIL acquire_gil; 87 ScopedGIL acquire_gil;
88 Py_DECREF(callable_); 88 Py_DECREF(callable_);
89 } 89 }
90 90
91 void set_wait_id(int wait_id) { wait_id_ = wait_id; } 91 void set_wait_id(int wait_id) { wait_id_ = wait_id; }
92 92
93 virtual void Run(MojoResult mojo_result) const MOJO_OVERRIDE { 93 virtual void Run(MojoResult mojo_result) const override {
94 MOJO_DCHECK(wait_id_); 94 MOJO_DCHECK(wait_id_);
95 95
96 // Remove to reference to this object from PythonAsyncWaiter and ensure this 96 // Remove to reference to this object from PythonAsyncWaiter and ensure this
97 // object will be destroyed when this method exits. 97 // object will be destroyed when this method exits.
98 MOJO_DCHECK(callbacks_->find(wait_id_) != callbacks_->end()); 98 MOJO_DCHECK(callbacks_->find(wait_id_) != callbacks_->end());
99 internal::SharedPtr<mojo::Callback<void(MojoResult)> > self = 99 internal::SharedPtr<mojo::Callback<void(MojoResult)> > self =
100 (*callbacks_)[wait_id_]; 100 (*callbacks_)[wait_id_];
101 callbacks_->erase(wait_id_); 101 callbacks_->erase(wait_id_);
102 102
103 ScopedGIL acquire_gil; 103 ScopedGIL acquire_gil;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 162
163 void PythonAsyncWaiter::CancelWait(MojoAsyncWaitID wait_id) { 163 void PythonAsyncWaiter::CancelWait(MojoAsyncWaitID wait_id) {
164 if (callbacks_.find(wait_id) != callbacks_.end()) { 164 if (callbacks_.find(wait_id) != callbacks_.end()) {
165 async_waiter_->CancelWait(wait_id); 165 async_waiter_->CancelWait(wait_id);
166 callbacks_.erase(wait_id); 166 callbacks_.erase(wait_id);
167 } 167 }
168 } 168 }
169 169
170 } // namespace python 170 } // namespace python
171 } // namespace mojo 171 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698