chore: stop using v8::Locker everywhere (#34078)

This commit is contained in:
Jeremy Rose 2022-05-05 11:50:21 -07:00 committed by GitHub
parent a2a8e493eb
commit d8a7219d07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 0 additions and 43 deletions

View file

@ -802,7 +802,6 @@ bool App::CanCreateWindow(
bool opener_suppressed,
bool* no_javascript_access) {
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
content::WebContents* web_contents =
content::WebContents::FromRenderFrameHost(opener);
@ -828,7 +827,6 @@ void App::AllowCertificateError(
base::OnceCallback<void(content::CertificateRequestResultType)> callback) {
auto adapted_callback = base::AdaptCallbackForRepeating(std::move(callback));
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
bool prevent_default = Emit(
"certificate-error", WebContents::FromOrCreate(isolate, web_contents),
@ -1086,7 +1084,6 @@ std::string App::GetLocaleCountryCode() {
void App::OnFirstInstanceAck(
const base::span<const uint8_t>* first_instance_data) {
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
base::Value data_to_send;
if (first_instance_data) {
@ -1120,7 +1117,6 @@ void App::OnSecondInstance(
const std::vector<uint8_t> additional_data,
const ProcessSingleton::NotificationAckCallback& ack_callback) {
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Value> data_value =
DeserializeV8Value(isolate, std::move(additional_data));

View file

@ -32,7 +32,6 @@ AutoUpdater::~AutoUpdater() {
void AutoUpdater::OnError(const std::string& message) {
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Object> wrapper;
if (GetWrapper(isolate).ToLocal(&wrapper)) {
@ -49,7 +48,6 @@ void AutoUpdater::OnError(const std::string& message,
const int code,
const std::string& domain) {
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Object> wrapper;
if (GetWrapper(isolate).ToLocal(&wrapper)) {

View file

@ -209,7 +209,6 @@ void BaseWindow::OnWindowWillResize(const gfx::Rect& new_bounds,
const gfx::ResizeEdge& edge,
bool* prevent_default) {
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
gin_helper::Dictionary info = gin::Dictionary::CreateEmpty(isolate);
info.Set("edge", edge);
@ -309,7 +308,6 @@ void BaseWindow::OnSystemContextMenu(int x, int y, bool* prevent_default) {
void BaseWindow::OnWindowMessage(UINT message, WPARAM w_param, LPARAM l_param) {
if (IsWindowMessageHooked(message)) {
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::Locker locker(isolate);
v8::HandleScope scope(isolate);
messages_callback_map_[message].Run(
ToBuffer(isolate, static_cast<void*>(&w_param), sizeof(WPARAM)),

View file

@ -349,7 +349,6 @@ void BrowserWindow::UpdateWindowControlsOverlay(
void BrowserWindow::CloseImmediately() {
// Close all child windows before closing current window.
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
for (v8::Local<v8::Value> value : child_windows_.Values(isolate())) {
gin::Handle<BrowserWindow> child;

View file

@ -107,7 +107,6 @@ class DataPipeReader {
//
// Note that the lifetime of the native buffer belongs to us, and we will
// free memory when JS buffer gets garbage collected.
v8::Locker locker(promise_.isolate());
v8::HandleScope handle_scope(promise_.isolate());
v8::Local<v8::Value> buffer =
node::Buffer::New(promise_.isolate(), &buffer_.front(), buffer_.size(),

View file

@ -43,8 +43,6 @@ void Debugger::DispatchProtocolMessage(DevToolsAgentHost* agent_host,
DCHECK(agent_host == agent_host_);
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
base::StringPiece message_str(reinterpret_cast<const char*>(message.data()),

View file

@ -155,7 +155,6 @@ void DesktopCapturer::UpdateSourcesList(DesktopMediaList* list) {
if (!webrtc::DxgiDuplicatorController::Instance()->GetDeviceNames(
&device_names)) {
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::Locker locker(isolate);
v8::HandleScope scope(isolate);
gin_helper::CallMethod(this, "_onerror", "Failed to get sources.");
@ -191,7 +190,6 @@ void DesktopCapturer::UpdateSourcesList(DesktopMediaList* list) {
if (!capture_window_ && !capture_screen_) {
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::Locker locker(isolate);
v8::HandleScope scope(isolate);
gin_helper::CallMethod(this, "_onfinished", captured_sources_);

View file

@ -146,7 +146,6 @@ void Menu::OnMenuWillShow(ui::SimpleMenuModel* source) {
base::OnceClosure Menu::BindSelfToClosure(base::OnceClosure callback) {
// return ((callback, ref) => { callback() }).bind(null, callback, this)
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::Locker locker(isolate);
v8::HandleScope scope(isolate);
v8::Local<v8::Object> self;
if (GetWrapper(isolate).ToLocal(&self)) {

View file

@ -372,7 +372,6 @@ void Session::OnDownloadCreated(content::DownloadManager* manager,
if (item->IsSavePackageDownload())
return;
v8::Locker locker(isolate_);
v8::HandleScope handle_scope(isolate_);
auto handle = DownloadItem::FromOrCreate(isolate_, item);
if (item->GetState() == download::DownloadItem::INTERRUPTED)

View file

@ -389,7 +389,6 @@ gfx::Rect Tray::GetBounds() {
bool Tray::CheckAlive() {
if (!tray_icon_) {
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::Locker locker(isolate);
v8::HandleScope scope(isolate);
gin_helper::ErrorThrower(isolate).ThrowError("Tray is destroyed");
return false;

View file

@ -1041,7 +1041,6 @@ void WebContents::WebContentsCreatedWithFullParams(
tracker->body = params.body;
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
gin_helper::Dictionary dict;
@ -1073,7 +1072,6 @@ bool WebContents::IsWebContentsCreationOverridden(
void WebContents::SetNextChildWebPreferences(
const gin_helper::Dictionary preferences) {
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
// Store these prefs for when Chrome calls WebContentsCreatedWithFullParams
// with the new child contents.
@ -1105,7 +1103,6 @@ void WebContents::AddNewContents(
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
auto api_web_contents =
CreateAndTake(isolate, std::move(new_contents), Type::kBrowserWindow);
@ -1392,7 +1389,6 @@ void WebContents::FindReply(content::WebContents* web_contents,
return;
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
gin_helper::Dictionary result = gin::Dictionary::CreateEmpty(isolate);
result.Set("requestId", request_id);
@ -1991,7 +1987,6 @@ void WebContents::DevToolsFocused() {
void WebContents::DevToolsOpened() {
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
DCHECK(inspectable_web_contents_);
DCHECK(inspectable_web_contents_->GetDevToolsWebContents());
@ -2015,7 +2010,6 @@ void WebContents::DevToolsOpened() {
void WebContents::DevToolsClosed() {
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
devtools_web_contents_.Reset();

View file

@ -108,7 +108,6 @@ void WebFrameMain::UpdateRenderFrameHost(content::RenderFrameHost* rfh) {
bool WebFrameMain::CheckRenderFrame() const {
if (render_frame_disposed_) {
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::Locker locker(isolate);
v8::HandleScope scope(isolate);
gin_helper::ErrorThrower(isolate).ThrowError(
"Render frame was disposed before WebFrameMain could be accessed");