build: remove enable_osr build flag (#38703)
Co-authored-by: Milan Burda <miburda@microsoft.com>
This commit is contained in:
parent
80a3ba5c68
commit
e37111edcc
14 changed files with 21 additions and 108 deletions
|
@ -83,7 +83,6 @@ BaseWindow::BaseWindow(v8::Isolate* isolate,
|
|||
if (options.Get("parent", &parent) && !parent.IsEmpty())
|
||||
parent_window_.Reset(isolate, parent.ToV8());
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
// Offscreen windows are always created frameless.
|
||||
gin_helper::Dictionary web_preferences;
|
||||
bool offscreen;
|
||||
|
@ -91,7 +90,6 @@ BaseWindow::BaseWindow(v8::Isolate* isolate,
|
|||
web_preferences.Get(options::kOffscreen, &offscreen) && offscreen) {
|
||||
const_cast<gin_helper::Dictionary&>(options).Set(options::kFrame, false);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Creates NativeWindow.
|
||||
window_.reset(NativeWindow::Create(
|
||||
|
|
|
@ -91,6 +91,8 @@
|
|||
#include "shell/browser/electron_navigation_throttle.h"
|
||||
#include "shell/browser/file_select_helper.h"
|
||||
#include "shell/browser/native_window.h"
|
||||
#include "shell/browser/osr/osr_render_widget_host_view.h"
|
||||
#include "shell/browser/osr/osr_web_contents_view.h"
|
||||
#include "shell/browser/session_preferences.h"
|
||||
#include "shell/browser/ui/drag_util.h"
|
||||
#include "shell/browser/ui/file_dialog.h"
|
||||
|
@ -140,11 +142,6 @@
|
|||
#include "ui/display/screen.h"
|
||||
#include "ui/events/base_event_utils.h"
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
#include "shell/browser/osr/osr_render_widget_host_view.h"
|
||||
#include "shell/browser/osr/osr_web_contents_view.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
#include "shell/browser/native_window_views.h"
|
||||
#endif
|
||||
|
@ -350,10 +347,8 @@ struct Converter<electron::api::WebContents::Type> {
|
|||
*out = Type::kBrowserView;
|
||||
} else if (type == "webview") {
|
||||
*out = Type::kWebView;
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
} else if (type == "offscreen") {
|
||||
*out = Type::kOffScreen;
|
||||
#endif
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -845,11 +840,9 @@ WebContents::WebContents(v8::Isolate* isolate,
|
|||
// Get type
|
||||
options.Get("type", &type_);
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
bool b = false;
|
||||
if (options.Get(options::kOffscreen, &b) && b)
|
||||
type_ = Type::kOffScreen;
|
||||
#endif
|
||||
|
||||
// Init embedder earlier
|
||||
options.Get("embedder", &embedder_);
|
||||
|
@ -886,7 +879,6 @@ WebContents::WebContents(v8::Isolate* isolate,
|
|||
std::make_unique<WebViewGuestDelegate>(embedder_->web_contents(), this);
|
||||
params.guest_delegate = guest_delegate_.get();
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
if (embedder_ && embedder_->IsOffScreen()) {
|
||||
auto* view = new OffScreenWebContentsView(
|
||||
false,
|
||||
|
@ -897,9 +889,7 @@ WebContents::WebContents(v8::Isolate* isolate,
|
|||
web_contents = content::WebContents::Create(params);
|
||||
view->SetWebContents(web_contents.get());
|
||||
} else {
|
||||
#endif
|
||||
web_contents = content::WebContents::Create(params);
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
}
|
||||
} else if (IsOffScreen()) {
|
||||
// webPreferences does not have a transparent option, so if the window needs
|
||||
|
@ -918,7 +908,6 @@ WebContents::WebContents(v8::Isolate* isolate,
|
|||
|
||||
web_contents = content::WebContents::Create(params);
|
||||
view->SetWebContents(web_contents.get());
|
||||
#endif
|
||||
} else {
|
||||
content::WebContents::CreateParams params(session->browser_context());
|
||||
params.initially_hidden = !initially_shown;
|
||||
|
@ -2304,11 +2293,9 @@ void WebContents::SetOwnerWindow(content::WebContents* web_contents,
|
|||
owner_window_ = nullptr;
|
||||
web_contents->RemoveUserData(NativeWindowRelay::UserDataKey());
|
||||
}
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
auto* osr_wcv = GetOffScreenWebContentsView();
|
||||
if (osr_wcv)
|
||||
osr_wcv->SetNativeWindow(owner_window);
|
||||
#endif
|
||||
}
|
||||
|
||||
content::WebContents* WebContents::GetWebContents() const {
|
||||
|
@ -3330,9 +3317,7 @@ void WebContents::SendInputEvent(v8::Isolate* isolate,
|
|||
blink::WebMouseEvent mouse_event;
|
||||
if (gin::ConvertFromV8(isolate, input_event, &mouse_event)) {
|
||||
if (IsOffScreen()) {
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
GetOffScreenRenderWidgetHostView()->SendMouseEvent(mouse_event);
|
||||
#endif
|
||||
} else {
|
||||
rwh->ForwardMouseEvent(mouse_event);
|
||||
}
|
||||
|
@ -3353,10 +3338,8 @@ void WebContents::SendInputEvent(v8::Isolate* isolate,
|
|||
blink::WebMouseWheelEvent mouse_wheel_event;
|
||||
if (gin::ConvertFromV8(isolate, input_event, &mouse_wheel_event)) {
|
||||
if (IsOffScreen()) {
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
GetOffScreenRenderWidgetHostView()->SendMouseWheelEvent(
|
||||
mouse_wheel_event);
|
||||
#endif
|
||||
} else {
|
||||
// Chromium expects phase info in wheel events (and applies a
|
||||
// DCHECK to verify it). See: https://crbug.com/756524.
|
||||
|
@ -3524,14 +3507,9 @@ void WebContents::AttachToIframe(content::WebContents* embedder_web_contents,
|
|||
}
|
||||
|
||||
bool WebContents::IsOffScreen() const {
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
return type_ == Type::kOffScreen;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
void WebContents::OnPaint(const gfx::Rect& dirty_rect, const SkBitmap& bitmap) {
|
||||
Emit("paint", dirty_rect, gfx::Image::CreateFrom1xBitmap(bitmap));
|
||||
}
|
||||
|
@ -3563,15 +3541,12 @@ int WebContents::GetFrameRate() const {
|
|||
auto* osr_wcv = GetOffScreenWebContentsView();
|
||||
return osr_wcv ? osr_wcv->GetFrameRate() : 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void WebContents::Invalidate() {
|
||||
if (IsOffScreen()) {
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
auto* osr_rwhv = GetOffScreenRenderWidgetHostView();
|
||||
if (osr_rwhv)
|
||||
osr_rwhv->Invalidate();
|
||||
#endif
|
||||
} else {
|
||||
auto* const window = owner_window();
|
||||
if (window)
|
||||
|
@ -4301,13 +4276,11 @@ void WebContents::FillObjectTemplate(v8::Isolate* isolate,
|
|||
.SetMethod("attachToIframe", &WebContents::AttachToIframe)
|
||||
.SetMethod("detachFromOuterFrame", &WebContents::DetachFromOuterFrame)
|
||||
.SetMethod("isOffscreen", &WebContents::IsOffScreen)
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
.SetMethod("startPainting", &WebContents::StartPainting)
|
||||
.SetMethod("stopPainting", &WebContents::StopPainting)
|
||||
.SetMethod("isPainting", &WebContents::IsPainting)
|
||||
.SetMethod("setFrameRate", &WebContents::SetFrameRate)
|
||||
.SetMethod("getFrameRate", &WebContents::GetFrameRate)
|
||||
#endif
|
||||
.SetMethod("invalidate", &WebContents::Invalidate)
|
||||
.SetMethod("setZoomLevel", &WebContents::SetZoomLevel)
|
||||
.SetMethod("getZoomLevel", &WebContents::GetZoomLevel)
|
||||
|
|
|
@ -91,11 +91,8 @@ class WebViewGuestDelegate;
|
|||
class FrameSubscriber;
|
||||
class WebDialogHelper;
|
||||
class NativeWindow;
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
class OffScreenRenderWidgetHostView;
|
||||
class OffScreenWebContentsView;
|
||||
#endif
|
||||
|
||||
namespace api {
|
||||
|
||||
|
@ -285,14 +282,12 @@ class WebContents : public ExclusiveAccessContext,
|
|||
|
||||
// Methods for offscreen rendering
|
||||
bool IsOffScreen() const;
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
void OnPaint(const gfx::Rect& dirty_rect, const SkBitmap& bitmap);
|
||||
void StartPainting();
|
||||
void StopPainting();
|
||||
bool IsPainting() const;
|
||||
void SetFrameRate(int frame_rate);
|
||||
int GetFrameRate() const;
|
||||
#endif
|
||||
void Invalidate();
|
||||
gfx::Size GetSizeForNewRenderView(content::WebContents*) override;
|
||||
|
||||
|
@ -653,10 +648,8 @@ class WebContents : public ExclusiveAccessContext,
|
|||
|
||||
void OnElectronBrowserConnectionError();
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
OffScreenWebContentsView* GetOffScreenWebContentsView() const;
|
||||
OffScreenRenderWidgetHostView* GetOffScreenRenderWidgetHostView() const;
|
||||
#endif
|
||||
|
||||
// Called when received a synchronous message from renderer to
|
||||
// get the zoom level.
|
||||
|
|
|
@ -7,11 +7,8 @@
|
|||
#include "content/browser/renderer_host/frame_tree.h" // nogncheck
|
||||
#include "content/browser/renderer_host/frame_tree_node.h" // nogncheck
|
||||
#include "content/browser/web_contents/web_contents_impl.h" // nogncheck
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
#include "shell/browser/osr/osr_render_widget_host_view.h"
|
||||
#include "shell/browser/osr/osr_web_contents_view.h"
|
||||
#endif
|
||||
|
||||
// Including both web_contents_impl.h and node.h would introduce a error, we
|
||||
// have to isolate the usage of WebContentsImpl into a clean file to fix it:
|
||||
|
@ -31,7 +28,6 @@ void WebContents::DetachFromOuterFrame() {
|
|||
}
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
OffScreenWebContentsView* WebContents::GetOffScreenWebContentsView() const {
|
||||
if (IsOffScreen()) {
|
||||
const auto* impl =
|
||||
|
@ -51,6 +47,5 @@ OffScreenRenderWidgetHostView* WebContents::GetOffScreenRenderWidgetHostView()
|
|||
return nullptr;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace electron::api
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue