summaryrefslogtreecommitdiffstats
path: root/base/message_pump_glib.cc
Commit message (Collapse)AuthorAgeFilesLines
* Avoid including gtk & glib headers in message_pump_glib.h, saves 1 sec on ↵mattm@chromium.org2009-12-041-5/+9
| | | | | | | | | | | do-nothing make. TEST=manual browser test, trybots BUG=none Review URL: http://codereview.chromium.org/464031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33851 0039d316-1c4b-4281-b951-d872f2087c98
* This CL adds accelerators to the Linux toolkit views.jcampan@chromium.org2009-07-311-4/+13
| | | | | | | | | | | The MessageLoop had to be modified to support Dispatchers on Linux. BUG=None TEST=On Windows and Linux, make sure the accelerators still work as expected. On Linux toolkit views, build and run the unit-tests. Review URL: http://codereview.chromium.org/159046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22210 0039d316-1c4b-4281-b951-d872f2087c98
* Add tests for the GLib message pump.deanm@chromium.org2009-06-151-10/+10
| | | | | | | | | | | This CL also adds a few comment updates that were lost in CL 115812 submission. Patch by Antoine Labour. Review URL: http://codereview.chromium.org/118155 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18379 0039d316-1c4b-4281-b951-d872f2087c98
* linux: fix main loop issues with windowless pluginsevan@chromium.org2009-06-011-38/+91
| | | | | | | | | | | | | | | | | | In certain conditions (e.g. NPN_InvalidateRect taking long), the flash plugin runs its own event loop before returning. It looks roughly like this: while (gtk_events_pending()) { gtk_main_iteration(); } The problem is that our worker source used to force gtk_events_pending() to be always true, because the Check handler always returned TRUE (and that also made HandleDispatch to always run). That caused flash animations to stop and other bad behavior (100% CPU). This CL changes the Check function to return TRUE only if HandleDispatch should be run (i.e., more_work_is_plausible set to true), while also checking whether the loop was woken up, or the delayed work timer expired. HandlePrepare was forcing more_work_is_plausible to be always true apparently to avoid starvation. I removed this, I'm not sure why it is needed. If we get starvation issue, we should raise the priority of WorkSource (for reference, most events run at prio 0, except redraws that run at prio 120. WorkSource runs at prio 200). Another possibility is to force more_work_is_plausible but only every n calls to HandlePrepare. BUG=8202,11843,12278 Review URL: http://codereview.chromium.org/115812 Patch from Antoine Labour <piman@google.com>. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17357 0039d316-1c4b-4281-b951-d872f2087c98
* Adds DidProcessEvent to MessagePumpGLib.sky@chromium.org2009-05-191-0/+5
| | | | | | | | | BUG=none TEST=none Review URL: http://codereview.chromium.org/113600 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16429 0039d316-1c4b-4281-b951-d872f2087c98
* Adds an observer callback to Linux's MessagePumpForUI.sky@chromium.org2009-05-151-0/+21
| | | | | | | | | BUG=none TEST=none Review URL: http://codereview.chromium.org/112029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16204 0039d316-1c4b-4281-b951-d872f2087c98
* POSIX: Add a macro for handling EINTR.agl@chromium.org2009-05-011-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On POSIX systems, system calls can be interrupted by signals. In this case, they'll return EINTR, indicating that the system call needs to be restarted. (The situation is a little more complicated than this with SA_RESTART, but you can read man 7 signal if you like.) The short of it is that you need to catch EINTR and restart the call for these system calls: * read, readv, write, writev, ioctl * open() when dealing with a fifo * wait* * Anything socket based (send*, recv*, connect, accept etc) * flock and lock control with fcntl * mq_ functions which can block * futex * sem_wait (and timed wait) * pause, sigsuspend, sigtimedwait, sigwaitinfo * poll, epoll_wait, select and 'p' versions of the same * msgrcv, msgsnd, semop, semtimedop * close (although, on Linux, EINTR won't happen here) * any sleep functions (careful, you need to handle this are restart with different arguments) We've been a little sloppy with this until now. This patch adds a macro for dealing with this and corrects every case of these system calls (that I found). The macro is HANDLE_EINTR in base/eintr_wrapper.h. It's safe to include on Windows and is a no-op there. On POSIX, it uses GCC magic to return the correct type based on the expression and restarts the system call if it throws EINTR. And you can use it like: HANDLE_EINTR(close(fd)); Or: ssize_t bytes_read = HANDLE_EINTR(read(fd, buffer, len)); *BEWARE* that it will evaluate the argument multiple times, so this is not safe: HANDLE_EINTR(close(FireMissiles())); http://groups.google.com/group/chromium-dev/browse_thread/thread/41a35b2a457d73a0 http://codereview.chromium.org/100225 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15102 0039d316-1c4b-4281-b951-d872f2087c98
* NO CODE CHANGE (except one global std::wstring changed to const wchar_t* ↵maruel@chromium.org2009-03-031-1/+1
| | | | | | | | | | | const per style compliance). Preliminary work to enforce new PRESUBMIT.py rules: - <=80 cols - no trailing whitespaces - svn:eol-style=LF git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10791 0039d316-1c4b-4281-b951-d872f2087c98
* Use PlatformThreadId, not int when dealing with thread ids.agl@chromium.org2009-01-231-1/+1
| | | | | | | | | | | | | | | | | Windows uses a DWORD (unsigned long) for thread ids and POSIX uses a pid_t (int on Linux) for the same. In the code, we are currently stuffing thread ids into an int which is dangerous on Windows (because DWORDS can exceed an int and wrap) and will break if pid_t is ever != int. This change changes all the places where we currently have an int to use a new typedef, PlatformThreadId. This change also needs to occur for process ids, but I'm not doing that in this CL. Review URL: http://codereview.chromium.org/18677 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8525 0039d316-1c4b-4281-b951-d872f2087c98
* Fix the glib pump getting wedged.deanm@chromium.org2008-11-181-1/+25
| | | | | | | | I had previously used g_main_context_wakeup which uses glib's internal wakeup pipe. However, this won't ensure that our Dispatch method is called, so I think the poll() was returning, but our events never realized this so we kept on blocking infinitely. We need to make sure our Dispatch() is run when there is a wakeup, which means we have to use our own wakeup pipe so we can handle the event. Review URL: http://codereview.chromium.org/11432 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5590 0039d316-1c4b-4281-b951-d872f2087c98
* Restructure the the pump for nested loops.deanm@chromium.org2008-11-131-42/+71
| | | | | | | | Change our work dispatching to be based around an event source. This will allow us to still participate when a message loop is pumped by outside code (nested message loops). Review URL: http://codereview.chromium.org/10854 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5331 0039d316-1c4b-4281-b951-d872f2087c98
* Drop the wakeup pipe completely and use the builtin glib wakeup.deanm@chromium.org2008-11-121-29/+3
| | | | | | Review URL: http://codereview.chromium.org/10848 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5296 0039d316-1c4b-4281-b951-d872f2087c98
* Rewrite the glib UI pump. Although the previous pump was correct in terms ↵deanm@chromium.org2008-11-121-220/+125
| | | | | | | | of test coverage, it was mis-handling the concept of idle work. This meant we were effectively polling the pump, causing full CPU usage. The new pump is greatly simplified, and follows the pattern used on Windows. All tests still pass. Review URL: http://codereview.chromium.org/10833 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5278 0039d316-1c4b-4281-b951-d872f2087c98
* Review URL: http://codereview.chromium.org/8220dsh@google.com2008-11-041-5/+6
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4698 0039d316-1c4b-4281-b951-d872f2087c98
* Implement MessageLoopForUI using GLib. This gets some exercise fromdsh@google.com2008-10-031-0/+304
base_unittest. BUG=1319 Review URL: http://codereview.chromium.org/4261 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2834 0039d316-1c4b-4281-b951-d872f2087c98