Skip to content

Commit

Permalink
merge: support-electron-v15
Browse files Browse the repository at this point in the history
  • Loading branch information
shioyadan committed Nov 5, 2021
2 parents 72ba94d + bea4152 commit 44f4481
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 41 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build: clean
--out=packaging-work \
--platform=darwin,win32,linux \
--arch=x64 \
--electron-version=8.5.5 \
--electron-version=15.3.0 \
--ignore work \
--ignore packaging-work \
--ignore .vscode \
Expand Down
2 changes: 1 addition & 1 deletion app.tag.html
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@
/* global dispatcher ACTION CHANGE store */
let rc = dispatcher;

self.remote = require("electron").remote;
self.remote = require("@electron/remote");

// 新規タブのオープン
dispatcher.on(CHANGE.TAB_OPEN,
Expand Down
4 changes: 2 additions & 2 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
let fs = require("fs");
let electron = require("electron");
let remote = require("@electron/remote");

class Config{
constructor(){
// 最後が _ で終わってるメンバは保存/読み込みを行わない
this.DIR_ = electron.remote.app.getPath("userData") + "/konata";
this.DIR_ = remote.app.getPath("userData") + "/konata";
this.FILE_NAME_ = this.DIR_ + "/config.json";


Expand Down
2 changes: 1 addition & 1 deletion dialogs.tag.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ <h5 class="modal-title">
<script>
/* global dispatcher ACTION CHANGE*/
let rc = dispatcher;
let remote = require("electron").remote;
let remote = require("@electron/remote");

// 読み込みダイアログ
rc.on(CHANGE.DIALOG_FILE_OPEN, function () {
Expand Down
3 changes: 2 additions & 1 deletion jsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"compilerOptions": {
"target": "ES6",
"checkJs": true
"checkJs": true,
"moduleResolution": "Node"
},
"exclude": [
"node_modules",
Expand Down
11 changes: 5 additions & 6 deletions konata.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ class Konata{
}

// パイプライン中の統計を計算し,終わったら finish に渡す
async statsBody_(update, finish, statsList){
let lastID = this.lastID;
async statsBody_(lastID, update, finish, statsList){

let sleepTimer = 0;
let SLEEP_INTERVAL = 50000;
Expand All @@ -140,7 +139,7 @@ class Konata{

if (!stats.isDetected && i > GIVE_UP_TIME) {
console.log(`Gave up analyzing this file (${stats.name})`);
this.statsBody_(update, finish, statsList);
this.statsBody_(lastID, update, finish, statsList);
return;
}

Expand All @@ -158,7 +157,7 @@ class Konata{

if (!stats.isDetected) {
console.log(`Gave up analyzing this file (${stats.name})`);
this.statsBody_(update, finish, statsList);
this.statsBody_(lastID, update, finish, statsList);
return;
}

Expand All @@ -167,8 +166,8 @@ class Konata{
finish(stats.stats);
}
async stats(update, finish){
let statsList = CreateStats(this);
this.statsBody_(update, finish, statsList);
let statsList = CreateStats(this.lastID, this.lastRID, this.parser_.lastCycle);
this.statsBody_(this.lastID, update, finish, statsList);
}

}
Expand Down
8 changes: 6 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ const electron = require("electron");
const {app} = electron;
const {BrowserWindow} = electron;

// Remote モジュールを有効化
require("@electron/remote/main").initialize();

// __dirname には現在のファイルの場所が入る
let currentURL = "file://" + __dirname + "/index.html";

Expand Down Expand Up @@ -36,10 +39,11 @@ app.on("ready", function() {

webPreferences: {
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true
contextIsolation: false
}
});

require("@electron/remote/main").enable(m_window.webContents);
m_window.setMenu(null);

m_window.loadURL(currentURL);
Expand Down
6 changes: 3 additions & 3 deletions menu.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function installMainMenu(store, dispatcher){

let rc = dispatcher;
let remote = require("electron").remote;
let remote = require("@electron/remote");
let DEP_ARROW_TYPE = require("./konata_renderer").DEP_ARROW_TYPE;

let Store = require("./store");
Expand Down Expand Up @@ -398,7 +398,7 @@ function popupTabMenu(store, dispatcher, tabID){

let menuTemplate = makePopupTabMenuTemplate(store, dispatcher, tabID);

let remote = require("electron").remote;
let remote = require("@electron/remote");
let Menu = remote.Menu;
let menu = Menu.buildFromTemplate(menuTemplate);
menu.popup({});
Expand All @@ -407,7 +407,7 @@ function popupTabMenu(store, dispatcher, tabID){
function popupPipelineMenu(store, dispatcher, pos){

let rc = dispatcher;
let remote = require("electron").remote;
let remote = require("@electron/remote");
let Store = require("./store");
let ACTION = Store.ACTION;

Expand Down
6 changes: 4 additions & 2 deletions op_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ const CACHE_RESOLUTION = 32;
const COMPRESS_START_MARGIN = 16;

// 展開済みページの最大数
const MAX_DECOMPRESSED_PAGES = 128*64;

// Op はおおよそ1つで 1KB を消費するが,圧縮すると 1/10 になる
// PAGE_SIZE * MAX_DECOMPRESSED_PAGES * 1KB ぐらいのメモリが非圧縮で保持される
// 現在の設定では 256 * 64 * 1KB = 16MB
const MAX_DECOMPRESSED_PAGES = 1*64;

function idToPageIndex(id){
return id >> PAGE_SIZE_BITS;
Expand Down
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@
"bootstrap": "^4.6.0",
"jquery": "^3.6.0",
"riot": "^3.13.2",
"riotcontrol": "^0.0.3"
"riotcontrol": "^0.0.3",
"@electron/remote": "2.0.1"
},
"devDependencies": {
"electron": "^8.5.5",
"electron": "^15.0.0",
"electron-packager": "^15.4.0",
"license-checker": "^25.0.1"
},
"dummy": {
"electron": "^6.1.7"
}
}
23 changes: 9 additions & 14 deletions stats.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
// JSDoc のタイプチェックに型を認識させるため
let Op = require("./op").Op; // eslint-disable-line
let Konata = require("./konata").Konata; // eslint-disable-line

class GenericStats{
/** @param {Konata} konata */
constructor(konata){
let lastID = konata.lastID;
constructor(lastID, lastRID, lastCycle){

this.stats_ = {
numFetchedOps: lastID,
numCommittedOps: konata.lastRID,
numCycles: konata.parser_.lastCycle,
numCommittedOps: lastRID,
numCycles: lastCycle,

numFlush: 0,
numFlushedOps: 0,
Expand All @@ -37,7 +34,7 @@ class GenericStats{
rateSpeculativeMemMiss: 0,
mpkiSpeculativeMemMiss: 0,

ipc: konata.lastRID / konata.parser_.lastCycle
ipc: lastRID / lastCycle
};

this.prevBr_ = false;
Expand Down Expand Up @@ -164,9 +161,8 @@ class GenericStats{
}

class X86_Gem5_Stats extends GenericStats{
/** @param {Konata} konata */
constructor(konata){
super(konata);
constructor(lastID, lastRID, lastCycle){
super(lastID, lastRID, lastCycle);
this.isDetected_ = false;
}

Expand Down Expand Up @@ -209,12 +205,11 @@ class X86_Gem5_Stats extends GenericStats{
}

/**
* @param {Konata} konata
* @returns {GenericStats[]} */
function CreateStats(konata){
function CreateStats(lastID, lastRID, lastCycle){
return [
new X86_Gem5_Stats(konata),
new GenericStats(konata),
new X86_Gem5_Stats(lastID, lastRID, lastCycle),
new GenericStats(lastID, lastRID, lastCycle),
];
}

Expand Down
6 changes: 3 additions & 3 deletions store.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class Store{
constructor(){

// この書式じゃないと IntelliSense が効かない
let electron = require("electron");
let remote = require("@electron/remote");
let fs = require("fs");

let KonataRenderer = require("./konata_renderer");
Expand Down Expand Up @@ -517,13 +517,13 @@ class Store{
// store.config が生きている間 = ウィンドウの生存期間内に処理をしないといけない
// app.quit ではウィンドウの close イベントが呼ばれないため,手動で保存する
self.config.save();
electron.remote.app.quit();
remote.app.quit();
});

// アプリケーション初期化完了
self.on(ACTION.APP_INITIALIZED, function(){
// Load files passed by command line arguments
let argv = electron.remote.process.argv;
let argv = remote.process.argv;
let start = 1;
console.log(argv[0]);
if (argv[0].match(/[/\\]electron/)) {
Expand Down

0 comments on commit 44f4481

Please sign in to comment.