Remove use of synchronization/ in tools/gn/header_checker

Change-Id: Iec9fa7d8bf728742a7579cbba06f7cefc98bce50
Reviewed-on: https://gn-review.googlesource.com/1703
Reviewed-by: Brett Wilson <brettw@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
diff --git a/tools/gn/header_checker.cc b/tools/gn/header_checker.cc
index 2729653..19a07a3 100644
--- a/tools/gn/header_checker.cc
+++ b/tools/gn/header_checker.cc
@@ -120,7 +120,7 @@
 
 HeaderChecker::HeaderChecker(const BuildSettings* build_settings,
                              const std::vector<const Target*>& targets)
-    : build_settings_(build_settings), task_count_cv_(&lock_) {
+    : build_settings_(build_settings), lock_(), task_count_cv_() {
   for (auto* target : targets)
     AddTargetToFileMap(target, &file_map_);
 }
@@ -174,22 +174,22 @@
   }
 
   // Wait for all tasks posted by this method to complete.
-  base::AutoLock auto_lock(lock_);
+  std::unique_lock<std::mutex> auto_lock(lock_);
   while (!task_count_.IsZero())
-    task_count_cv_.Wait();
+    task_count_cv_.wait(auto_lock);
 }
 
 void HeaderChecker::DoWork(const Target* target, const SourceFile& file) {
   Err err;
   if (!CheckFile(target, file, &err)) {
-    base::AutoLock lock(lock_);
+    std::lock_guard<std::mutex> lock(lock_);
     errors_.push_back(err);
   }
 
   if (!task_count_.Decrement()) {
     // Signal |task_count_cv_| when |task_count_| becomes zero.
-    base::AutoLock auto_lock(lock_);
-    task_count_cv_.Signal();
+    std::unique_lock<std::mutex> auto_lock(lock_);
+    task_count_cv_.notify_one();
   }
 }
 
diff --git a/tools/gn/header_checker.h b/tools/gn/header_checker.h
index 8b2d504..9fde97c 100644
--- a/tools/gn/header_checker.h
+++ b/tools/gn/header_checker.h
@@ -5,7 +5,9 @@
 #ifndef TOOLS_GN_HEADER_CHECKER_H_
 #define TOOLS_GN_HEADER_CHECKER_H_
 
+#include <condition_variable>
 #include <map>
+#include <mutex>
 #include <vector>
 
 #include "base/atomic_ref_count.h"
@@ -13,8 +15,6 @@
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
 #include "base/strings/string_piece.h"
-#include "base/synchronization/condition_variable.h"
-#include "base/synchronization/lock.h"
 #include "tools/gn/err.h"
 #include "tools/gn/source_dir.h"
 
@@ -182,12 +182,12 @@
   //
   // These are mutable during runtime and require locking.
 
-  base::Lock lock_;
+  std::mutex lock_;
 
   std::vector<Err> errors_;
 
   // Signaled when |task_count_| becomes zero.
-  base::ConditionVariable task_count_cv_;
+  std::condition_variable task_count_cv_;
 
   DISALLOW_COPY_AND_ASSIGN(HeaderChecker);
 };