From c2bf5bb986d1af57448b659a2ba9cb21211dbffd Mon Sep 17 00:00:00 2001 From: Yury Solovyov Date: Sun, 6 Nov 2016 12:58:01 +0300 Subject: [PATCH] Put locker and handle scope to the top of the function. Remove unneeded header --- atom/browser/api/atom_api_app.cc | 12 +++++++----- atom/browser/api/atom_api_app.h | 1 - 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/atom/browser/api/atom_api_app.cc b/atom/browser/api/atom_api_app.cc index 9beff988059d..7bb797468a78 100644 --- a/atom/browser/api/atom_api_app.cc +++ b/atom/browser/api/atom_api_app.cc @@ -475,9 +475,10 @@ int ImportIntoCertStore( void OnIconDataAvailable(const App::FileIconCallback& callback, gfx::Image* icon) { v8::Isolate* isolate = v8::Isolate::GetCurrent(); + v8::Locker locker(isolate); + v8::HandleScope handle_scope(isolate); + if (icon && !icon->IsEmpty()) { - v8::Locker locker(isolate); - v8::HandleScope handle_scope(isolate); callback.Run(v8::Null(isolate), *icon); } else { v8::Local error_message = @@ -871,6 +872,10 @@ void App::GetFileIcon(const base::FilePath& path, IconLoader::IconSize icon_size; FileIconCallback callback; + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + v8::Locker locker(isolate); + v8::HandleScope handle_scope(isolate); + base::FilePath normalized_path = path.NormalizePathSeparators(); if (!args->GetNext(&options)) { @@ -890,9 +895,6 @@ void App::GetFileIcon(const base::FilePath& path, gfx::Image* icon = icon_manager->LookupIconFromFilepath(normalized_path, icon_size); if (icon) { - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - v8::Locker locker(isolate); - v8::HandleScope handle_scope(isolate); callback.Run(v8::Null(isolate), *icon); } else { icon_manager->LoadIcon(normalized_path, icon_size, diff --git a/atom/browser/api/atom_api_app.h b/atom/browser/api/atom_api_app.h index b051e4e5fa73..1d8e5804e5d2 100644 --- a/atom/browser/api/atom_api_app.h +++ b/atom/browser/api/atom_api_app.h @@ -12,7 +12,6 @@ #include "atom/browser/atom_browser_client.h" #include "atom/browser/browser.h" #include "atom/browser/browser_observer.h" -#include "atom/common/api/atom_api_native_image.h" #include "atom/common/native_mate_converters/callback.h" #include "chrome/browser/icon_loader.h" #include "chrome/browser/process_singleton.h"