Skip to content

Commit

Permalink
Revert "fix: ensure ready-to-show event is fired (#25448)"
Browse files Browse the repository at this point in the history
This reverts commit e5933c6.
  • Loading branch information
CezaryKulakowski authored and electron-bot committed Sep 28, 2020
1 parent 634b76e commit a38f171
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 25 deletions.
22 changes: 1 addition & 21 deletions shell/browser/api/electron_api_browser_window.cc
Expand Up @@ -157,32 +157,12 @@ void BrowserWindow::DidFirstVisuallyNonEmptyPaint() {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(
[](base::WeakPtr<BrowserWindow> self) {
if (self && !self->did_ready_to_show_fired_) {
self->did_ready_to_show_fired_ = true;
if (self)
self->Emit("ready-to-show");
}
},
GetWeakPtr()));
}

void BrowserWindow::DidFinishLoad(content::RenderFrameHost* render_frame_host,
const GURL& validated_url) {
// The DidFirstVisuallyNonEmptyPaint event is not very stable that, sometimes
// on some machines it might not be fired, and the actual behavior depends on
// the version of Chromium.
// To work around this bug, we ensure the ready-to-show event is emitted if it
// has not been emitted in did-finish-load event.
// Note that we use did-finish-load event instead of dom-ready event because
// the latter may actually be emitted before the ready-to-show event.
// See also https://github.com/electron/electron/issues/7779.
if (window()->IsVisible() || did_ready_to_show_fired_)
return;
if (render_frame_host->GetParent()) // child frame
return;
did_ready_to_show_fired_ = true;
Emit("ready-to-show");
}

void BrowserWindow::BeforeUnloadDialogCancelled() {
WindowList::WindowCloseCancelled(window());
// Cancel unresponsive event when window close is cancelled.
Expand Down
4 changes: 0 additions & 4 deletions shell/browser/api/electron_api_browser_window.h
Expand Up @@ -49,8 +49,6 @@ class BrowserWindow : public BaseWindow,
content::RenderViewHost* new_host) override;
void RenderViewCreated(content::RenderViewHost* render_view_host) override;
void DidFirstVisuallyNonEmptyPaint() override;
void DidFinishLoad(content::RenderFrameHost* render_frame_host,
const GURL& validated_url) override;
void BeforeUnloadDialogCancelled() override;
void OnRendererUnresponsive(content::RenderProcessHost*) override;
void OnRendererResponsive(
Expand Down Expand Up @@ -121,8 +119,6 @@ class BrowserWindow : public BaseWindow,
// it should be cancelled when we can prove that the window is responsive.
base::CancelableClosure window_unresponsive_closure_;

bool did_ready_to_show_fired_ = false;

#if defined(OS_MAC)
std::vector<mojom::DraggableRegionPtr> draggable_regions_;
#endif
Expand Down

0 comments on commit a38f171

Please sign in to comment.