fix: missing HandleScopes in touch bar (#23936)
This commit is contained in:
parent
25e4a9431c
commit
2d47daa8c4
1 changed files with 44 additions and 0 deletions
|
@ -9,6 +9,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
|
#include "shell/browser/javascript_environment.h"
|
||||||
#include "shell/common/color_util.h"
|
#include "shell/common/color_util.h"
|
||||||
#include "shell/common/gin_converters/image_converter.h"
|
#include "shell/common/gin_converters/image_converter.h"
|
||||||
#include "skia/ext/skia_utils_mac.h"
|
#include "skia/ext/skia_utils_mac.h"
|
||||||
|
@ -195,6 +196,9 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||||
if (![self hasItemWithID:item_id])
|
if (![self hasItemWithID:item_id])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
v8::Isolate* isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||||
|
v8::HandleScope handle_scope(isolate);
|
||||||
|
|
||||||
gin_helper::PersistentDictionary settings = settings_[item_id];
|
gin_helper::PersistentDictionary settings = settings_[item_id];
|
||||||
std::string item_type;
|
std::string item_type;
|
||||||
settings.Get("type", &item_type);
|
settings.Get("type", &item_type);
|
||||||
|
@ -345,6 +349,9 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||||
if (![self hasItemWithID:s_id])
|
if (![self hasItemWithID:s_id])
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
|
v8::Isolate* isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||||
|
v8::HandleScope handle_scope(isolate);
|
||||||
|
|
||||||
gin_helper::PersistentDictionary settings = settings_[s_id];
|
gin_helper::PersistentDictionary settings = settings_[s_id];
|
||||||
base::scoped_nsobject<NSCustomTouchBarItem> item(
|
base::scoped_nsobject<NSCustomTouchBarItem> item(
|
||||||
[[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]);
|
[[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]);
|
||||||
|
@ -403,6 +410,9 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||||
if (![self hasItemWithID:s_id])
|
if (![self hasItemWithID:s_id])
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
|
v8::Isolate* isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||||
|
v8::HandleScope handle_scope(isolate);
|
||||||
|
|
||||||
gin_helper::PersistentDictionary settings = settings_[s_id];
|
gin_helper::PersistentDictionary settings = settings_[s_id];
|
||||||
base::scoped_nsobject<NSCustomTouchBarItem> item(
|
base::scoped_nsobject<NSCustomTouchBarItem> item(
|
||||||
[[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]);
|
[[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]);
|
||||||
|
@ -437,6 +447,9 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||||
if (![self hasItemWithID:s_id])
|
if (![self hasItemWithID:s_id])
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
|
v8::Isolate* isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||||
|
v8::HandleScope scope(isolate);
|
||||||
|
|
||||||
gin_helper::PersistentDictionary settings = settings_[s_id];
|
gin_helper::PersistentDictionary settings = settings_[s_id];
|
||||||
base::scoped_nsobject<NSColorPickerTouchBarItem> item(
|
base::scoped_nsobject<NSColorPickerTouchBarItem> item(
|
||||||
[[NSColorPickerTouchBarItem alloc] initWithIdentifier:identifier]);
|
[[NSColorPickerTouchBarItem alloc] initWithIdentifier:identifier]);
|
||||||
|
@ -472,6 +485,9 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||||
if (![self hasItemWithID:s_id])
|
if (![self hasItemWithID:s_id])
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
|
v8::Isolate* isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||||
|
v8::HandleScope handle_scope(isolate);
|
||||||
|
|
||||||
gin_helper::PersistentDictionary settings = settings_[s_id];
|
gin_helper::PersistentDictionary settings = settings_[s_id];
|
||||||
base::scoped_nsobject<NSSliderTouchBarItem> item(
|
base::scoped_nsobject<NSSliderTouchBarItem> item(
|
||||||
[[NSSliderTouchBarItem alloc] initWithIdentifier:identifier]);
|
[[NSSliderTouchBarItem alloc] initWithIdentifier:identifier]);
|
||||||
|
@ -505,6 +521,9 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||||
if (![self hasItemWithID:s_id])
|
if (![self hasItemWithID:s_id])
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
|
v8::Isolate* isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||||
|
v8::HandleScope handle_scope(isolate);
|
||||||
|
|
||||||
gin_helper::PersistentDictionary settings = settings_[s_id];
|
gin_helper::PersistentDictionary settings = settings_[s_id];
|
||||||
base::scoped_nsobject<NSPopoverTouchBarItem> item(
|
base::scoped_nsobject<NSPopoverTouchBarItem> item(
|
||||||
[[NSPopoverTouchBarItem alloc] initWithIdentifier:identifier]);
|
[[NSPopoverTouchBarItem alloc] initWithIdentifier:identifier]);
|
||||||
|
@ -527,6 +546,9 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||||
settings.Get("showCloseButton", &showCloseButton);
|
settings.Get("showCloseButton", &showCloseButton);
|
||||||
item.showsCloseButton = showCloseButton;
|
item.showsCloseButton = showCloseButton;
|
||||||
|
|
||||||
|
v8::Isolate* isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||||
|
v8::HandleScope handle_scope(isolate);
|
||||||
|
|
||||||
gin_helper::PersistentDictionary child;
|
gin_helper::PersistentDictionary child;
|
||||||
std::vector<gin_helper::PersistentDictionary> items;
|
std::vector<gin_helper::PersistentDictionary> items;
|
||||||
if (settings.Get("child", &child) && child.Get("ordereredItems", &items)) {
|
if (settings.Get("child", &child) && child.Get("ordereredItems", &items)) {
|
||||||
|
@ -540,6 +562,10 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||||
std::string s_id([id UTF8String]);
|
std::string s_id([id UTF8String]);
|
||||||
if (![self hasItemWithID:s_id])
|
if (![self hasItemWithID:s_id])
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
|
v8::Isolate* isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||||
|
v8::HandleScope handle_scope(isolate);
|
||||||
|
|
||||||
gin_helper::PersistentDictionary settings = settings_[s_id];
|
gin_helper::PersistentDictionary settings = settings_[s_id];
|
||||||
|
|
||||||
gin_helper::PersistentDictionary child;
|
gin_helper::PersistentDictionary child;
|
||||||
|
@ -568,6 +594,9 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||||
- (void)updateGroup:(NSGroupTouchBarItem*)item
|
- (void)updateGroup:(NSGroupTouchBarItem*)item
|
||||||
withSettings:(const gin_helper::PersistentDictionary&)settings
|
withSettings:(const gin_helper::PersistentDictionary&)settings
|
||||||
API_AVAILABLE(macosx(10.12.2)) {
|
API_AVAILABLE(macosx(10.12.2)) {
|
||||||
|
v8::Isolate* isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||||
|
v8::HandleScope handle_scope(isolate);
|
||||||
|
|
||||||
gin_helper::PersistentDictionary child;
|
gin_helper::PersistentDictionary child;
|
||||||
if (!settings.Get("child", &child))
|
if (!settings.Get("child", &child))
|
||||||
return;
|
return;
|
||||||
|
@ -586,6 +615,9 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||||
if (![self hasItemWithID:s_id])
|
if (![self hasItemWithID:s_id])
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
|
v8::Isolate* isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||||
|
v8::HandleScope handle_scope(isolate);
|
||||||
|
|
||||||
gin_helper::PersistentDictionary settings = settings_[s_id];
|
gin_helper::PersistentDictionary settings = settings_[s_id];
|
||||||
base::scoped_nsobject<NSCustomTouchBarItem> item(
|
base::scoped_nsobject<NSCustomTouchBarItem> item(
|
||||||
[[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]);
|
[[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]);
|
||||||
|
@ -671,6 +703,9 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||||
if (![self hasItemWithID:s_id])
|
if (![self hasItemWithID:s_id])
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
|
v8::Isolate* isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||||
|
v8::HandleScope handle_scope(isolate);
|
||||||
|
|
||||||
gin_helper::PersistentDictionary settings = settings_[s_id];
|
gin_helper::PersistentDictionary settings = settings_[s_id];
|
||||||
base::scoped_nsobject<NSCustomTouchBarItem> item(
|
base::scoped_nsobject<NSCustomTouchBarItem> item(
|
||||||
[[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]);
|
[[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]);
|
||||||
|
@ -748,6 +783,9 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||||
if (![self hasItemWithID:s_id])
|
if (![self hasItemWithID:s_id])
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
v8::Isolate* isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||||
|
v8::HandleScope handle_scope(isolate);
|
||||||
|
|
||||||
gin_helper::PersistentDictionary settings = settings_[s_id];
|
gin_helper::PersistentDictionary settings = settings_[s_id];
|
||||||
std::vector<gin_helper::PersistentDictionary> items;
|
std::vector<gin_helper::PersistentDictionary> items;
|
||||||
settings.Get("items", &items);
|
settings.Get("items", &items);
|
||||||
|
@ -761,6 +799,9 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||||
if (![self hasItemWithID:s_id])
|
if (![self hasItemWithID:s_id])
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
|
v8::Isolate* isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||||
|
v8::HandleScope handle_scope(isolate);
|
||||||
|
|
||||||
gin_helper::PersistentDictionary settings = settings_[s_id];
|
gin_helper::PersistentDictionary settings = settings_[s_id];
|
||||||
std::vector<gin_helper::PersistentDictionary> items;
|
std::vector<gin_helper::PersistentDictionary> items;
|
||||||
if (!settings.Get("items", &items))
|
if (!settings.Get("items", &items))
|
||||||
|
@ -805,6 +846,9 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||||
if (![self hasItemWithID:s_id])
|
if (![self hasItemWithID:s_id])
|
||||||
return defaultSize;
|
return defaultSize;
|
||||||
|
|
||||||
|
v8::Isolate* isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||||
|
v8::HandleScope handle_scope(isolate);
|
||||||
|
|
||||||
gin_helper::PersistentDictionary settings = settings_[s_id];
|
gin_helper::PersistentDictionary settings = settings_[s_id];
|
||||||
std::vector<gin_helper::PersistentDictionary> items;
|
std::vector<gin_helper::PersistentDictionary> items;
|
||||||
if (!settings.Get("items", &items))
|
if (!settings.Get("items", &items))
|
||||||
|
|
Loading…
Add table
Reference in a new issue