summaryrefslogtreecommitdiffstats
path: root/base/thread.cc
Commit message (Collapse)AuthorAgeFilesLines
* Implementation of Pipeline and FilterHost interfaces. This is a large ↵ralphl@chromium.org2009-01-281-2/+5
| | | | | | | | | | | | change, but all of the objects are interrelated. I am also checking in a basic unit test that creates pipeline, and the data source hangs during initialization. The test sleeps one second and then stops the pipeline. Andrew has already done a first pass on this, and the code has come largely from our working experimental branch. Review URL: http://codereview.chromium.org/18546 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8805 0039d316-1c4b-4281-b951-d872f2087c98
* Moved Init() before startup_data_->event.Signal() because derivedjrg@chromium.org2009-01-271-3/+4
| | | | | | | | | | | | | | | classes may not be safe to use until Init() has been called. As an example, RenderThread() creates it's IPC::SyncChannel in Init(), so it isn't safe to call Send() method until after. Update use of a Thread (hit with ui_tests) to no longer require Init() be called after the startup event is signaled (required old thread behavior). Ran a bunch more tests on Windows to try harder to make sure I didn't break anything. Review URL: http://codereview.chromium.org/18824 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8695 0039d316-1c4b-4281-b951-d872f2087c98
* Review URL: http://codereview.chromium.org/18690jrg@chromium.org2009-01-221-4/+3
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8506 0039d316-1c4b-4281-b951-d872f2087c98
* Moved Init() startup_data_->event.Signal() because derived classes mayjrg@chromium.org2009-01-221-3/+4
| | | | | | | | | | | | not be safe to use until Init() has been called. As an example, RenderThread() creates it's IPC::SyncChannel in Init(), so it isn't safe to call Send() method until after. Change tested explicitly on Mac Win Linux. Review URL: http://codereview.chromium.org/18508 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8485 0039d316-1c4b-4281-b951-d872f2087c98
* Reapply 5971 which was reverted in 5974. The unit test wasn't unregistering ↵maruel@chromium.org2008-12-011-3/+0
| | | | | | | | the observer correctly. Review URL: http://codereview.chromium.org/12474 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6142 0039d316-1c4b-4281-b951-d872f2087c98
* Reverting 5971.maruel@chromium.org2008-11-251-0/+3
| | | | | | Review URL: http://codereview.chromium.org/12637 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5974 0039d316-1c4b-4281-b951-d872f2087c98
* Add superficial unit test for PrintJob. That's a start.maruel@chromium.org2008-11-251-3/+0
| | | | | | | | Add more DCHECKs. Same as r5607 except that Thread.StopSoon is fixed. Review URL: http://codereview.chromium.org/11534 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5971 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 5607 because it caused a base_unittest failure.maruel@chromium.org2008-11-181-0/+3
| | | | | | Review URL: http://codereview.chromium.org/11234 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5608 0039d316-1c4b-4281-b951-d872f2087c98
* Add superficial unit test for PrintJob. That's a start.maruel@chromium.org2008-11-181-3/+0
| | | | | | | Add more DCHECKs. Review URL: http://codereview.chromium.org/10957 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5607 0039d316-1c4b-4281-b951-d872f2087c98
* Move a bunch of code from the old to new TLS interface.deanm@chromium.org2008-09-101-11/+7
| | | | | | Review URL: http://codereview.chromium.org/1660 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1982 0039d316-1c4b-4281-b951-d872f2087c98
* Add ThreadLocalPointer and ThreadLocalBoolean abstractions, that will ↵deanm@google.com2008-09-031-8/+14
| | | | | | deprecate the old ThreadLocalStorage / TLSSlot APIs. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1678 0039d316-1c4b-4281-b951-d872f2087c98
* fix linux builddarin@google.com2008-08-261-1/+1
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1364 0039d316-1c4b-4281-b951-d872f2087c98
* Allow consumers of MessageLoop to specify the type of MessageLoop they want.darin@google.com2008-08-261-25/+42
| | | | | | | | | | | | | | | | This CL introduces a Type enum to MessageLoop, and I also created subclasses of MessageLoop corresponding to the non-default types: MessageLoopForIO and MessageLoopForUI. I moved all of the platform-specific MessageLoop APIs onto either MessageLoopForIO or MessageLoopForUI. MessageLoopForIO gets the Watcher API, and MessageLoopForUI gets the Observer and Dispatcher APIs. Under the hood, both are implemented in terms of MessagePumpWin, but that will change in a future CL. The Thread class is changed to allow the consumer to specify the Type of MessageLoop they want to have setup on the created thread. I re-organized message_loop_unittest.cc and timer_unittest.cc so that I could exercise all (or most) of the tests against each type of MessageLoop. Note: I know that "explicit MessageLoop(Type type = TYPE_DEFAULT);" is in violation to the style-guide's restriction against default arguments. I'm working on finding a decent solution to that problem. Please ignore this issue for now. The corresponding chrome/ changes are coming in a separate CL due to Reitveld data size limitations. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1362 0039d316-1c4b-4281-b951-d872f2087c98
* Make PlatformThread::SetName operate only on the current thread.deanm@google.com2008-08-251-1/+1
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1306 0039d316-1c4b-4281-b951-d872f2087c98
* Use a more compact license header in source files.license.bot2008-08-241-28/+4
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1287 0039d316-1c4b-4281-b951-d872f2087c98
* Port the Thread class properly to Mac and Linux. This involved portingdarin@google.com2008-08-211-106/+44
| | | | | | | | | | | | PlatformThread and creating an API on PlatformThread to create a native thread and later join with it. I also made a few other tweaks to PlatformThread, such as eliminating the Current() method which appears to be unused. The operator==() is also unused, so I killed it as well. I made a few other miscellaneous cleanups and adjustments. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1146 0039d316-1c4b-4281-b951-d872f2087c98
* TrackedObjects assumes you can use a "TLS slot" of -1 to indicate ↵evanm@google.com2008-08-201-4/+4
| | | | | | uninitialized. This isn't true for the pthread_key_t type, which is unsigned on Linux and reportedly a struct on Macs. This change modifies the Slot type to be a struct containing an "initialized" flag. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1122 0039d316-1c4b-4281-b951-d872f2087c98
* Revert. Failing unit tests.evanm@google.com2008-08-201-4/+4
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1118 0039d316-1c4b-4281-b951-d872f2087c98
* TrackedObjects assumes you can use a "TLS slot" of -1 to indicate ↵evanm@google.com2008-08-201-4/+4
| | | | | | uninitialized. This isn't true for the pthread_key_t type, which is unsigned on Linux and reportedly a struct on Macs. This change modifies the Slot type to be a struct containing an "initialized" flag. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1113 0039d316-1c4b-4281-b951-d872f2087c98
* Introduce MessagePump to represent the native message pump used to drive adarin@google.com2008-08-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MessageLoop. A MessageLoop now has a MessagePump. This will make it possible to port the MessagePump interface to other platforms as well as to use an IO completion port for our worker threads on Windows. Currently, there is only MessagePumpWin, which attempts to preserve the pre-existing behavior of the MessageLoop. API changes to MessageLoop: 1. MessageLoop::Quit means return from Run when the MessageLoop would otherwise wait for more work. 2. MessageLoop::Quit can no longer be called outside the context of an active Run call. So, things like this: MessageLoop::current()->Quit(); MessageLoop::current()->Run(); are now: MessageLoop::current()->RunAllPending(); 3. MessageLoop::Quit can no longer be called from other threads. This means that PostTask(..., new MessageLoop::QuitTask()) must be used explicitly to Quit across thread boundaries. 4. No protection is made to deal with nested MessageLoops involving watched objects or APCs. In fact, an assertion is added to flag such cases. This is a temporary measure until object watching and APC facilities are removed in favor of a MessagePump designed around an IO completion port. As part of this CL, I also changed the automation system to use an IPC::ChannelProxy instead of an IPC::Channel. This moves the automation IPC onto Chrome's IO thread where it belongs. I also fixed some abuses of RefCounted in the AutomationProvider class. It was deleting itself in some cases! This led to having to fix the ownership model for AutomationProvider, which explains the changes to AutomationProviderList and so on. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@928 0039d316-1c4b-4281-b951-d872f2087c98
* - Add Thread::StopSoon() and remove Thread::NonBlockingStop(). StopSoon() ↵maruel@google.com2008-08-121-52/+34
| | | | | | | | | | | | can't be implemented externally of the Thread class where NonBlockingStop() was really just an helper function solely used in printing. - Move two member functions access from public to protected. - Add documentation about which thread modifies which member variable. - Simplify ThreadStartInfo. This removes one heap allocation. - Improve unit test coverage. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@728 0039d316-1c4b-4281-b951-d872f2087c98
* Provide cross-platform implementation of WaitableEvent for use on Mac and Linux.darin@google.com2008-08-111-10/+5
| | | | | | | | | I gave the file the suffix _generic since it is implemented entirely in terms of other APIs in base. This CL also adds a simple unit test for WaitableEvent, and I switched some code in thread.cc over to using WaitableEvent. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@648 0039d316-1c4b-4281-b951-d872f2087c98
* Port in threading for Posix. Will require fixes to MessageLoop and Task to ↵avi@google.com2008-08-071-1/+1
| | | | | | compile on the Mac, though. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@532 0039d316-1c4b-4281-b951-d872f2087c98
* Revise the ObjectWatcher API to be one-to-one with the object being watched. ↵darin@google.com2008-08-041-10/+10
| | | | | | | | | | | | This greatly simplifies the implementation and API. Now consumers can use ObjectWatcher as a "smart pointer" class, which automatically cleans-up after itself when it goes out of scope. I also switched away from the Task based API to one that is more compatible with MessageLoop::WatchObject. That allows me to make minimal changes to existing code, and it also means that consumers do not have to allocate Task objects to use this API. In this CL, I included changes to make a couple consumers use ObjectWatcher instead of ML::WatchObject. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@322 0039d316-1c4b-4281-b951-d872f2087c98
* Fix most issues when building base as a x64 target.maruel@google.com2008-07-301-1/+1
| | | | | | BUG=1282556 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112 0039d316-1c4b-4281-b951-d872f2087c98
* Add base to the repository.initial.commit2008-07-261-0/+258
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8 0039d316-1c4b-4281-b951-d872f2087c98