Change ReadWriteLock to Lock+ConditionVariable in TaskService

There are non-trivial performance implications of using shared
SRWLocking on Windows as more state has to be checked.

Since there are only two uses of the ReadWriteLock in Chromium after
over 1 year, the decision is to remove it.

BUG=758721

Change-Id: I84d1987d7b624a89e896eb37184ee50845c39d80
Reviewed-on: https://chromium-review.googlesource.com/634423
Commit-Queue: Robert Liao <robliao@chromium.org>
Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org>
Reviewed-by: Francois Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#497632}
 void TaskService::RunTask(InstanceId instance_id,
                           RunnerId runner_id,
                           base::OnceClosure task) {
   {
    base::AutoLock tasks_in_flight_auto_lock(tasks_in_flight_lock_);
    ++tasks_in_flight_;
   }

  if (IsInstanceIdStillBound(instance_id))
    std::move(task).Run();

  {
    base::AutoLock tasks_in_flight_auto_lock(tasks_in_flight_lock_);
    --tasks_in_flight_;
    DCHECK_GE(tasks_in_flight_, 0);
    if (tasks_in_flight_ == 0)
      no_tasks_in_flight_cv_.Signal();
  }
}

bool TaskService::IsInstanceIdStillBound(InstanceId instance_id) {
  base::AutoLock lock(lock_);
  return instance_id == bound_instance_id_;
 }

 void TaskService::RunTask(InstanceId instance_id,
                           RunnerId runner_id,
                           base::OnceClosure task) {
  base::subtle::AutoReadLock task_lock(task_lock_);
   {
    base::AutoLock lock(lock_);
    if (instance_id != bound_instance_id_)
      return;
   }
  std::move(task).Run();
 }
