reverts AcceleratedWidgetMacNSView into offscreen class
This commit is contained in:
parent
795753286b
commit
f29dc3402b
4 changed files with 28 additions and 27 deletions
|
@ -12,7 +12,6 @@
|
||||||
|
|
||||||
#include "base/mac/scoped_nsobject.h"
|
#include "base/mac/scoped_nsobject.h"
|
||||||
#include "atom/browser/native_window.h"
|
#include "atom/browser/native_window.h"
|
||||||
#include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
|
|
||||||
|
|
||||||
@class AtomNSWindow;
|
@class AtomNSWindow;
|
||||||
@class AtomNSWindowDelegate;
|
@class AtomNSWindowDelegate;
|
||||||
|
@ -20,9 +19,7 @@
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
class NativeWindowMac
|
class NativeWindowMac : public NativeWindow {
|
||||||
: public NativeWindow,
|
|
||||||
public ui::AcceleratedWidgetMacNSView {
|
|
||||||
public:
|
public:
|
||||||
NativeWindowMac(brightray::InspectableWebContents* inspectable_web_contents,
|
NativeWindowMac(brightray::InspectableWebContents* inspectable_web_contents,
|
||||||
const mate::Dictionary& options,
|
const mate::Dictionary& options,
|
||||||
|
@ -93,12 +90,6 @@ class NativeWindowMac
|
||||||
void SetVisibleOnAllWorkspaces(bool visible) override;
|
void SetVisibleOnAllWorkspaces(bool visible) override;
|
||||||
bool IsVisibleOnAllWorkspaces() override;
|
bool IsVisibleOnAllWorkspaces() override;
|
||||||
|
|
||||||
// ui::AcceleratedWidgetMacNSView:
|
|
||||||
NSView* AcceleratedWidgetGetNSView() const override;
|
|
||||||
void AcceleratedWidgetGetVSyncParameters(
|
|
||||||
base::TimeTicks* timebase, base::TimeDelta* interval) const override;
|
|
||||||
void AcceleratedWidgetSwapCompleted() override;
|
|
||||||
|
|
||||||
// Refresh the DraggableRegion views.
|
// Refresh the DraggableRegion views.
|
||||||
void UpdateDraggableRegionViews() {
|
void UpdateDraggableRegionViews() {
|
||||||
UpdateDraggableRegionViews(draggable_regions_);
|
UpdateDraggableRegionViews(draggable_regions_);
|
||||||
|
|
|
@ -1197,19 +1197,6 @@ void NativeWindowMac::SetCollectionBehavior(bool on, NSUInteger flag) {
|
||||||
SetMaximizable(was_maximizable);
|
SetMaximizable(was_maximizable);
|
||||||
}
|
}
|
||||||
|
|
||||||
NSView* atom::NativeWindowMac::AcceleratedWidgetGetNSView() const {
|
|
||||||
return [window_ contentView];
|
|
||||||
}
|
|
||||||
|
|
||||||
void atom::NativeWindowMac::AcceleratedWidgetGetVSyncParameters(
|
|
||||||
base::TimeTicks* timebase, base::TimeDelta* interval) const {
|
|
||||||
*timebase = base::TimeTicks();
|
|
||||||
*interval = base::TimeDelta();
|
|
||||||
}
|
|
||||||
|
|
||||||
void atom::NativeWindowMac::AcceleratedWidgetSwapCompleted() {
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
// static
|
||||||
NativeWindow* NativeWindow::Create(
|
NativeWindow* NativeWindow::Create(
|
||||||
brightray::InspectableWebContents* inspectable_web_contents,
|
brightray::InspectableWebContents* inspectable_web_contents,
|
||||||
|
|
|
@ -56,6 +56,9 @@ class AtomBeginFrameTimer;
|
||||||
|
|
||||||
class OffScreenRenderWidgetHostView
|
class OffScreenRenderWidgetHostView
|
||||||
: public content::RenderWidgetHostViewBase,
|
: public content::RenderWidgetHostViewBase,
|
||||||
|
#if defined(OS_MACOSX)
|
||||||
|
public ui::AcceleratedWidgetMacNSView,
|
||||||
|
#endif
|
||||||
public ui::CompositorDelegate,
|
public ui::CompositorDelegate,
|
||||||
public content::DelegatedFrameHostClient {
|
public content::DelegatedFrameHostClient {
|
||||||
public:
|
public:
|
||||||
|
@ -170,6 +173,14 @@ class OffScreenRenderWidgetHostView
|
||||||
bool IsAutoResizeEnabled() const;
|
bool IsAutoResizeEnabled() const;
|
||||||
void OnSetNeedsBeginFrames(bool enabled);
|
void OnSetNeedsBeginFrames(bool enabled);
|
||||||
|
|
||||||
|
#if defined(OS_MACOSX)
|
||||||
|
// ui::AcceleratedWidgetMacNSView:
|
||||||
|
NSView* AcceleratedWidgetGetNSView() const override;
|
||||||
|
void AcceleratedWidgetGetVSyncParameters(
|
||||||
|
base::TimeTicks* timebase, base::TimeDelta* interval) const override;
|
||||||
|
void AcceleratedWidgetSwapCompleted() override;
|
||||||
|
#endif // defined(OS_MACOSX)
|
||||||
|
|
||||||
void OnBeginFrameTimerTick();
|
void OnBeginFrameTimerTick();
|
||||||
void SendBeginFrame(base::TimeTicks frame_time,
|
void SendBeginFrame(base::TimeTicks frame_time,
|
||||||
base::TimeDelta vsync_period);
|
base::TimeDelta vsync_period);
|
||||||
|
@ -222,6 +233,8 @@ class OffScreenRenderWidgetHostView
|
||||||
std::unique_ptr<AtomBeginFrameTimer> begin_frame_timer_;
|
std::unique_ptr<AtomBeginFrameTimer> begin_frame_timer_;
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
|
NSWindow* window_;
|
||||||
|
CALayer* background_layer_;
|
||||||
std::unique_ptr<content::BrowserCompositorMac> browser_compositor_;
|
std::unique_ptr<content::BrowserCompositorMac> browser_compositor_;
|
||||||
|
|
||||||
// Selected text on the renderer.
|
// Selected text on the renderer.
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
#include "atom/browser/native_window_mac.h"
|
|
||||||
|
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
|
|
||||||
ui::AcceleratedWidgetMac*
|
ui::AcceleratedWidgetMac*
|
||||||
|
@ -17,6 +15,19 @@ atom::OffScreenRenderWidgetHostView::GetAcceleratedWidgetMac() const {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSView* atom::OffScreenRenderWidgetHostView::AcceleratedWidgetGetNSView() const {
|
||||||
|
return [native_window_->GetNativeWindow() contentView];
|
||||||
|
}
|
||||||
|
|
||||||
|
void atom::OffScreenRenderWidgetHostView::AcceleratedWidgetGetVSyncParameters(
|
||||||
|
base::TimeTicks* timebase, base::TimeDelta* interval) const {
|
||||||
|
*timebase = base::TimeTicks();
|
||||||
|
*interval = base::TimeDelta();
|
||||||
|
}
|
||||||
|
|
||||||
|
void atom::OffScreenRenderWidgetHostView::AcceleratedWidgetSwapCompleted() {
|
||||||
|
}
|
||||||
|
|
||||||
void atom::OffScreenRenderWidgetHostView::SetActive(bool active) {
|
void atom::OffScreenRenderWidgetHostView::SetActive(bool active) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,8 +74,7 @@ void atom::OffScreenRenderWidgetHostView::CreatePlatformWidget() {
|
||||||
|
|
||||||
compositor_.reset(browser_compositor_->compositor());
|
compositor_.reset(browser_compositor_->compositor());
|
||||||
compositor_->SetRootLayer(root_layer_.get());
|
compositor_->SetRootLayer(root_layer_.get());
|
||||||
browser_compositor_->accelerated_widget_mac()->SetNSView(
|
browser_compositor_->accelerated_widget_mac()->SetNSView(this);
|
||||||
static_cast<atom::NativeWindowMac*>(native_window_));
|
|
||||||
browser_compositor_->compositor()->SetVisible(true);
|
browser_compositor_->compositor()->SetVisible(true);
|
||||||
|
|
||||||
compositor_->SetLocksWillTimeOut(true);
|
compositor_->SetLocksWillTimeOut(true);
|
||||||
|
|
Loading…
Reference in a new issue