[platform] Avoid duplicate task runner lookup

Minor refactoring, for readability and performance.

R=ahaas@chromium.org

Bug: v8:8015
Change-Id: I30c4a76998c8867aea0e08fd982b4425d4ae8fef
Reviewed-on: https://chromium-review.googlesource.com/1251163
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56285}
This commit is contained in:
Clemens Hammacher 2018-09-28 11:58:25 +02:00 committed by Commit Bot
parent de5d1200b2
commit 4bba0ea789

View File

@ -140,11 +140,9 @@ bool DefaultPlatform::PumpMessageLoop(v8::Isolate* isolate,
std::shared_ptr<DefaultForegroundTaskRunner> task_runner;
{
base::LockGuard<base::Mutex> guard(&lock_);
if (foreground_task_runner_map_.find(isolate) ==
foreground_task_runner_map_.end()) {
return failed_result;
}
task_runner = foreground_task_runner_map_[isolate];
auto it = foreground_task_runner_map_.find(isolate);
if (it == foreground_task_runner_map_.end()) return failed_result;
task_runner = it->second;
}
std::unique_ptr<Task> task = task_runner->PopTaskFromQueue(wait_for_work);