Make the order of methods in the cc files match the headers in base/.

BUG=68682
TEST=compiles

Review URL: http://codereview.chromium.org/6189001

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70771 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/base/file_path.cc b/base/file_path.cc
index eba9afe..cddb17e 100644
--- a/base/file_path.cc
+++ b/base/file_path.cc
@@ -174,6 +174,23 @@
   return *this;
 }
 
+bool FilePath::operator==(const FilePath& that) const {
+#if defined(FILE_PATH_USES_DRIVE_LETTERS)
+  return EqualDriveLetterCaseInsensitive(this->path_, that.path_);
+#else  // defined(FILE_PATH_USES_DRIVE_LETTERS)
+  return path_ == that.path_;
+#endif  // defined(FILE_PATH_USES_DRIVE_LETTERS)
+}
+
+bool FilePath::operator!=(const FilePath& that) const {
+#if defined(FILE_PATH_USES_DRIVE_LETTERS)
+  return !EqualDriveLetterCaseInsensitive(this->path_, that.path_);
+#else  // defined(FILE_PATH_USES_DRIVE_LETTERS)
+  return path_ != that.path_;
+#endif  // defined(FILE_PATH_USES_DRIVE_LETTERS)
+}
+
+// static
 bool FilePath::IsSeparator(CharType character) {
   for (size_t i = 0; i < arraysize(kSeparators) - 1; ++i) {
     if (character == kSeparators[i]) {
@@ -219,22 +236,6 @@
   *components = std::vector<StringType>(ret_val.rbegin(), ret_val.rend());
 }
 
-bool FilePath::operator==(const FilePath& that) const {
-#if defined(FILE_PATH_USES_DRIVE_LETTERS)
-  return EqualDriveLetterCaseInsensitive(this->path_, that.path_);
-#else  // defined(FILE_PATH_USES_DRIVE_LETTERS)
-  return path_ == that.path_;
-#endif  // defined(FILE_PATH_USES_DRIVE_LETTERS)
-}
-
-bool FilePath::operator!=(const FilePath& that) const {
-#if defined(FILE_PATH_USES_DRIVE_LETTERS)
-  return !EqualDriveLetterCaseInsensitive(this->path_, that.path_);
-#else  // defined(FILE_PATH_USES_DRIVE_LETTERS)
-  return path_ != that.path_;
-#endif  // defined(FILE_PATH_USES_DRIVE_LETTERS)
-}
-
 bool FilePath::IsParent(const FilePath& child) const {
   return AppendRelativePath(child, NULL);
 }
@@ -489,6 +490,87 @@
   return IsPathAbsolute(path_);
 }
 
+FilePath FilePath::StripTrailingSeparators() const {
+  FilePath new_path(path_);
+  new_path.StripTrailingSeparatorsInternal();
+
+  return new_path;
+}
+
+bool FilePath::ReferencesParent() const {
+  std::vector<StringType> components;
+  GetComponents(&components);
+
+  std::vector<StringType>::const_iterator it = components.begin();
+  for (; it != components.end(); ++it) {
+    const StringType& component = *it;
+    if (component == kParentDirectory)
+      return true;
+  }
+  return false;
+}
+
+#if defined(OS_POSIX)
+
+// See file_path.h for a discussion of the encoding of paths on POSIX
+// platforms.  These *Hack() functions are not quite correct, but they're
+// only temporary while we fix the remainder of the code.
+// Remember to remove the #includes at the top when you remove these.
+
+// static
+FilePath FilePath::FromWStringHack(const std::wstring& wstring) {
+  return FilePath(base::SysWideToNativeMB(wstring));
+}
+std::wstring FilePath::ToWStringHack() const {
+  return base::SysNativeMBToWide(path_);
+}
+#elif defined(OS_WIN)
+// static
+FilePath FilePath::FromWStringHack(const std::wstring& wstring) {
+  return FilePath(wstring);
+}
+std::wstring FilePath::ToWStringHack() const {
+  return path_;
+}
+#endif
+
+// static.
+void FilePath::WriteStringTypeToPickle(Pickle* pickle,
+                                       const StringType& path) {
+#if defined(WCHAR_T_IS_UTF16)
+  pickle->WriteWString(path);
+#elif defined(WCHAR_T_IS_UTF32)
+  pickle->WriteString(path);
+#else
+  NOTIMPLEMENTED() << "Impossible encoding situation!";
+#endif
+}
+
+// static.
+bool FilePath::ReadStringTypeFromPickle(Pickle* pickle, void** iter,
+                                        StringType* path) {
+#if defined(WCHAR_T_IS_UTF16)
+  if (!pickle->ReadWString(iter, path))
+    return false;
+#elif defined(WCHAR_T_IS_UTF32)
+  if (!pickle->ReadString(iter, path))
+    return false;
+#else
+  NOTIMPLEMENTED() << "Impossible encoding situation!";
+  return false;
+#endif
+
+  return true;
+}
+
+void FilePath::WriteToPickle(Pickle* pickle) {
+  WriteStringTypeToPickle(pickle, value());
+}
+
+bool FilePath::ReadFromPickle(Pickle* pickle, void** iter) {
+  return ReadStringTypeFromPickle(pickle, iter, &path_);
+}
+
 #if defined(OS_WIN)
 // Windows specific implementation of file string comparisons
 
@@ -1078,73 +1160,6 @@
 
 #endif  // OS versions of CompareIgnoreCase()
 
-#if defined(OS_POSIX)
-
-// See file_path.h for a discussion of the encoding of paths on POSIX
-// platforms.  These *Hack() functions are not quite correct, but they're
-// only temporary while we fix the remainder of the code.
-// Remember to remove the #includes at the top when you remove these.
-
-// static
-FilePath FilePath::FromWStringHack(const std::wstring& wstring) {
-  return FilePath(base::SysWideToNativeMB(wstring));
-}
-std::wstring FilePath::ToWStringHack() const {
-  return base::SysNativeMBToWide(path_);
-}
-#elif defined(OS_WIN)
-// static
-FilePath FilePath::FromWStringHack(const std::wstring& wstring) {
-  return FilePath(wstring);
-}
-std::wstring FilePath::ToWStringHack() const {
-  return path_;
-}
-#endif
-
-FilePath FilePath::StripTrailingSeparators() const {
-  FilePath new_path(path_);
-  new_path.StripTrailingSeparatorsInternal();
-
-  return new_path;
-}
-
-// static.
-void FilePath::WriteStringTypeToPickle(Pickle* pickle,
-                                       const StringType& path) {
-#if defined(WCHAR_T_IS_UTF16)
-  pickle->WriteWString(path);
-#elif defined(WCHAR_T_IS_UTF32)
-  pickle->WriteString(path);
-#else
-  NOTIMPLEMENTED() << "Impossible encoding situation!";
-#endif
-}
-
-// static.
-bool FilePath::ReadStringTypeFromPickle(Pickle* pickle, void** iter,
-                                        StringType* path) {
-#if defined(WCHAR_T_IS_UTF16)
-  if (!pickle->ReadWString(iter, path))
-    return false;
-#elif defined(WCHAR_T_IS_UTF32)
-  if (!pickle->ReadString(iter, path))
-    return false;
-#else
-  NOTIMPLEMENTED() << "Impossible encoding situation!";
-  return false;
-#endif
-
-  return true;
-}
-
-void FilePath::WriteToPickle(Pickle* pickle) {
-  WriteStringTypeToPickle(pickle, value());
-}
-
-bool FilePath::ReadFromPickle(Pickle* pickle, void** iter) {
-  return ReadStringTypeFromPickle(pickle, iter, &path_);
-}
 
 void FilePath::StripTrailingSeparatorsInternal() {
   // If there is no drive letter, start will be 1, which will prevent stripping
@@ -1168,19 +1183,6 @@
   }
 }
 
-bool FilePath::ReferencesParent() const {
-  std::vector<StringType> components;
-  GetComponents(&components);
-
-  std::vector<StringType>::const_iterator it = components.begin();
-  for (; it != components.end(); ++it) {
-    const StringType& component = *it;
-    if (component == kParentDirectory)
-      return true;
-  }
-  return false;
-}
-
 #if defined(FILE_PATH_USES_WIN_SEPARATORS)
 FilePath FilePath::NormalizeWindowsPathSeparators() const {
   StringType copy = path_;
diff --git a/base/message_loop.cc b/base/message_loop.cc
index eec8a24..e74331a 100644
--- a/base/message_loop.cc
+++ b/base/message_loop.cc
@@ -113,14 +113,6 @@
 
 //------------------------------------------------------------------------------
 
-// static
-MessageLoop* MessageLoop::current() {
-  // TODO(darin): sadly, we cannot enable this yet since people call us even
-  // when they have no intention of using us.
-  // DCHECK(loop) << "Ouch, did you forget to initialize me?";
-  return lazy_tls_ptr.Pointer()->Get();
-}
-
 MessageLoop::MessageLoop(Type type)
     : type_(type),
       nestable_tasks_allowed_(true),
@@ -192,6 +184,19 @@
   lazy_tls_ptr.Pointer()->Set(NULL);
 }
 
+// static
+MessageLoop* MessageLoop::current() {
+  // TODO(darin): sadly, we cannot enable this yet since people call us even
+  // when they have no intention of using us.
+  // DCHECK(loop) << "Ouch, did you forget to initialize me?";
+  return lazy_tls_ptr.Pointer()->Get();
+}
+
+// static
+void MessageLoop::EnableHistogrammer(bool enable) {
+  enable_histogrammer_ = enable;
+}
+
 void MessageLoop::AddDestructionObserver(
     DestructionObserver* destruction_observer) {
   DCHECK_EQ(this, current());
@@ -204,108 +209,6 @@
   destruction_observers_.RemoveObserver(destruction_observer);
 }
 
-void MessageLoop::AddTaskObserver(TaskObserver* task_observer) {
-  DCHECK_EQ(this, current());
-  task_observers_.AddObserver(task_observer);
-}
-
-void MessageLoop::RemoveTaskObserver(TaskObserver* task_observer) {
-  DCHECK_EQ(this, current());
-  task_observers_.RemoveObserver(task_observer);
-}
-
-void MessageLoop::Run() {
-  AutoRunState save_state(this);
-  RunHandler();
-}
-
-void MessageLoop::RunAllPending() {
-  AutoRunState save_state(this);
-  state_->quit_received = true;  // Means run until we would otherwise block.
-  RunHandler();
-}
-
-// Runs the loop in two different SEH modes:
-// enable_SEH_restoration_ = false : any unhandled exception goes to the last
-// one that calls SetUnhandledExceptionFilter().
-// enable_SEH_restoration_ = true : any unhandled exception goes to the filter
-// that was existed before the loop was run.
-void MessageLoop::RunHandler() {
-#if defined(OS_WIN)
-  if (exception_restoration_) {
-    RunInternalInSEHFrame();
-    return;
-  }
-#endif
-
-  RunInternal();
-}
-//------------------------------------------------------------------------------
-#if defined(OS_WIN)
-__declspec(noinline) void MessageLoop::RunInternalInSEHFrame() {
-  LPTOP_LEVEL_EXCEPTION_FILTER current_filter = GetTopSEHFilter();
-  __try {
-    RunInternal();
-  } __except(SEHFilter(current_filter)) {
-  }
-  return;
-}
-#endif
-//------------------------------------------------------------------------------
-
-void MessageLoop::RunInternal() {
-  DCHECK_EQ(this, current());
-
-  StartHistogrammer();
-
-#if !defined(OS_MACOSX)
-  if (state_->dispatcher && type() == TYPE_UI) {
-    static_cast<base::MessagePumpForUI*>(pump_.get())->
-        RunWithDispatcher(this, state_->dispatcher);
-    return;
-  }
-#endif
-
-  pump_->Run(this);
-}
-
-//------------------------------------------------------------------------------
-// Wrapper functions for use in above message loop framework.
-
-bool MessageLoop::ProcessNextDelayedNonNestableTask() {
-  if (state_->run_depth != 1)
-    return false;
-
-  if (deferred_non_nestable_work_queue_.empty())
-    return false;
-
-  Task* task = deferred_non_nestable_work_queue_.front().task;
-  deferred_non_nestable_work_queue_.pop();
-
-  RunTask(task);
-  return true;
-}
-
-//------------------------------------------------------------------------------
-
-void MessageLoop::Quit() {
-  DCHECK_EQ(this, current());
-  if (state_) {
-    state_->quit_received = true;
-  } else {
-    NOTREACHED() << "Must be inside Run to call Quit";
-  }
-}
-
-void MessageLoop::QuitNow() {
-  DCHECK_EQ(this, current());
-  if (state_) {
-    pump_->Quit();
-  } else {
-    NOTREACHED() << "Must be inside Run to call Quit";
-  }
-}
-
 void MessageLoop::PostTask(
     const tracked_objects::Location& from_here, Task* task) {
   PostTask_Helper(from_here, task, 0, true);
@@ -326,68 +229,33 @@
   PostTask_Helper(from_here, task, delay_ms, false);
 }
 
-// Possibly called on a background thread!
-void MessageLoop::PostTask_Helper(
-    const tracked_objects::Location& from_here, Task* task, int64 delay_ms,
-    bool nestable) {
-  task->SetBirthPlace(from_here);
+void MessageLoop::Run() {
+  AutoRunState save_state(this);
+  RunHandler();
+}
 
-  PendingTask pending_task(task, nestable);
+void MessageLoop::RunAllPending() {
+  AutoRunState save_state(this);
+  state_->quit_received = true;  // Means run until we would otherwise block.
+  RunHandler();
+}
 
-  if (delay_ms > 0) {
-    pending_task.delayed_run_time =
-        TimeTicks::Now() + TimeDelta::FromMilliseconds(delay_ms);
-
-#if defined(OS_WIN)
-    if (high_resolution_timer_expiration_.is_null()) {
-      // Windows timers are granular to 15.6ms.  If we only set high-res
-      // timers for those under 15.6ms, then a 18ms timer ticks at ~32ms,
-      // which as a percentage is pretty inaccurate.  So enable high
-      // res timers for any timer which is within 2x of the granularity.
-      // This is a tradeoff between accuracy and power management.
-      bool needs_high_res_timers =
-          delay_ms < (2 * base::Time::kMinLowResolutionThresholdMs);
-      if (needs_high_res_timers) {
-        base::Time::ActivateHighResolutionTimer(true);
-        high_resolution_timer_expiration_ = TimeTicks::Now() +
-            TimeDelta::FromMilliseconds(kHighResolutionTimerModeLeaseTimeMs);
-      }
-    }
-#endif
+void MessageLoop::Quit() {
+  DCHECK_EQ(this, current());
+  if (state_) {
+    state_->quit_received = true;
   } else {
-    DCHECK_EQ(delay_ms, 0) << "delay should not be negative";
+    NOTREACHED() << "Must be inside Run to call Quit";
   }
+}
 
-#if defined(OS_WIN)
-  if (!high_resolution_timer_expiration_.is_null()) {
-    if (TimeTicks::Now() > high_resolution_timer_expiration_) {
-      base::Time::ActivateHighResolutionTimer(false);
-      high_resolution_timer_expiration_ = TimeTicks();
-    }
+void MessageLoop::QuitNow() {
+  DCHECK_EQ(this, current());
+  if (state_) {
+    pump_->Quit();
+  } else {
+    NOTREACHED() << "Must be inside Run to call Quit";
   }
-#endif
-
-  // Warning: Don't try to short-circuit, and handle this thread's tasks more
-  // directly, as it could starve handling of foreign threads.  Put every task
-  // into this queue.
-
-  scoped_refptr<base::MessagePump> pump;
-  {
-    AutoLock locked(incoming_queue_lock_);
-
-    bool was_empty = incoming_queue_.empty();
-    incoming_queue_.push(pending_task);
-    if (!was_empty)
-      return;  // Someone else should have started the sub-pump.
-
-    pump = pump_;
-  }
-  // Since the incoming_queue_ may contain a task that destroys this message
-  // loop, we cannot exit incoming_queue_lock_ until we are done with |this|.
-  // We use a stack-based reference to the message pump so that we can call
-  // ScheduleWork outside of incoming_queue_lock_.
-
-  pump->ScheduleWork();
 }
 
 void MessageLoop::SetNestableTasksAllowed(bool allowed) {
@@ -408,8 +276,75 @@
   return state_->run_depth > 1;
 }
 
+void MessageLoop::AddTaskObserver(TaskObserver* task_observer) {
+  DCHECK_EQ(this, current());
+  task_observers_.AddObserver(task_observer);
+}
+
+void MessageLoop::RemoveTaskObserver(TaskObserver* task_observer) {
+  DCHECK_EQ(this, current());
+  task_observers_.RemoveObserver(task_observer);
+}
+
 //------------------------------------------------------------------------------
 
+// Runs the loop in two different SEH modes:
+// enable_SEH_restoration_ = false : any unhandled exception goes to the last
+// one that calls SetUnhandledExceptionFilter().
+// enable_SEH_restoration_ = true : any unhandled exception goes to the filter
+// that was existed before the loop was run.
+void MessageLoop::RunHandler() {
+#if defined(OS_WIN)
+  if (exception_restoration_) {
+    RunInternalInSEHFrame();
+    return;
+  }
+#endif
+
+  RunInternal();
+}
+
+#if defined(OS_WIN)
+__declspec(noinline) void MessageLoop::RunInternalInSEHFrame() {
+  LPTOP_LEVEL_EXCEPTION_FILTER current_filter = GetTopSEHFilter();
+  __try {
+    RunInternal();
+  } __except(SEHFilter(current_filter)) {
+  }
+  return;
+}
+#endif
+
+void MessageLoop::RunInternal() {
+  DCHECK_EQ(this, current());
+
+  StartHistogrammer();
+
+#if !defined(OS_MACOSX)
+  if (state_->dispatcher && type() == TYPE_UI) {
+    static_cast<base::MessagePumpForUI*>(pump_.get())->
+        RunWithDispatcher(this, state_->dispatcher);
+    return;
+  }
+#endif
+
+  pump_->Run(this);
+}
+
+bool MessageLoop::ProcessNextDelayedNonNestableTask() {
+  if (state_->run_depth != 1)
+    return false;
+
+  if (deferred_non_nestable_work_queue_.empty())
+    return false;
+
+  Task* task = deferred_non_nestable_work_queue_.front().task;
+  deferred_non_nestable_work_queue_.pop();
+
+  RunTask(task);
+  return true;
+}
+
 void MessageLoop::RunTask(Task* task) {
   DCHECK(nestable_tasks_allowed_);
   // Execute the task and assume the worst: It is probably not reentrant.
@@ -513,6 +448,92 @@
   return did_work;
 }
 
+// Possibly called on a background thread!
+void MessageLoop::PostTask_Helper(
+    const tracked_objects::Location& from_here, Task* task, int64 delay_ms,
+    bool nestable) {
+  task->SetBirthPlace(from_here);
+
+  PendingTask pending_task(task, nestable);
+
+  if (delay_ms > 0) {
+    pending_task.delayed_run_time =
+        TimeTicks::Now() + TimeDelta::FromMilliseconds(delay_ms);
+
+#if defined(OS_WIN)
+    if (high_resolution_timer_expiration_.is_null()) {
+      // Windows timers are granular to 15.6ms.  If we only set high-res
+      // timers for those under 15.6ms, then a 18ms timer ticks at ~32ms,
+      // which as a percentage is pretty inaccurate.  So enable high
+      // res timers for any timer which is within 2x of the granularity.
+      // This is a tradeoff between accuracy and power management.
+      bool needs_high_res_timers =
+          delay_ms < (2 * base::Time::kMinLowResolutionThresholdMs);
+      if (needs_high_res_timers) {
+        base::Time::ActivateHighResolutionTimer(true);
+        high_resolution_timer_expiration_ = TimeTicks::Now() +
+            TimeDelta::FromMilliseconds(kHighResolutionTimerModeLeaseTimeMs);
+      }
+    }
+#endif
+  } else {
+    DCHECK_EQ(delay_ms, 0) << "delay should not be negative";
+  }
+
+#if defined(OS_WIN)
+  if (!high_resolution_timer_expiration_.is_null()) {
+    if (TimeTicks::Now() > high_resolution_timer_expiration_) {
+      base::Time::ActivateHighResolutionTimer(false);
+      high_resolution_timer_expiration_ = TimeTicks();
+    }
+  }
+#endif
+
+  // Warning: Don't try to short-circuit, and handle this thread's tasks more
+  // directly, as it could starve handling of foreign threads.  Put every task
+  // into this queue.
+
+  scoped_refptr<base::MessagePump> pump;
+  {
+    AutoLock locked(incoming_queue_lock_);
+
+    bool was_empty = incoming_queue_.empty();
+    incoming_queue_.push(pending_task);
+    if (!was_empty)
+      return;  // Someone else should have started the sub-pump.
+
+    pump = pump_;
+  }
+  // Since the incoming_queue_ may contain a task that destroys this message
+  // loop, we cannot exit incoming_queue_lock_ until we are done with |this|.
+  // We use a stack-based reference to the message pump so that we can call
+  // ScheduleWork outside of incoming_queue_lock_.
+
+  pump->ScheduleWork();
+}
+
+//------------------------------------------------------------------------------
+// Method and data for histogramming events and actions taken by each instance
+// on each thread.
+
+void MessageLoop::StartHistogrammer() {
+  if (enable_histogrammer_ && !message_histogram_.get()
+      && base::StatisticsRecorder::IsActive()) {
+    DCHECK(!thread_name_.empty());
+    message_histogram_ = base::LinearHistogram::FactoryGet(
+        "MsgLoop:" + thread_name_,
+        kLeastNonZeroMessageId, kMaxMessageId,
+        kNumberOfDistinctMessagesDisplayed,
+        message_histogram_->kHexRangePrintingFlag);
+    message_histogram_->SetRangeDescriptions(event_descriptions_);
+  }
+}
+
+void MessageLoop::HistogramEvent(int event) {
+  if (message_histogram_.get())
+    message_histogram_->Add(event);
+}
+
 bool MessageLoop::DoWork() {
   if (!nestable_tasks_allowed_) {
     // Task can't be executed right now.
@@ -629,33 +650,6 @@
 }
 
 //------------------------------------------------------------------------------
-// Method and data for histogramming events and actions taken by each instance
-// on each thread.
-
-// static
-void MessageLoop::EnableHistogrammer(bool enable) {
-  enable_histogrammer_ = enable;
-}
-
-void MessageLoop::StartHistogrammer() {
-  if (enable_histogrammer_ && !message_histogram_.get()
-      && base::StatisticsRecorder::IsActive()) {
-    DCHECK(!thread_name_.empty());
-    message_histogram_ = base::LinearHistogram::FactoryGet(
-        "MsgLoop:" + thread_name_,
-        kLeastNonZeroMessageId, kMaxMessageId,
-        kNumberOfDistinctMessagesDisplayed,
-        message_histogram_->kHexRangePrintingFlag);
-    message_histogram_->SetRangeDescriptions(event_descriptions_);
-  }
-}
-
-void MessageLoop::HistogramEvent(int event) {
-  if (message_histogram_.get())
-    message_histogram_->Add(event);
-}
-
-//------------------------------------------------------------------------------
 // MessageLoopForUI
 
 #if defined(OS_WIN)
diff --git a/base/message_loop.h b/base/message_loop.h
index 8058e246..d5093a9 100644
--- a/base/message_loop.h
+++ b/base/message_loop.h
@@ -103,6 +103,9 @@
   explicit MessageLoop(Type type = TYPE_DEFAULT);
   ~MessageLoop();
 
+  // Returns the MessageLoop object for the current thread, or null if none.
+  static MessageLoop* current();
+
   static void EnableHistogrammer(bool enable_histogrammer);
 
   // A DestructionObserver is notified when the current MessageLoop is being
@@ -229,9 +232,6 @@
   }
   const std::string& thread_name() const { return thread_name_; }
 
-  // Returns the MessageLoop object for the current thread, or null if none.
-  static MessageLoop* current();
-
   // Enables or disables the recursive task processing. This happens in the case
   // of recursive message loops. Some unwanted message loop may occurs when
   // using common controls or printer functions. By default, recursive task
@@ -391,18 +391,6 @@
   // Called to process any delayed non-nestable tasks.
   bool ProcessNextDelayedNonNestableTask();
 
-  //----------------------------------------------------------------------------
-  // Run a work_queue_ task or new_task, and delete it (if it was processed by
-  // PostTask). If there are queued tasks, the oldest one is executed and
-  // new_task is queued. new_task is optional and can be NULL. In this NULL
-  // case, the method will run one pending task (if any exist). Returns true if
-  // it executes a task.  Queued tasks accumulate only when there is a
-  // non-nestable task currently processing, in which case the new_task is
-  // appended to the list work_queue_.  Such re-entrancy generally happens when
-  // an unrequested message pump (typical of a native dialog) is executing in
-  // the context of a task.
-  bool QueueOrRunTask(Task* new_task);
-
   // Runs the specified task and deletes it.
   void RunTask(Task* task);
 
diff --git a/base/pickle.cc b/base/pickle.cc
index 3f376e3f..a05df287 100644
--- a/base/pickle.cc
+++ b/base/pickle.cc
@@ -140,12 +140,6 @@
   return true;
 }
 
-bool Pickle::ReadLength(void** iter, int* result) const {
-  if (!ReadInt(iter, result))
-    return false;
-  return ((*result) >= 0);
-}
-
 bool Pickle::ReadSize(void** iter, size_t* result) const {
   DCHECK(iter);
   if (!*iter)
@@ -256,6 +250,19 @@
   return true;
 }
 
+bool Pickle::ReadData(void** iter, const char** data, int* length) const {
+  DCHECK(iter);
+  DCHECK(data);
+  DCHECK(length);
+  *length = 0;
+  *data = 0;
+
+  if (!ReadLength(iter, length))
+    return false;
+
+  return ReadBytes(iter, data, *length);
+}
+
 bool Pickle::ReadBytes(void** iter, const char** data, int length) const {
   DCHECK(iter);
   DCHECK(data);
@@ -272,54 +279,10 @@
   return true;
 }
 
-bool Pickle::ReadData(void** iter, const char** data, int* length) const {
-  DCHECK(iter);
-  DCHECK(data);
-  DCHECK(length);
-  *length = 0;
-  *data = 0;
-
-  if (!ReadLength(iter, length))
+bool Pickle::ReadLength(void** iter, int* result) const {
+  if (!ReadInt(iter, result))
     return false;
-
-  return ReadBytes(iter, data, *length);
-}
-
-char* Pickle::BeginWrite(size_t length) {
-  // write at a uint32-aligned offset from the beginning of the header
-  size_t offset = AlignInt(header_->payload_size, sizeof(uint32));
-
-  size_t new_size = offset + length;
-  size_t needed_size = header_size_ + new_size;
-  if (needed_size > capacity_ && !Resize(std::max(capacity_ * 2, needed_size)))
-    return NULL;
-
-#ifdef ARCH_CPU_64_BITS
-  DCHECK_LE(length, std::numeric_limits<uint32>::max());
-#endif
-
-  header_->payload_size = static_cast<uint32>(new_size);
-  return payload() + offset;
-}
-
-void Pickle::EndWrite(char* dest, int length) {
-  // Zero-pad to keep tools like purify from complaining about uninitialized
-  // memory.
-  if (length % sizeof(uint32))
-    memset(dest + length, 0, sizeof(uint32) - (length % sizeof(uint32)));
-}
-
-bool Pickle::WriteBytes(const void* data, int data_len) {
-  DCHECK(capacity_ != kCapacityReadOnly) << "oops: pickle is readonly";
-
-  char* dest = BeginWrite(data_len);
-  if (!dest)
-    return false;
-
-  memcpy(dest, data, data_len);
-
-  EndWrite(dest, data_len);
-  return true;
+  return ((*result) >= 0);
 }
 
 bool Pickle::WriteString(const std::string& value) {
@@ -349,6 +312,19 @@
   return length >= 0 && WriteInt(length) && WriteBytes(data, length);
 }
 
+bool Pickle::WriteBytes(const void* data, int data_len) {
+  DCHECK(capacity_ != kCapacityReadOnly) << "oops: pickle is readonly";
+
+  char* dest = BeginWrite(data_len);
+  if (!dest)
+    return false;
+
+  memcpy(dest, data, data_len);
+
+  EndWrite(dest, data_len);
+  return true;
+}
+
 char* Pickle::BeginWriteData(int length) {
   DCHECK_EQ(variable_buffer_offset_, 0U) <<
     "There can only be one variable buffer in a Pickle";
@@ -386,6 +362,30 @@
   *cur_length = new_length;
 }
 
+char* Pickle::BeginWrite(size_t length) {
+  // write at a uint32-aligned offset from the beginning of the header
+  size_t offset = AlignInt(header_->payload_size, sizeof(uint32));
+
+  size_t new_size = offset + length;
+  size_t needed_size = header_size_ + new_size;
+  if (needed_size > capacity_ && !Resize(std::max(capacity_ * 2, needed_size)))
+    return NULL;
+
+#ifdef ARCH_CPU_64_BITS
+  DCHECK_LE(length, std::numeric_limits<uint32>::max());
+#endif
+
+  header_->payload_size = static_cast<uint32>(new_size);
+  return payload() + offset;
+}
+
+void Pickle::EndWrite(char* dest, int length) {
+  // Zero-pad to keep tools like purify from complaining about uninitialized
+  // memory.
+  if (length % sizeof(uint32))
+    memset(dest + length, 0, sizeof(uint32) - (length % sizeof(uint32)));
+}
+
 bool Pickle::Resize(size_t new_capacity) {
   new_capacity = AlignInt(new_capacity, kPayloadUnit);
 
diff --git a/base/ref_counted_memory.cc b/base/ref_counted_memory.cc
index 0a4a613..dc244b9 100644
--- a/base/ref_counted_memory.cc
+++ b/base/ref_counted_memory.cc
@@ -18,13 +18,6 @@
   return length_;
 }
 
-RefCountedBytes* RefCountedBytes::TakeVector(
-    std::vector<unsigned char>* to_destroy) {
-  RefCountedBytes* bytes = new RefCountedBytes;
-  bytes->data.swap(*to_destroy);
-  return bytes;
-}
-
 RefCountedBytes::RefCountedBytes() {
 }
 
@@ -32,7 +25,11 @@
     : data(initializer) {
 }
 
-RefCountedBytes::~RefCountedBytes() {
+RefCountedBytes* RefCountedBytes::TakeVector(
+    std::vector<unsigned char>* to_destroy) {
+  RefCountedBytes* bytes = new RefCountedBytes;
+  bytes->data.swap(*to_destroy);
+  return bytes;
 }
 
 const unsigned char* RefCountedBytes::front() const {
@@ -44,3 +41,6 @@
 size_t RefCountedBytes::size() const {
   return data.size();
 }
+
+RefCountedBytes::~RefCountedBytes() {
+}
diff --git a/base/task_queue.cc b/base/task_queue.cc
index e3c196b..fdff8ac9 100644
--- a/base/task_queue.cc
+++ b/base/task_queue.cc
@@ -15,6 +15,22 @@
   STLDeleteElements(&queue_);
 }
 
+void TaskQueue::Push(Task* task) {
+  DCHECK(task);
+
+  // Add the task to the back of the queue.
+  queue_.push_back(task);
+}
+
+void TaskQueue::Clear() {
+  // Delete all the elements in the queue and clear the dead pointers.
+  STLDeleteElements(&queue_);
+}
+
+bool TaskQueue::IsEmpty() const {
+  return queue_.empty();
+}
+
 void TaskQueue::Run() {
   // Nothing to run if our queue is empty.
   if (queue_.empty())
@@ -31,19 +47,3 @@
     delete (*task);
   }
 }
-
-void TaskQueue::Push(Task* task) {
-  DCHECK(task);
-
-  // Add the task to the back of the queue.
-  queue_.push_back(task);
-}
-
-void TaskQueue::Clear() {
-  // Delete all the elements in the queue and clear the dead pointers.
-  STLDeleteElements(&queue_);
-}
-
-bool TaskQueue::IsEmpty() const {
-  return queue_.empty();
-}
diff --git a/base/values.cc b/base/values.cc
index 4553e68..3522569 100644
--- a/base/values.cc
+++ b/base/values.cc
@@ -263,6 +263,12 @@
 
 ///////////////////// BinaryValue ////////////////////
 
+BinaryValue::~BinaryValue() {
+  DCHECK(buffer_);
+  if (buffer_)
+    delete[] buffer_;
+}
+
 // static
 BinaryValue* BinaryValue::Create(char* buffer, size_t size) {
   if (!buffer)
@@ -282,20 +288,6 @@
   return new BinaryValue(buffer_copy, size);
 }
 
-
-BinaryValue::BinaryValue(char* buffer, size_t size)
-  : Value(TYPE_BINARY),
-    buffer_(buffer),
-    size_(size) {
-  DCHECK(buffer_);
-}
-
-BinaryValue::~BinaryValue() {
-  DCHECK(buffer_);
-  if (buffer_)
-    delete[] buffer_;
-}
-
 Value* BinaryValue::DeepCopy() const {
   return CreateWithCopiedBuffer(buffer_, size_);
 }
@@ -309,6 +301,13 @@
   return !memcmp(buffer_, other_binary->buffer_, size_);
 }
 
+BinaryValue::BinaryValue(char* buffer, size_t size)
+  : Value(TYPE_BINARY),
+    buffer_(buffer),
+    size_(size) {
+  DCHECK(buffer_);
+}
+
 ///////////////////// DictionaryValue ////////////////////
 
 DictionaryValue::DictionaryValue()
@@ -319,44 +318,6 @@
   Clear();
 }
 
-Value* DictionaryValue::DeepCopy() const {
-  DictionaryValue* result = new DictionaryValue;
-
-  for (ValueMap::const_iterator current_entry(dictionary_.begin());
-       current_entry != dictionary_.end(); ++current_entry) {
-    result->SetWithoutPathExpansion(current_entry->first,
-                                    current_entry->second->DeepCopy());
-  }
-
-  return result;
-}
-
-bool DictionaryValue::Equals(const Value* other) const {
-  if (other->GetType() != GetType())
-    return false;
-
-  const DictionaryValue* other_dict =
-      static_cast<const DictionaryValue*>(other);
-  key_iterator lhs_it(begin_keys());
-  key_iterator rhs_it(other_dict->begin_keys());
-  while (lhs_it != end_keys() && rhs_it != other_dict->end_keys()) {
-    Value* lhs;
-    Value* rhs;
-    if (*lhs_it != *rhs_it ||
-        !GetWithoutPathExpansion(*lhs_it, &lhs) ||
-        !other_dict->GetWithoutPathExpansion(*rhs_it, &rhs) ||
-        !lhs->Equals(rhs)) {
-      return false;
-    }
-    ++lhs_it;
-    ++rhs_it;
-  }
-  if (lhs_it != end_keys() || rhs_it != other_dict->end_keys())
-    return false;
-
-  return true;
-}
-
 bool DictionaryValue::HasKey(const std::string& key) const {
   DCHECK(IsStringUTF8(key));
   ValueMap::const_iterator current_entry = dictionary_.find(key);
@@ -685,6 +646,44 @@
   }
 }
 
+Value* DictionaryValue::DeepCopy() const {
+  DictionaryValue* result = new DictionaryValue;
+
+  for (ValueMap::const_iterator current_entry(dictionary_.begin());
+       current_entry != dictionary_.end(); ++current_entry) {
+    result->SetWithoutPathExpansion(current_entry->first,
+                                    current_entry->second->DeepCopy());
+  }
+
+  return result;
+}
+
+bool DictionaryValue::Equals(const Value* other) const {
+  if (other->GetType() != GetType())
+    return false;
+
+  const DictionaryValue* other_dict =
+      static_cast<const DictionaryValue*>(other);
+  key_iterator lhs_it(begin_keys());
+  key_iterator rhs_it(other_dict->begin_keys());
+  while (lhs_it != end_keys() && rhs_it != other_dict->end_keys()) {
+    Value* lhs;
+    Value* rhs;
+    if (*lhs_it != *rhs_it ||
+        !GetWithoutPathExpansion(*lhs_it, &lhs) ||
+        !other_dict->GetWithoutPathExpansion(*rhs_it, &rhs) ||
+        !lhs->Equals(rhs)) {
+      return false;
+    }
+    ++lhs_it;
+    ++rhs_it;
+  }
+  if (lhs_it != end_keys() || rhs_it != other_dict->end_keys())
+    return false;
+
+  return true;
+}
+
 ///////////////////// ListValue ////////////////////
 
 ListValue::ListValue() : Value(TYPE_LIST) {
diff --git a/base/version.cc b/base/version.cc
index 384be0a..571672c 100644
--- a/base/version.cc
+++ b/base/version.cc
@@ -12,6 +12,10 @@
 #include "base/string_util.h"
 #include "base/utf_string_conversions.h"
 
+Version::Version() : is_valid_(false) {}
+
+Version::~Version() {}
+
 // static
 Version* Version::GetVersionFromString(const std::string& version_str) {
   Version* vers = new Version();
@@ -23,10 +27,6 @@
   return NULL;
 }
 
-Version::Version() : is_valid_(false) {}
-
-Version::~Version() {}
-
 Version* Version::Clone() const {
   DCHECK(is_valid_);
   Version* copy = new Version();