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

Side by Side Diff: mojo/python/content_handler/python_system_impl_helper.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
« no previous file with comments | « mojo/python/content_handler/python_system_impl_helper.h ('k') | mojo/tools/data/apptests » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "python_system_impl_helper.h"
6
7 #include <Python.h>
8
9 #include "base/bind.h"
10 #include "base/location.h"
11 #include "mojo/common/message_pump_mojo.h"
12 #include "mojo/public/python/src/common.h"
13
14 namespace {
15 class QuitCurrentRunLoop : public mojo::Closure::Runnable {
16 public:
17 void Run() const override {
18 base::MessageLoop::current()->Quit();
19 }
20
21 static mojo::Closure::Runnable* NewInstance() {
22 return new QuitCurrentRunLoop();
23 }
24 };
25
26 } // namespace
27 namespace mojo {
28 namespace python {
29
30 PythonRunLoop::PythonRunLoop() : loop_(common::MessagePumpMojo::Create()) {
31 }
32
33 PythonRunLoop::~PythonRunLoop() {
34 }
35
36 void PythonRunLoop::Run() {
37 loop_.Run();
38 }
39
40 void PythonRunLoop::RunUntilIdle() {
41 loop_.RunUntilIdle();
42 }
43
44 void PythonRunLoop::Quit() {
45 loop_.Quit();
46 }
47
48 void PythonRunLoop::PostDelayedTask(PyObject* callable, MojoTimeTicks delay) {
49 Closure::Runnable* quit_runnable =
50 NewRunnableFromCallable(callable, loop_.QuitClosure());
51
52 loop_.PostDelayedTask(
53 FROM_HERE, base::Bind(&mojo::Closure::Run,
54 base::Owned(new mojo::Closure(quit_runnable))),
55 base::TimeDelta::FromMicroseconds(delay));
56 }
57
58 PythonAsyncWaiter* NewAsyncWaiter() {
59 return new PythonAsyncWaiter(
60 mojo::Closure(QuitCurrentRunLoop::NewInstance()));
61 }
62
63 } // namespace python
64 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/python/content_handler/python_system_impl_helper.h ('k') | mojo/tools/data/apptests » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698