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

Side by Side Diff: mojo/python/content_handler/mojo_system_impl.pyx

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
(Empty)
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
3 # found in the LICENSE file.
4
5 # distutils language = c++
6
7 cimport c_async_waiter
8 cimport c_base
9 cimport c_export
10
11 from libc.stdint cimport uintptr_t
12
13
14 cdef class RunLoop(object):
15 """RunLoop to use when using asynchronous operations on handles."""
16
17 cdef c_base.PythonRunLoop* c_run_loop
18
19 def __init__(self):
20 self.c_run_loop = new c_base.PythonRunLoop()
21
22 def __dealloc__(self):
23 del self.c_run_loop
24
25 def Run(self):
26 """Run the runloop until Quit is called."""
27 self.c_run_loop.Run()
28
29 def RunUntilIdle(self):
30 """Run the runloop until Quit is called or no operation is waiting."""
31 self.c_run_loop.RunUntilIdle()
32
33 def Quit(self):
34 """Quit the runloop."""
35 self.c_run_loop.Quit()
36
37 def PostDelayedTask(self, runnable, delay=0):
38 """
39 Post a task on the runloop. This must be called from the thread owning the
40 runloop.
41 """
42 self.c_run_loop.PostDelayedTask(runnable, delay)
43
44
45 # We use a wrapping class to be able to call the C++ class PythonAsyncWaiter
46 # across module boundaries.
47 cdef class AsyncWaiter(object):
48 cdef c_async_waiter.PythonAsyncWaiter* _c_async_waiter
49
50 def __init__(self):
51 self._c_async_waiter = c_base.NewAsyncWaiter()
52
53 def __dealloc__(self):
54 del self._c_async_waiter
55
56 def AsyncWait(self, handle, signals, deadline, callback):
57 return self._c_async_waiter.AsyncWait(handle, signals, deadline, callback)
58
59 def CancelWait(self, wait_id):
60 self._c_async_waiter.CancelWait(wait_id)
OLDNEW
« no previous file with comments | « mojo/python/content_handler/content_handler_main.cc ('k') | mojo/python/content_handler/python_system_impl_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698