From da5c95710f90ed4cdb21e45aa9ef4f686162ae3f Mon Sep 17 00:00:00 2001 From: Heilig Benedek Date: Wed, 27 Jul 2016 18:24:58 +0200 Subject: [PATCH] software bump --- atom/browser/api/atom_api_window.cc | 10 ++++ atom/browser/osr_window.cc | 21 ++++---- atom/browser/osr_window.h | 6 +-- default_app/default_app.js | 75 ++++++++++++++++++----------- default_app/main.js | 3 +- 5 files changed, 71 insertions(+), 44 deletions(-) diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index 84829404542..c2ba13fce19 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -16,7 +16,9 @@ #include "atom/common/native_mate_converters/string16_converter.h" #include "atom/common/node_includes.h" #include "atom/common/options_switches.h" +#include "base/command_line.h" #include "content/public/browser/render_process_host.h" +#include "content/public/common/content_switches.h" #include "native_mate/constructor.h" #include "native_mate/dictionary.h" #include "ui/gfx/geometry/rect.h" @@ -71,6 +73,14 @@ Window::Window(v8::Isolate* isolate, const mate::Dictionary& options) { // Use options.webPreferences to create WebContents. mate::Dictionary web_preferences = mate::Dictionary::CreateEmpty(isolate); options.Get(options::kWebPreferences, &web_preferences); + + bool b; + if (options.Get("disableGPU", &b) && b) { + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + + command_line->AppendSwitch(::switches::kDisableGpu); + command_line->AppendSwitch(::switches::kDisableGpuCompositing); + } // Copy the backgroundColor to webContents. v8::Local value; diff --git a/atom/browser/osr_window.cc b/atom/browser/osr_window.cc index 4233d224e49..8384c021d80 100644 --- a/atom/browser/osr_window.cc +++ b/atom/browser/osr_window.cc @@ -430,7 +430,7 @@ OffScreenWindow::OffScreenWindow( base::ThreadTaskRunnerHandle::Get())); compositor_->SetAcceleratedWidget(compositor_widget_); #endif - // compositor_->SetDelegate(this); + compositor_->SetDelegate(this); compositor_->SetRootLayer(root_layer_.get()); ResizeRootLayer(); @@ -894,16 +894,15 @@ void OffScreenWindow::DelegatedFrameHostUpdateVSyncParameters( render_widget_host_->UpdateVSyncParameters(timebase, interval); } -// std::unique_ptr -// OffScreenWindow::CreateSoftwareOutputDevice( -// ui::Compositor* compositor) { -// DCHECK_EQ(compositor_.get(), compositor); -// DCHECK(!copy_frame_generator_); -// DCHECK(!software_output_device_); -// std::cout << "CREATED" << std::endl; -// software_output_device_ = new OffScreenOutputDevice(); -// return base::WrapUnique(software_output_device_); -// } +std::unique_ptr + OffScreenWindow::CreateSoftwareOutputDevice(ui::Compositor* compositor) { + DCHECK_EQ(compositor_.get(), compositor); + DCHECK(!copy_frame_generator_); + DCHECK(!software_output_device_); + std::cout << "CREATED" << std::endl; + software_output_device_ = new OffScreenOutputDevice(); + return base::WrapUnique(software_output_device_); +} void OffScreenWindow::OnSetNeedsBeginFrames(bool enabled) { SetFrameRate(); diff --git a/atom/browser/osr_window.h b/atom/browser/osr_window.h index e851a545d5e..030f1889fab 100644 --- a/atom/browser/osr_window.h +++ b/atom/browser/osr_window.h @@ -62,7 +62,7 @@ class OffScreenWindow #if defined(OS_MACOSX) public ui::AcceleratedWidgetMacNSView, #endif - // public ui::CompositorDelegate, + public ui::CompositorDelegate, public content::DelegatedFrameHostClient { public: typedef base::Callback @@ -170,8 +170,8 @@ public: bool IsAutoResizeEnabled() const; - // std::unique_ptr CreateSoftwareOutputDevice( - // ui::Compositor* compositor) override; + std::unique_ptr CreateSoftwareOutputDevice( + ui::Compositor* compositor) override; void OnSetNeedsBeginFrames(bool enabled); #if defined(OS_MACOSX) diff --git a/default_app/default_app.js b/default_app/default_app.js index e9d1e473a99..c0b3670b82c 100644 --- a/default_app/default_app.js +++ b/default_app/default_app.js @@ -1,6 +1,11 @@ -const {app, BrowserWindow} = require('electron') +const {app, BrowserWindow, contentTracing} = require('electron') const path = require('path') +const options = { + categoryFilter: '*', + traceOptions: 'record-until-full,enable-sampling' +}; + let mainWindow1 = null let mainWindow2 = null let mainWindow3 = null @@ -18,6 +23,7 @@ app.on('window-all-closed', () => { exports.load = (appUrl) => { app.on('ready', () => { mainWindow1 = new BrowserWindow({ + disableGPU: true, width: 800, height: 600, autoHideMenuBar: true, @@ -44,35 +50,46 @@ exports.load = (appUrl) => { start1 = end1 }) + + /*contentTracing.startRecording(options, () => { + console.log('Tracing started'); - // mainWindow2 = new BrowserWindow({ - // width: 800, - // height: 600, - // autoHideMenuBar: true, - // backgroundColor: '#FFFFFF', - // useContentSize: true, - // webPreferences: { - // nodeIntegration: false - // } - // }) - // mainWindow2.loadURL(appUrl) - // mainWindow2.focus() - // mainWindow2.webContents.on('dom-ready', () => { - // mainWindow2.webContents.beginFrameSubscription(() => { - // console.log("asd") - // }) - // }) - // - // var start2, end2 - // start2 = +new Date(); - // mainWindow2.webContents.on('paint', (e, rect, w, h, data) => { - // end2 = +new Date(); - // - // const d = end2 - start2 - // console.log(`browser #2: ${d < 10 ? ` ${d}` : d} ms`) - // - // start2 = end2 - // }) + setTimeout(() => { + contentTracing.stopRecording('', (path) => { + console.log('Tracing data recorded to ' + path); + }); + }, 5000); + });*/ + + mainWindow2 = new BrowserWindow({ + //disableGPU: false, + width: 800, + height: 600, + autoHideMenuBar: true, + backgroundColor: '#FFFFFF', + useContentSize: true, + webPreferences: { + nodeIntegration: false + } + }) + mainWindow2.loadURL('http://mrdoob.com/lab/javascript/requestanimationframe/') + mainWindow2.focus() + mainWindow2.webContents.on('dom-ready', () => { + mainWindow2.webContents.beginFrameSubscription(() => { + console.log("asd") + }) + }) + + var start2, end2 + start2 = +new Date(); + mainWindow2.webContents.on('paint', (e, rect, w, h, data) => { + end2 = +new Date(); + + const d = end2 - start2 + // console.log(`browser #2: ${d < 10 ? ` ${d}` : d} ms`) + + start2 = end2 + }) // // mainWindow3 = new BrowserWindow({ // width: 800, diff --git a/default_app/main.js b/default_app/main.js index 6ac00e72c8b..17d4f0e668a 100644 --- a/default_app/main.js +++ b/default_app/main.js @@ -329,5 +329,6 @@ if (option.file && !option.webdriver) { startRepl() } else { const indexPath = path.join(__dirname, '/index.html') - loadApplicationByUrl(`http://mrdoob.com/lab/javascript/requestanimationframe/`) + loadApplicationByUrl(`http://www.e-try.com/black.htm`) + //loadApplicationByUrl(`http://mrdoob.com/lab/javascript/requestanimationframe/`) }