Skip to content

Commit

Permalink
chore: fix typos in 'shell/' folder. (#43373)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sajjon authored Aug 23, 2024
1 parent 1aeca6f commit ca0837c
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion shell/browser/api/electron_api_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ class ClearDataTask {
}

private:
// An individiual |content::BrowsingDataRemover::Remove...| operation as part
// An individual |content::BrowsingDataRemover::Remove...| operation as part
// of a full |ClearDataTask|. This class manages its own lifetime, cleaning
// itself up after the operation completes and notifies the task of the
// result.
Expand Down
2 changes: 1 addition & 1 deletion shell/browser/extensions/api/scripting/scripting_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ api::scripting::RegisteredContentScript CreateRegisteredContentScriptInfo(
converted.reserve(sources.size());
for (auto& source : sources) {
CHECK(source.file)
<< "Content scripts don't allow arbtirary code strings";
<< "Content scripts don't allow arbitrary code strings";
converted.push_back(std::move(*source.file));
}
return converted;
Expand Down
2 changes: 1 addition & 1 deletion shell/browser/native_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ class NativeWindow : public base::SupportsUserData,
// Minimum and maximum size.
std::optional<extensions::SizeConstraints> size_constraints_;
// Same as above but stored as content size, we are storing 2 types of size
// constraints beacause converting between them will cause rounding errors
// constraints because converting between them will cause rounding errors
// on HiDPI displays on some environments.
std::optional<extensions::SizeConstraints> content_size_constraints_;

Expand Down
2 changes: 1 addition & 1 deletion shell/browser/native_window_views.cc
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ bool NativeWindowViews::IsVisible() const {
// current window.
bool visible =
::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE) & WS_VISIBLE;
// WS_VISIBLE is true even if a window is miminized - explicitly check that.
// WS_VISIBLE is true even if a window is minimized - explicitly check that.
return visible && !IsMinimized();
#else
return widget()->IsVisible();
Expand Down
2 changes: 1 addition & 1 deletion shell/browser/net/asar/asar_url_loader_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace mojo {
template <typename T>
class PendingReciever;
class PendingReceiver;
template <typename T>
class PendingRemote;
} // namespace mojo
Expand Down
2 changes: 1 addition & 1 deletion shell/browser/net/proxying_url_loader_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

namespace mojo {
template <typename T>
class PendingReciever;
class PendingReceiver;
template <typename T>
class PendingRemote;
} // namespace mojo
Expand Down
2 changes: 1 addition & 1 deletion shell/browser/usb/electron_usb_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class RenderFrameHost;

namespace mojo {
template <typename T>
class PendingReciever;
class PendingReceiver;
template <typename T>
class PendingRemote;
} // namespace mojo
Expand Down
2 changes: 1 addition & 1 deletion shell/browser/usb/usb_chooser_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

namespace mojo {
template <typename T>
class PendingReciever;
class PendingReceiver;
template <typename T>
class PendingRemote;
} // namespace mojo
Expand Down
2 changes: 1 addition & 1 deletion shell/common/extensions/api/browser_action.json
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@
"name": "popupView",
"type": "object",
"optional": true,
"description": "JavaScript 'window' object for the popup window if it was succesfully opened.",
"description": "JavaScript 'window' object for the popup window if it was successfully opened.",
"additionalProperties": {
"type": "any"
}
Expand Down
4 changes: 2 additions & 2 deletions shell/common/gin_converters/callback_converter.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ struct Converter<base::RepeatingCallback<Sig>> {
const base::RepeatingCallback<Sig>& val) {
// We don't use CreateFunctionTemplate here because it creates a new
// FunctionTemplate everytime, which is cached by V8 and causes leaks.
auto translater =
auto translator =
base::BindRepeating(&gin_helper::NativeFunctionInvoker<Sig>::Go, val);
// To avoid memory leak, we ensure that the callback can only be called
// for once.
return gin_helper::CreateFunctionFromTranslater(isolate, translater, true);
return gin_helper::CreateFunctionFromTranslator(isolate, translator, true);
}
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
Expand Down
40 changes: 20 additions & 20 deletions shell/common/gin_helper/callback.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,30 @@ namespace gin_helper {

namespace {

struct TranslaterHolder {
explicit TranslaterHolder(v8::Isolate* isolate)
struct TranslatorHolder {
explicit TranslatorHolder(v8::Isolate* isolate)
: handle(isolate, v8::External::New(isolate, this)) {
handle.SetWeak(this, &GC, v8::WeakCallbackType::kParameter);
}
~TranslaterHolder() {
~TranslatorHolder() {
if (!handle.IsEmpty()) {
handle.ClearWeak();
handle.Reset();
}
}

static void GC(const v8::WeakCallbackInfo<TranslaterHolder>& data) {
static void GC(const v8::WeakCallbackInfo<TranslatorHolder>& data) {
delete data.GetParameter();
}

v8::Global<v8::External> handle;
Translater translater;
Translator translator;
};

// Cached JavaScript version of |CallTranslater|.
v8::Persistent<v8::FunctionTemplate> g_call_translater;
// Cached JavaScript version of |CallTranslator|.
v8::Persistent<v8::FunctionTemplate> g_call_translator;

void CallTranslater(v8::Local<v8::External> external,
void CallTranslator(v8::Local<v8::External> external,
v8::Local<v8::Object> state,
gin::Arguments* args) {
// Whether the callback should only be called once.
Expand All @@ -56,8 +56,8 @@ void CallTranslater(v8::Local<v8::External> external,
}
}

auto* holder = static_cast<TranslaterHolder*>(external->Value());
holder->translater.Run(args);
auto* holder = static_cast<TranslatorHolder*>(external->Value());
holder->translator.Run(args);

// Free immediately for one-time callback.
if (one_time)
Expand Down Expand Up @@ -113,25 +113,25 @@ v8::Local<v8::Function> SafeV8Function::NewHandle(v8::Isolate* isolate) const {
return v8_function_->NewHandle(isolate);
}

v8::Local<v8::Value> CreateFunctionFromTranslater(v8::Isolate* isolate,
const Translater& translater,
v8::Local<v8::Value> CreateFunctionFromTranslator(v8::Isolate* isolate,
const Translator& translator,
bool one_time) {
// The FunctionTemplate is cached.
if (g_call_translater.IsEmpty())
g_call_translater.Reset(
if (g_call_translator.IsEmpty())
g_call_translator.Reset(
isolate,
CreateFunctionTemplate(isolate, base::BindRepeating(&CallTranslater)));
CreateFunctionTemplate(isolate, base::BindRepeating(&CallTranslator)));

v8::Local<v8::FunctionTemplate> call_translater =
v8::Local<v8::FunctionTemplate>::New(isolate, g_call_translater);
auto* holder = new TranslaterHolder(isolate);
holder->translater = translater;
v8::Local<v8::FunctionTemplate> call_translator =
v8::Local<v8::FunctionTemplate>::New(isolate, g_call_translator);
auto* holder = new TranslatorHolder(isolate);
holder->translator = translator;
auto state = gin::Dictionary::CreateEmpty(isolate);
if (one_time)
state.Set("oneTime", true);
auto context = isolate->GetCurrentContext();
return BindFunctionWith(
isolate, context, call_translater->GetFunction(context).ToLocalChecked(),
isolate, context, call_translator->GetFunction(context).ToLocalChecked(),
holder->handle.Get(isolate), gin::ConvertToV8(isolate, state));
}

Expand Down
10 changes: 5 additions & 5 deletions shell/common/gin_helper/callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ struct V8FunctionInvoker<ReturnType(ArgTypes...)> {
};

// Helper to pass a C++ function to JavaScript.
using Translater = base::RepeatingCallback<void(gin::Arguments* args)>;
v8::Local<v8::Value> CreateFunctionFromTranslater(v8::Isolate* isolate,
const Translater& translater,
using Translator = base::RepeatingCallback<void(gin::Arguments* args)>;
v8::Local<v8::Value> CreateFunctionFromTranslator(v8::Isolate* isolate,
const Translator& translator,
bool one_time);
v8::Local<v8::Value> BindFunctionWith(v8::Isolate* isolate,
v8::Local<v8::Context> context,
Expand Down Expand Up @@ -149,9 +149,9 @@ template <typename Sig>
v8::Local<v8::Value> CallbackToV8Leaked(
v8::Isolate* isolate,
const base::RepeatingCallback<Sig>& val) {
Translater translater =
Translator translator =
base::BindRepeating(&NativeFunctionInvoker<Sig>::Go, val);
return CreateFunctionFromTranslater(isolate, translater, false);
return CreateFunctionFromTranslator(isolate, translator, false);
}

} // namespace gin_helper
Expand Down

0 comments on commit ca0837c

Please sign in to comment.