Put locker and handle scope to the top of the function. Remove unneeded header

This commit is contained in:
Yury Solovyov 2016-11-06 12:58:01 +03:00 committed by Kevin Sawicki
parent 11ef2c539b
commit c2bf5bb986
2 changed files with 7 additions and 6 deletions

View file

@ -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<v8::String> 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,

View file

@ -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"