Skip to content

Commit

Permalink
WebWorker兼容新版Chrome83:在file协议下如果立即revokeObjectURL,WebWorker将无法正常使用
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangyuecn committed Jun 23, 2020
1 parent e1b50c0 commit bb4914a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions assets/demo-vue/dist/index.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions assets/npm-home/hash-history.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
[
{
"sha1": "e812541a4a38031fdc279b3ded6a7767cd34c3e0",
"time": "2020-6-23 11:56:09"
},
{
"sha1": "8f3a1e18f39f4e401496b6911a40858bcf2a5c55",
"time": "2020-5-17 10:28:07"
Expand All @@ -14,9 +18,5 @@
{
"sha1": "40dc17701be9664f10453c3546c74dce2c8dbc39",
"time": "2020-4-7 13:59:59"
},
{
"sha1": "5eefc26c1cb43ba251693d4bf17ab4af3f681001",
"time": "2020-3-26 14:42:18"
}
]
2 changes: 1 addition & 1 deletion dist/engine/mp3.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion recorder.mp3.min.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/engine/mp3.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ var newContext=function(setOrNull){
var url=(window.URL||webkitURL).createObjectURL(new Blob(["var wk_lame=(",lamejsCode,jsCode], {type:"text/javascript"}));

worker=new Worker(url);
(window.URL||webkitURL).revokeObjectURL(url);//必须要释放,不然每次调用内存都明显泄露内存
setTimeout(function(){
(window.URL||webkitURL).revokeObjectURL(url);//必须要释放,不然每次调用内存都明显泄露内存
},10000);//chrome 83 file协议下如果直接释放,将会使WebWorker无法启动

worker.onmessage=function(e){
var data=e.data;
Expand Down

0 comments on commit bb4914a

Please sign in to comment.