summaryrefslogtreecommitdiffstats
path: root/base/threading
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-11 00:50:59 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-11 00:50:59 +0000
commiteae9c0623d1800201739b4be146649103a45cd93 (patch)
tree2ce42f83e18d8a0a618ffd6dbe69b1acade5bda4 /base/threading
parent26f0821d0a34a79e551213d56054366aab6c70f7 (diff)
downloadchromium_src-eae9c0623d1800201739b4be146649103a45cd93.zip
chromium_src-eae9c0623d1800201739b4be146649103a45cd93.tar.gz
chromium_src-eae9c0623d1800201739b4be146649103a45cd93.tar.bz2
Order function definitions in base/ according to the header.
BUG=68682 TEST=compiles Review URL: http://codereview.chromium.org/6085015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70975 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/threading')
-rw-r--r--base/threading/simple_thread.cc32
-rw-r--r--base/threading/thread.cc46
2 files changed, 39 insertions, 39 deletions
diff --git a/base/threading/simple_thread.cc b/base/threading/simple_thread.cc
index 2b030f6..4441477 100644
--- a/base/threading/simple_thread.cc
+++ b/base/threading/simple_thread.cc
@@ -10,6 +10,22 @@
namespace base {
+SimpleThread::SimpleThread(const std::string& name_prefix)
+ : name_prefix_(name_prefix), name_(name_prefix),
+ thread_(), event_(true, false), tid_(0), joined_(false) {
+}
+
+SimpleThread::SimpleThread(const std::string& name_prefix,
+ const Options& options)
+ : name_prefix_(name_prefix), name_(name_prefix), options_(options),
+ thread_(), event_(true, false), tid_(0), joined_(false) {
+}
+
+SimpleThread::~SimpleThread() {
+ DCHECK(HasBeenStarted()) << "SimpleThread was never started.";
+ DCHECK(HasBeenJoined()) << "SimpleThread destroyed without being Join()ed.";
+}
+
void SimpleThread::Start() {
DCHECK(!HasBeenStarted()) << "Tried to Start a thread multiple times.";
bool success = PlatformThread::Create(options_.stack_size(), this, &thread_);
@@ -37,22 +53,6 @@ void SimpleThread::ThreadMain() {
Run();
}
-SimpleThread::SimpleThread(const std::string& name_prefix)
- : name_prefix_(name_prefix), name_(name_prefix),
- thread_(), event_(true, false), tid_(0), joined_(false) {
-}
-
-SimpleThread::SimpleThread(const std::string& name_prefix,
- const Options& options)
- : name_prefix_(name_prefix), name_(name_prefix), options_(options),
- thread_(), event_(true, false), tid_(0), joined_(false) {
-}
-
-SimpleThread::~SimpleThread() {
- DCHECK(HasBeenStarted()) << "SimpleThread was never started.";
- DCHECK(HasBeenJoined()) << "SimpleThread destroyed without being Join()ed.";
-}
-
DelegateSimpleThread::DelegateSimpleThread(Delegate* delegate,
const std::string& name_prefix)
: SimpleThread(name_prefix),
diff --git a/base/threading/thread.cc b/base/threading/thread.cc
index 09f8847..c0fb537 100644
--- a/base/threading/thread.cc
+++ b/base/threading/thread.cc
@@ -11,6 +11,17 @@
namespace base {
+namespace {
+
+// We use this thread-local variable to record whether or not a thread exited
+// because its Stop method was called. This allows us to catch cases where
+// MessageLoop::Quit() is called directly, which is unexpected when using a
+// Thread to setup and run a MessageLoop.
+base::LazyInstance<base::ThreadLocalBoolean> lazy_tls_bool(
+ base::LINKER_INITIALIZED);
+
+} // namespace
+
// This task is used to trigger the message loop to exit.
class ThreadQuitTask : public Task {
public:
@@ -48,29 +59,6 @@ Thread::~Thread() {
Stop();
}
-namespace {
-
-// We use this thread-local variable to record whether or not a thread exited
-// because its Stop method was called. This allows us to catch cases where
-// MessageLoop::Quit() is called directly, which is unexpected when using a
-// Thread to setup and run a MessageLoop.
-base::LazyInstance<base::ThreadLocalBoolean> lazy_tls_bool(
- base::LINKER_INITIALIZED);
-
-} // namespace
-
-void Thread::SetThreadWasQuitProperly(bool flag) {
- lazy_tls_bool.Pointer()->Set(flag);
-}
-
-bool Thread::GetThreadWasQuitProperly() {
- bool quit_properly = true;
-#ifndef NDEBUG
- quit_properly = lazy_tls_bool.Pointer()->Get();
-#endif
- return quit_properly;
-}
-
bool Thread::Start() {
return StartWithOptions(Options());
}
@@ -140,6 +128,18 @@ void Thread::Run(MessageLoop* message_loop) {
message_loop->Run();
}
+void Thread::SetThreadWasQuitProperly(bool flag) {
+ lazy_tls_bool.Pointer()->Set(flag);
+}
+
+bool Thread::GetThreadWasQuitProperly() {
+ bool quit_properly = true;
+#ifndef NDEBUG
+ quit_properly = lazy_tls_bool.Pointer()->Get();
+#endif
+ return quit_properly;
+}
+
void Thread::ThreadMain() {
{
// The message loop for this thread.