breaks down osr api to separate files

This commit is contained in:
gellert 2016-07-20 11:30:06 +02:00
parent 14836cef02
commit 8090278708
8 changed files with 373 additions and 295 deletions

View file

@ -34,7 +34,7 @@
#include "storage/browser/fileapi/isolated_context.h" #include "storage/browser/fileapi/isolated_context.h"
#include "content/browser/web_contents/web_contents_impl.h" #include "content/browser/web_contents/web_contents_impl.h"
#include "atom/browser/osr_window.h" #include "atom/browser/osr_web_contents_view.h"
#include "atom/browser/native_window_views.h" #include "atom/browser/native_window_views.h"
using content::BrowserThread; using content::BrowserThread;

View file

@ -0,0 +1,75 @@
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/browser/osr_output_device.h"
#include <iostream>
namespace atom {
OffScreenOutputDevice::OffScreenOutputDevice() {
std::cout << "OffScreenOutputDevice" << std::endl;
}
OffScreenOutputDevice::~OffScreenOutputDevice() {
std::cout << "~OffScreenOutputDevice" << std::endl;
}
void OffScreenOutputDevice::Resize(
const gfx::Size& pixel_size, float scale_factor) {
std::cout << "Resize" << std::endl;
std::cout << pixel_size.width() << "x" << pixel_size.height() << std::endl;
scale_factor_ = scale_factor;
if (viewport_pixel_size_ == pixel_size) return;
viewport_pixel_size_ = pixel_size;
canvas_.reset(NULL);
bitmap_.reset(new SkBitmap);
bitmap_->allocN32Pixels(viewport_pixel_size_.width(),
viewport_pixel_size_.height(),
false);
if (bitmap_->drawsNothing()) {
std::cout << "drawsNothing" << std::endl;
NOTREACHED();
bitmap_.reset(NULL);
return;
}
bitmap_->eraseARGB(0, 0, 0, 0);
canvas_.reset(new SkCanvas(*bitmap_.get()));
}
SkCanvas* OffScreenOutputDevice::BeginPaint(const gfx::Rect& damage_rect) {
std::cout << "BeginPaint" << std::endl;
DCHECK(canvas_.get());
DCHECK(bitmap_.get());
damage_rect_ = damage_rect;
return canvas_.get();
}
void OffScreenOutputDevice::EndPaint() {
std::cout << "EndPaint" << std::endl;
DCHECK(canvas_.get());
DCHECK(bitmap_.get());
if (!bitmap_.get()) return;
cc::SoftwareOutputDevice::EndPaint();
SkAutoLockPixels bitmap_pixels_lock(*bitmap_.get());
//saveSkBitmapToBMPFile(*(bitmap_.get()), "test.bmp");
uint8_t* pixels = reinterpret_cast<uint8_t*>(bitmap_->getPixels());
for (int i = 0; i<16; i++) {
int x = static_cast<int>(pixels[i]);
std::cout << std::hex << x << std::dec << std::endl;
}
}
} // namespace atom

View file

@ -0,0 +1,54 @@
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_BROWSER_OSR_OUTPUT_DEVICE_H_
#define ATOM_BROWSER_OSR_OUTPUT_DEVICE_H_
// #include "content/browser/renderer_host/render_widget_host_view_base.h"
// #include "content/browser/renderer_host/delegated_frame_host.h"
// #include "content/browser/renderer_host/resize_lock.h"
// #include "third_party/WebKit/public/platform/WebVector.h"
// #include "cc/scheduler/begin_frame_source.h"
// #include "content/browser/renderer_host/render_widget_host_impl.h"
// #include "cc/output/compositor_frame.h"
// #include "ui/gfx/geometry/point.h"
// #include "base/threading/thread.h"
// #include "ui/compositor/compositor.h"
// #include "ui/compositor/layer_delegate.h"
// #include "ui/compositor/layer_owner.h"
// #include "ui/base/ime/text_input_client.h"
#include "cc/output/software_output_device.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "content/browser/web_contents/web_contents_view.h"
namespace atom {
class OffScreenOutputDevice : public cc::SoftwareOutputDevice {
public:
OffScreenOutputDevice();
~OffScreenOutputDevice();
// void saveSkBitmapToBMPFile(const SkBitmap& skBitmap, const char* path);
void Resize(const gfx::Size& pixel_size, float scale_factor) override;
SkCanvas* BeginPaint(const gfx::Rect& damage_rect) override;
void EndPaint() override;
private:
std::unique_ptr<SkCanvas> canvas_;
std::unique_ptr<SkBitmap> bitmap_;
gfx::Rect pending_damage_rect_;
DISALLOW_COPY_AND_ASSIGN(OffScreenOutputDevice);
};
} // namespace atom
#endif // ATOM_BROWSER_OSR_OUTPUT_DEVICE_H_

View file

@ -0,0 +1,167 @@
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/browser/osr_web_contents_view.h"
#include "atom/browser/osr_window.h"
#include <iostream>
namespace atom {
OffScreenWebContentsView::OffScreenWebContentsView() {
std::cout << "OffScreenWebContentsView" << std::endl;
//std::this_thread::sleep_for(std::chrono::milliseconds(10000));
}
OffScreenWebContentsView::~OffScreenWebContentsView() {
std::cout << "~OffScreenWebContentsView" << std::endl;
}
// Returns the native widget that contains the contents of the tab.
gfx::NativeView OffScreenWebContentsView::GetNativeView() const{
std::cout << "GetNativeView" << std::endl;
return gfx::NativeView();
}
// Returns the native widget with the main content of the tab (i.e. the main
// render view host, though there may be many popups in the tab as children of
// the container).
gfx::NativeView OffScreenWebContentsView::GetContentNativeView() const{
std::cout << "GetContentNativeView" << std::endl;
return gfx::NativeView();
}
// Returns the outermost native view. This will be used as the parent for
// dialog boxes.
gfx::NativeWindow OffScreenWebContentsView::GetTopLevelNativeWindow() const{
std::cout << "GetTopLevelNativeWindow" << std::endl;
return gfx::NativeWindow();
}
// Computes the rectangle for the native widget that contains the contents of
// the tab in the screen coordinate system.
void OffScreenWebContentsView::GetContainerBounds(gfx::Rect* out) const{
std::cout << "GetContainerBounds" << std::endl;
*out = GetViewBounds();
}
// TODO(brettw) this is a hack. It's used in two places at the time of this
// writing: (1) when render view hosts switch, we need to size the replaced
// one to be correct, since it wouldn't have known about sizes that happened
// while it was hidden; (2) in constrained windows.
//
// (1) will be fixed once interstitials are cleaned up. (2) seems like it
// should be cleaned up or done some other way, since this works for normal
// WebContents without the special code.
void OffScreenWebContentsView::SizeContents(const gfx::Size& size){
std::cout << "SizeContents" << std::endl;
}
// Sets focus to the native widget for this tab.
void OffScreenWebContentsView::Focus(){
std::cout << "OffScreenWebContentsView::Focus" << std::endl;
}
// Sets focus to the appropriate element when the WebContents is shown the
// first time.
void OffScreenWebContentsView::SetInitialFocus(){
std::cout << "SetInitialFocus" << std::endl;
}
// Stores the currently focused view.
void OffScreenWebContentsView::StoreFocus(){
std::cout << "StoreFocus" << std::endl;
}
// Restores focus to the last focus view. If StoreFocus has not yet been
// invoked, SetInitialFocus is invoked.
void OffScreenWebContentsView::RestoreFocus(){
std::cout << "RestoreFocus" << std::endl;
}
// Returns the current drop data, if any.
content::DropData* OffScreenWebContentsView::GetDropData() const{
std::cout << "GetDropData" << std::endl;
return nullptr;
}
// Get the bounds of the View, relative to the parent.
gfx::Rect OffScreenWebContentsView::GetViewBounds() const{
std::cout << "OffScreenWebContentsView::GetViewBounds" << std::endl;
return view_ ? view_->GetViewBounds() : gfx::Rect();
}
void OffScreenWebContentsView::CreateView(
const gfx::Size& initial_size, gfx::NativeView context){
std::cout << "CreateView" << std::endl;
std::cout << initial_size.width() << "x" << initial_size.height() << std::endl;
}
// Sets up the View that holds the rendered web page, receives messages for
// it and contains page plugins. The host view should be sized to the current
// size of the WebContents.
//
// |is_guest_view_hack| is temporary hack and will be removed once
// RenderWidgetHostViewGuest is not dependent on platform view.
// TODO(lazyboy): Remove |is_guest_view_hack| once http://crbug.com/330264 is
// fixed.
content::RenderWidgetHostViewBase*
OffScreenWebContentsView::CreateViewForWidget(
content::RenderWidgetHost* render_widget_host, bool is_guest_view_hack){
std::cout << "CreateViewForWidget" << std::endl;
view_ = new OffScreenWindow(render_widget_host);
return view_;
}
// Creates a new View that holds a popup and receives messages for it.
content::RenderWidgetHostViewBase*
OffScreenWebContentsView::CreateViewForPopupWidget(
content::RenderWidgetHost* render_widget_host){
std::cout << "CreateViewForPopupWidget" << std::endl;
view_ = new OffScreenWindow(render_widget_host);
return view_;
}
// Sets the page title for the native widgets corresponding to the view. This
// is not strictly necessary and isn't expected to be displayed anywhere, but
// can aid certain debugging tools such as Spy++ on Windows where you are
// trying to find a specific window.
void OffScreenWebContentsView::SetPageTitle(const base::string16& title){
std::cout << "SetPageTitle" << std::endl;
std::cout << title << std::endl;
}
// Invoked when the WebContents is notified that the RenderView has been
// fully created.
void OffScreenWebContentsView::RenderViewCreated(content::RenderViewHost* host){
std::cout << "RenderViewCreated" << std::endl;
}
// Invoked when the WebContents is notified that the RenderView has been
// swapped in.
void OffScreenWebContentsView::RenderViewSwappedIn(content::RenderViewHost* host){
std::cout << "RenderViewSwappedIn" << std::endl;
}
// Invoked to enable/disable overscroll gesture navigation.
void OffScreenWebContentsView::SetOverscrollControllerEnabled(bool enabled){
std::cout << "SetOverscrollControllerEnabled" << std::endl;
}
#if defined(OS_MACOSX)
void OffScreenWebContentsView::SetAllowOtherViews(bool allow) {
}
bool OffScreenWebContentsView::GetAllowOtherViews() const {
return false;
}
bool OffScreenWebContentsView::IsEventTracking() const {
return false;
}
void OffScreenWebContentsView::CloseTabAfterEventTracking() {
}
#endif // defined(OS_MACOSX)
} // namespace atom

View file

@ -0,0 +1,70 @@
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_BROWSER_OSR_WEB_CONTENTS_VIEW_H_
#define ATOM_BROWSER_OSR_WEB_CONTENTS_VIEW_H_
// #include "content/browser/renderer_host/render_widget_host_view_base.h"
// #include "content/browser/renderer_host/delegated_frame_host.h"
// #include "content/browser/renderer_host/resize_lock.h"
// #include "third_party/WebKit/public/platform/WebVector.h"
// #include "cc/scheduler/begin_frame_source.h"
// #include "content/browser/renderer_host/render_widget_host_impl.h"
// #include "cc/output/compositor_frame.h"
// #include "ui/gfx/geometry/point.h"
// #include "base/threading/thread.h"
// #include "ui/compositor/compositor.h"
// #include "ui/compositor/layer_delegate.h"
// #include "ui/compositor/layer_owner.h"
// #include "ui/base/ime/text_input_client.h"
#include "content/browser/web_contents/web_contents_view.h"
namespace atom {
class OffScreenWebContentsView : public content::WebContentsView {
public:
OffScreenWebContentsView();
~OffScreenWebContentsView();
gfx::NativeView GetNativeView() const override;
gfx::NativeView GetContentNativeView() const override;
gfx::NativeWindow GetTopLevelNativeWindow() const override;
void GetContainerBounds(gfx::Rect* out) const override;
void SizeContents(const gfx::Size& size) override;
void Focus() override;
void SetInitialFocus() override;
void StoreFocus() override;
void RestoreFocus() override;
content::DropData* GetDropData() const override;
gfx::Rect GetViewBounds() const override;
void CreateView(
const gfx::Size& initial_size, gfx::NativeView context) override;
content::RenderWidgetHostViewBase* CreateViewForWidget(
content::RenderWidgetHost* render_widget_host,
bool is_guest_view_hack) override;
content::RenderWidgetHostViewBase* CreateViewForPopupWidget(
content::RenderWidgetHost* render_widget_host) override;
void SetPageTitle(const base::string16& title) override;
void RenderViewCreated(content::RenderViewHost* host) override;
void RenderViewSwappedIn(content::RenderViewHost* host) override;
void SetOverscrollControllerEnabled(bool enabled) override;
#if defined(OS_MACOSX)
void SetAllowOtherViews(bool allow) override;
bool GetAllowOtherViews() const override;
bool IsEventTracking() const override;
void CloseTabAfterEventTracking() override;
#endif
private:
content::RenderWidgetHostViewBase* view_;
};
} // namespace atom
#endif // ATOM_BROWSER_OSR_WEB_CONTENTS_VIEW_H_

View file

@ -53,225 +53,6 @@ const int kFrameRetryLimit = 2;
namespace atom { namespace atom {
OffScreenWebContentsView::OffScreenWebContentsView() {
std::cout << "OffScreenWebContentsView" << std::endl;
//std::this_thread::sleep_for(std::chrono::milliseconds(10000));
}
OffScreenWebContentsView::~OffScreenWebContentsView() {
std::cout << "~OffScreenWebContentsView" << std::endl;
}
// Returns the native widget that contains the contents of the tab.
gfx::NativeView OffScreenWebContentsView::GetNativeView() const{
std::cout << "GetNativeView" << std::endl;
return gfx::NativeView();
}
// Returns the native widget with the main content of the tab (i.e. the main
// render view host, though there may be many popups in the tab as children of
// the container).
gfx::NativeView OffScreenWebContentsView::GetContentNativeView() const{
std::cout << "GetContentNativeView" << std::endl;
return gfx::NativeView();
}
// Returns the outermost native view. This will be used as the parent for
// dialog boxes.
gfx::NativeWindow OffScreenWebContentsView::GetTopLevelNativeWindow() const{
std::cout << "GetTopLevelNativeWindow" << std::endl;
return gfx::NativeWindow();
}
// Computes the rectangle for the native widget that contains the contents of
// the tab in the screen coordinate system.
void OffScreenWebContentsView::GetContainerBounds(gfx::Rect* out) const{
std::cout << "GetContainerBounds" << std::endl;
*out = GetViewBounds();
}
// TODO(brettw) this is a hack. It's used in two places at the time of this
// writing: (1) when render view hosts switch, we need to size the replaced
// one to be correct, since it wouldn't have known about sizes that happened
// while it was hidden; (2) in constrained windows.
//
// (1) will be fixed once interstitials are cleaned up. (2) seems like it
// should be cleaned up or done some other way, since this works for normal
// WebContents without the special code.
void OffScreenWebContentsView::SizeContents(const gfx::Size& size){
std::cout << "SizeContents" << std::endl;
}
// Sets focus to the native widget for this tab.
void OffScreenWebContentsView::Focus(){
std::cout << "OffScreenWebContentsView::Focus" << std::endl;
}
// Sets focus to the appropriate element when the WebContents is shown the
// first time.
void OffScreenWebContentsView::SetInitialFocus(){
std::cout << "SetInitialFocus" << std::endl;
}
// Stores the currently focused view.
void OffScreenWebContentsView::StoreFocus(){
std::cout << "StoreFocus" << std::endl;
}
// Restores focus to the last focus view. If StoreFocus has not yet been
// invoked, SetInitialFocus is invoked.
void OffScreenWebContentsView::RestoreFocus(){
std::cout << "RestoreFocus" << std::endl;
}
// Returns the current drop data, if any.
content::DropData* OffScreenWebContentsView::GetDropData() const{
std::cout << "GetDropData" << std::endl;
return nullptr;
}
// Get the bounds of the View, relative to the parent.
gfx::Rect OffScreenWebContentsView::GetViewBounds() const{
std::cout << "OffScreenWebContentsView::GetViewBounds" << std::endl;
return view_ ? view_->GetViewBounds() : gfx::Rect();
}
void OffScreenWebContentsView::CreateView(
const gfx::Size& initial_size, gfx::NativeView context){
std::cout << "CreateView" << std::endl;
std::cout << initial_size.width() << "x" << initial_size.height() << std::endl;
}
// Sets up the View that holds the rendered web page, receives messages for
// it and contains page plugins. The host view should be sized to the current
// size of the WebContents.
//
// |is_guest_view_hack| is temporary hack and will be removed once
// RenderWidgetHostViewGuest is not dependent on platform view.
// TODO(lazyboy): Remove |is_guest_view_hack| once http://crbug.com/330264 is
// fixed.
content::RenderWidgetHostViewBase*
OffScreenWebContentsView::CreateViewForWidget(
content::RenderWidgetHost* render_widget_host, bool is_guest_view_hack){
std::cout << "CreateViewForWidget" << std::endl;
view_ = new OffScreenWindow(render_widget_host);
return view_;
}
// Creates a new View that holds a popup and receives messages for it.
content::RenderWidgetHostViewBase*
OffScreenWebContentsView::CreateViewForPopupWidget(
content::RenderWidgetHost* render_widget_host){
std::cout << "CreateViewForPopupWidget" << std::endl;
view_ = new OffScreenWindow(render_widget_host);
return view_;
}
// Sets the page title for the native widgets corresponding to the view. This
// is not strictly necessary and isn't expected to be displayed anywhere, but
// can aid certain debugging tools such as Spy++ on Windows where you are
// trying to find a specific window.
void OffScreenWebContentsView::SetPageTitle(const base::string16& title){
std::cout << "SetPageTitle" << std::endl;
std::cout << title << std::endl;
}
// Invoked when the WebContents is notified that the RenderView has been
// fully created.
void OffScreenWebContentsView::RenderViewCreated(content::RenderViewHost* host){
std::cout << "RenderViewCreated" << std::endl;
}
// Invoked when the WebContents is notified that the RenderView has been
// swapped in.
void OffScreenWebContentsView::RenderViewSwappedIn(content::RenderViewHost* host){
std::cout << "RenderViewSwappedIn" << std::endl;
}
// Invoked to enable/disable overscroll gesture navigation.
void OffScreenWebContentsView::SetOverscrollControllerEnabled(bool enabled){
std::cout << "SetOverscrollControllerEnabled" << std::endl;
}
#if defined(OS_MACOSX)
void OffScreenWebContentsView::SetAllowOtherViews(bool allow) {
}
bool OffScreenWebContentsView::GetAllowOtherViews() const {
return false;
}
bool OffScreenWebContentsView::IsEventTracking() const {
return false;
}
void OffScreenWebContentsView::CloseTabAfterEventTracking() {
}
#endif // defined(OS_MACOSX)
OffScreenOutputDevice::OffScreenOutputDevice() {
std::cout << "OffScreenOutputDevice" << std::endl;
}
OffScreenOutputDevice::~OffScreenOutputDevice() {
std::cout << "~OffScreenOutputDevice" << std::endl;
}
void OffScreenOutputDevice::Resize(
const gfx::Size& pixel_size, float scale_factor) {
std::cout << "Resize" << std::endl;
std::cout << pixel_size.width() << "x" << pixel_size.height() << std::endl;
scale_factor_ = scale_factor;
if (viewport_pixel_size_ == pixel_size) return;
viewport_pixel_size_ = pixel_size;
canvas_.reset(NULL);
bitmap_.reset(new SkBitmap);
bitmap_->allocN32Pixels(viewport_pixel_size_.width(),
viewport_pixel_size_.height(),
false);
if (bitmap_->drawsNothing()) {
std::cout << "drawsNothing" << std::endl;
NOTREACHED();
bitmap_.reset(NULL);
return;
}
bitmap_->eraseARGB(0, 0, 0, 0);
canvas_.reset(new SkCanvas(*bitmap_.get()));
}
SkCanvas* OffScreenOutputDevice::BeginPaint(const gfx::Rect& damage_rect) {
std::cout << "BeginPaint" << std::endl;
DCHECK(canvas_.get());
DCHECK(bitmap_.get());
damage_rect_ = damage_rect;
return canvas_.get();
}
void OffScreenOutputDevice::EndPaint() {
std::cout << "EndPaint" << std::endl;
DCHECK(canvas_.get());
DCHECK(bitmap_.get());
if (!bitmap_.get()) return;
cc::SoftwareOutputDevice::EndPaint();
SkAutoLockPixels bitmap_pixels_lock(*bitmap_.get());
//saveSkBitmapToBMPFile(*(bitmap_.get()), "test.bmp");
uint8_t* pixels = reinterpret_cast<uint8_t*>(bitmap_->getPixels());
for (int i = 0; i<16; i++) {
int x = static_cast<int>(pixels[i]);
std::cout << std::hex << x << std::dec << std::endl;
}
}
// Used for managing copy requests when GPU compositing is enabled. Based on // Used for managing copy requests when GPU compositing is enabled. Based on
// RendererOverridesHandler::InnerSwapCompositorFrame and // RendererOverridesHandler::InnerSwapCompositorFrame and
// DelegatedFrameHost::CopyFromCompositingSurface. // DelegatedFrameHost::CopyFromCompositingSurface.

View file

@ -25,9 +25,6 @@
#include "cc/output/output_surface_client.h" #include "cc/output/output_surface_client.h"
#include "cc/scheduler/begin_frame_source.h" #include "cc/scheduler/begin_frame_source.h"
#include "content/browser/web_contents/web_contents_view.h"
// #include "atom/browser/native_window_views.h"
#if defined(OS_WIN) #if defined(OS_WIN)
#include <windows.h> #include <windows.h>
#include "ui/gfx/win/window_impl.h" #include "ui/gfx/win/window_impl.h"
@ -38,6 +35,8 @@
#include "ui/accelerated_widget_mac/accelerated_widget_mac.h" #include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
#endif #endif
#include "atom/browser/osr_output_device.h"
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
#ifdef __OBJC__ #ifdef __OBJC__
@class CALayer; @class CALayer;
@ -59,78 +58,6 @@ namespace atom {
class CefCopyFrameGenerator; class CefCopyFrameGenerator;
class CefBeginFrameTimer; class CefBeginFrameTimer;
class OffScreenWebContentsView : public content::WebContentsView {
public:
OffScreenWebContentsView();
~OffScreenWebContentsView();
gfx::NativeView GetNativeView() const override;
gfx::NativeView GetContentNativeView() const override;
gfx::NativeWindow GetTopLevelNativeWindow() const override;
void GetContainerBounds(gfx::Rect* out) const override;
void SizeContents(const gfx::Size& size) override;
void Focus() override;
void SetInitialFocus() override;
void StoreFocus() override;
void RestoreFocus() override;
content::DropData* GetDropData() const override;
gfx::Rect GetViewBounds() const override;
void CreateView(
const gfx::Size& initial_size, gfx::NativeView context) override;
content::RenderWidgetHostViewBase* CreateViewForWidget(
content::RenderWidgetHost* render_widget_host, bool is_guest_view_hack) override;
content::RenderWidgetHostViewBase* CreateViewForPopupWidget(
content::RenderWidgetHost* render_widget_host) override;
void SetPageTitle(const base::string16& title) override;
void RenderViewCreated(content::RenderViewHost* host) override;
void RenderViewSwappedIn(content::RenderViewHost* host) override;
void SetOverscrollControllerEnabled(bool enabled) override;
#if defined(OS_MACOSX)
void SetAllowOtherViews(bool allow) override;
bool GetAllowOtherViews() const override;
bool IsEventTracking() const override;
void CloseTabAfterEventTracking() override;
#endif
private:
content::RenderWidgetHostViewBase* view_;
};
class OffScreenOutputDevice : public cc::SoftwareOutputDevice {
public:
OffScreenOutputDevice();
~OffScreenOutputDevice();
// void saveSkBitmapToBMPFile(const SkBitmap& skBitmap, const char* path);
void Resize(const gfx::Size& pixel_size, float scale_factor) override;
SkCanvas* BeginPaint(const gfx::Rect& damage_rect) override;
void EndPaint() override;
private:
std::unique_ptr<SkCanvas> canvas_;
std::unique_ptr<SkBitmap> bitmap_;
gfx::Rect pending_damage_rect_;
DISALLOW_COPY_AND_ASSIGN(OffScreenOutputDevice);
};
class AtomCompositorDelegate : public ui::CompositorDelegate {
public:
AtomCompositorDelegate() {};
~AtomCompositorDelegate() {};
std::unique_ptr<cc::SoftwareOutputDevice> CreateSoftwareOutputDevice(
ui::Compositor* compositor) override {
return std::unique_ptr<cc::SoftwareOutputDevice>(new OffScreenOutputDevice);
}
};
class OffScreenWindow class OffScreenWindow
: public content::RenderWidgetHostViewBase, : public content::RenderWidgetHostViewBase,
#if defined(OS_MACOSX) #if defined(OS_MACOSX)

View file

@ -206,6 +206,10 @@
'atom/browser/native_window_mac.h', 'atom/browser/native_window_mac.h',
'atom/browser/native_window_mac.mm', 'atom/browser/native_window_mac.mm',
'atom/browser/native_window_observer.h', 'atom/browser/native_window_observer.h',
'atom/browser/osr_web_contents_view.cc',
'atom/browser/osr_web_contents_view.h',
'atom/browser/osr_output_device.cc',
'atom/browser/osr_output_device.h',
'atom/browser/osr_window.cc', 'atom/browser/osr_window.cc',
'atom/browser/osr_window.h', 'atom/browser/osr_window.h',
'atom/browser/osr_window_win.cc', 'atom/browser/osr_window_win.cc',