chore: fix typos in 'shell/' folder. (#43373)

This commit is contained in:
Alexander Cyon 2024-08-23 02:48:32 +02:00 committed by GitHub
parent 1aeca6fd0e
commit ca0837c852
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 36 additions and 36 deletions

View file

@ -261,7 +261,7 @@ class ClearDataTask {
} }
private: 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 // of a full |ClearDataTask|. This class manages its own lifetime, cleaning
// itself up after the operation completes and notifies the task of the // itself up after the operation completes and notifies the task of the
// result. // result.

View file

@ -519,7 +519,7 @@ api::scripting::RegisteredContentScript CreateRegisteredContentScriptInfo(
converted.reserve(sources.size()); converted.reserve(sources.size());
for (auto& source : sources) { for (auto& source : sources) {
CHECK(source.file) 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)); converted.push_back(std::move(*source.file));
} }
return converted; return converted;

View file

@ -448,7 +448,7 @@ class NativeWindow : public base::SupportsUserData,
// Minimum and maximum size. // Minimum and maximum size.
std::optional<extensions::SizeConstraints> size_constraints_; std::optional<extensions::SizeConstraints> size_constraints_;
// Same as above but stored as content size, we are storing 2 types of size // 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. // on HiDPI displays on some environments.
std::optional<extensions::SizeConstraints> content_size_constraints_; std::optional<extensions::SizeConstraints> content_size_constraints_;

View file

@ -569,7 +569,7 @@ bool NativeWindowViews::IsVisible() const {
// current window. // current window.
bool visible = bool visible =
::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE) & WS_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(); return visible && !IsMinimized();
#else #else
return widget()->IsVisible(); return widget()->IsVisible();

View file

@ -9,7 +9,7 @@
namespace mojo { namespace mojo {
template <typename T> template <typename T>
class PendingReciever; class PendingReceiver;
template <typename T> template <typename T>
class PendingRemote; class PendingRemote;
} // namespace mojo } // namespace mojo

View file

@ -35,7 +35,7 @@
namespace mojo { namespace mojo {
template <typename T> template <typename T>
class PendingReciever; class PendingReceiver;
template <typename T> template <typename T>
class PendingRemote; class PendingRemote;
} // namespace mojo } // namespace mojo

View file

@ -27,7 +27,7 @@ class RenderFrameHost;
namespace mojo { namespace mojo {
template <typename T> template <typename T>
class PendingReciever; class PendingReceiver;
template <typename T> template <typename T>
class PendingRemote; class PendingRemote;
} // namespace mojo } // namespace mojo

View file

@ -24,7 +24,7 @@
namespace mojo { namespace mojo {
template <typename T> template <typename T>
class PendingReciever; class PendingReceiver;
template <typename T> template <typename T>
class PendingRemote; class PendingRemote;
} // namespace mojo } // namespace mojo

View file

@ -344,7 +344,7 @@
"name": "popupView", "name": "popupView",
"type": "object", "type": "object",
"optional": true, "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": { "additionalProperties": {
"type": "any" "type": "any"
} }

View file

@ -18,11 +18,11 @@ struct Converter<base::RepeatingCallback<Sig>> {
const base::RepeatingCallback<Sig>& val) { const base::RepeatingCallback<Sig>& val) {
// We don't use CreateFunctionTemplate here because it creates a new // We don't use CreateFunctionTemplate here because it creates a new
// FunctionTemplate everytime, which is cached by V8 and causes leaks. // FunctionTemplate everytime, which is cached by V8 and causes leaks.
auto translater = auto translator =
base::BindRepeating(&gin_helper::NativeFunctionInvoker<Sig>::Go, val); base::BindRepeating(&gin_helper::NativeFunctionInvoker<Sig>::Go, val);
// To avoid memory leak, we ensure that the callback can only be called // To avoid memory leak, we ensure that the callback can only be called
// for once. // for once.
return gin_helper::CreateFunctionFromTranslater(isolate, translater, true); return gin_helper::CreateFunctionFromTranslator(isolate, translator, true);
} }
static bool FromV8(v8::Isolate* isolate, static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val, v8::Local<v8::Value> val,

View file

@ -12,30 +12,30 @@ namespace gin_helper {
namespace { namespace {
struct TranslaterHolder { struct TranslatorHolder {
explicit TranslaterHolder(v8::Isolate* isolate) explicit TranslatorHolder(v8::Isolate* isolate)
: handle(isolate, v8::External::New(isolate, this)) { : handle(isolate, v8::External::New(isolate, this)) {
handle.SetWeak(this, &GC, v8::WeakCallbackType::kParameter); handle.SetWeak(this, &GC, v8::WeakCallbackType::kParameter);
} }
~TranslaterHolder() { ~TranslatorHolder() {
if (!handle.IsEmpty()) { if (!handle.IsEmpty()) {
handle.ClearWeak(); handle.ClearWeak();
handle.Reset(); handle.Reset();
} }
} }
static void GC(const v8::WeakCallbackInfo<TranslaterHolder>& data) { static void GC(const v8::WeakCallbackInfo<TranslatorHolder>& data) {
delete data.GetParameter(); delete data.GetParameter();
} }
v8::Global<v8::External> handle; v8::Global<v8::External> handle;
Translater translater; Translator translator;
}; };
// Cached JavaScript version of |CallTranslater|. // Cached JavaScript version of |CallTranslator|.
v8::Persistent<v8::FunctionTemplate> g_call_translater; 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, v8::Local<v8::Object> state,
gin::Arguments* args) { gin::Arguments* args) {
// Whether the callback should only be called once. // Whether the callback should only be called once.
@ -56,8 +56,8 @@ void CallTranslater(v8::Local<v8::External> external,
} }
} }
auto* holder = static_cast<TranslaterHolder*>(external->Value()); auto* holder = static_cast<TranslatorHolder*>(external->Value());
holder->translater.Run(args); holder->translator.Run(args);
// Free immediately for one-time callback. // Free immediately for one-time callback.
if (one_time) if (one_time)
@ -113,25 +113,25 @@ v8::Local<v8::Function> SafeV8Function::NewHandle(v8::Isolate* isolate) const {
return v8_function_->NewHandle(isolate); return v8_function_->NewHandle(isolate);
} }
v8::Local<v8::Value> CreateFunctionFromTranslater(v8::Isolate* isolate, v8::Local<v8::Value> CreateFunctionFromTranslator(v8::Isolate* isolate,
const Translater& translater, const Translator& translator,
bool one_time) { bool one_time) {
// The FunctionTemplate is cached. // The FunctionTemplate is cached.
if (g_call_translater.IsEmpty()) if (g_call_translator.IsEmpty())
g_call_translater.Reset( g_call_translator.Reset(
isolate, isolate,
CreateFunctionTemplate(isolate, base::BindRepeating(&CallTranslater))); CreateFunctionTemplate(isolate, base::BindRepeating(&CallTranslator)));
v8::Local<v8::FunctionTemplate> call_translater = v8::Local<v8::FunctionTemplate> call_translator =
v8::Local<v8::FunctionTemplate>::New(isolate, g_call_translater); v8::Local<v8::FunctionTemplate>::New(isolate, g_call_translator);
auto* holder = new TranslaterHolder(isolate); auto* holder = new TranslatorHolder(isolate);
holder->translater = translater; holder->translator = translator;
auto state = gin::Dictionary::CreateEmpty(isolate); auto state = gin::Dictionary::CreateEmpty(isolate);
if (one_time) if (one_time)
state.Set("oneTime", true); state.Set("oneTime", true);
auto context = isolate->GetCurrentContext(); auto context = isolate->GetCurrentContext();
return BindFunctionWith( return BindFunctionWith(
isolate, context, call_translater->GetFunction(context).ToLocalChecked(), isolate, context, call_translator->GetFunction(context).ToLocalChecked(),
holder->handle.Get(isolate), gin::ConvertToV8(isolate, state)); holder->handle.Get(isolate), gin::ConvertToV8(isolate, state));
} }

View file

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