blink跨线程解析html有点小问题

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weolar/article/details/78513550

BackgroundHTMLParser::updateDocument里会

Platform::current()->mainThread()->postTask(FROM_HERE, 

threadSafeBind(&HTMLDocumentParser::didReceiveEncodingDataFromBackgroundParser, AllowCrossThreadAccess(m_parser), encodingData));


发一个编码名字给主线程,但如果主线程过快的收到资源接收完成的消息:

> node.dll!blink::HTMLDocumentParser::stopBackgroundParser() 行 805 C++
  node.dll!blink::HTMLDocumentParser::end() 行 859 C++
  node.dll!blink::HTMLDocumentParser::attemptToRunDeferredScriptsAndEnd() 行 873 C++
  node.dll!blink::HTMLDocumentParser::prepareToStopParsing() 行 273 C++
  node.dll!blink::HTMLDocumentParser::processParsedChunkFromBackgroundParser(WTF::PassOwnPtr<blink::HTMLDocumentParser::ParsedChunk> popChunk) 行 511 C++
  node.dll!blink::HTMLDocumentParser::pumpPendingSpeculations() 行 563 C++
  node.dll!blink::HTMLDocumentParser::resumeParsingAfterScriptExecution() 行 1000 C++
  node.dll!blink::HTMLDocumentParser::notifyScriptLoaded(blink::Resource * cachedResource) 行 1036 C++
  node.dll!blink::HTMLScriptRunner::notifyFinished(blink::Resource * cachedResource) 行 200 C++
  node.dll!blink::Resource::checkNotify() 行 253 C++
  node.dll!blink::Resource::finishOnePart() 行 305 C++
  node.dll!blink::Resource::finish() 行 312 C++
  node.dll!blink::ResourceLoader::didFinishLoading(blink::WebURLLoader * __formal, double finishTime, __int64 encodedDataLength) 行 476 C++
  node.dll!net::WebURLLoaderManager::handleDidFinishLoading(net::WebURLLoaderInternal * job, double finishTime, __int64 totalEncodedDataLength) 行 471 C++


就会关掉这个BackgroundHTMLParser,导致这个HTMLDocumentParser::didReceiveEncodingDataFromBackgroundParser,收不到,从而发生乱码

展开阅读全文

有点小问题不是很懂.

02-29

[code=SQL]今天又翻开老大的资料..看到备份数据库,并按日期生成备份目录.sqlrn就想自己写一个.rn现想每天做一个完整备份,每两小时做一个差异备份,每10分钟做一个日志备份.(想不管合不合理,想学习自动备份用)rnrn而我想生成的目录结构是这样的.rnrn每一天生成一个该日期的文件夹,存放完整备份.每两小时又在该文件夹下生成相应的子文件夹,存放差异备份,而日志备份则存放在这个子文件夹或再建一个log文件夹来存放rn例如rnd:\>20080229\db_完整备份.bakrn \20080229_1400\db_1400_差异备份.bakrn \log\db_1410_日志备份.bakrn \db_1420_日志备份.bakrn \db_1430_日志备份.bakrn .....rn \20080229_1600\db_1600_差异备份.bakrn \log\db_1410_日志备份.bakrn ....rn 20080301\db_完整备份rnrn如果现在用三个作业.第一个作业每一天运行做完整备份.第二个作业是第2小时运行一次做差异备份,而第三个作业是每10分钟运行一次做日志备份.rn如果我现在写一个存储过程,让三个作业调用,而且这三个作业是同时运行.rn会不会出现完整备份没有完成,差异备份就开始了?..如果是这样,那就出错了.rnrn应该怎么做呢?.小弟在这方面经验小.请大家指点下..rnrn目前写了这些多..rn--得到数据库路径rnrncreate function dbo.get_db_path(@dbname nvarchar(128))rn returns nvarchar(1024)rnasrnbeginrn declare @dbpath nvarchar(1024)rn if isnull(@dbname,'')='' set @dbname=db_name()rn if not exists(select name from master.sys.databases where name=@dbname)rn set @dbname=db_name()rn select @dbpath=b.physical_namern fromrn master.sys.databases a rn inner joinrn master.sys.master_files brn on a.database_id=b.database_idrn where a.name=@dbname and b.file_id=1rn rn select @dbpath=reverse(@dbpath),rn @dbpath=reverse(substring(@dbpath,charindex('\',@dbpath),1024))rn return ltrim(@dbpath)rnendrngornrnrn--备份存储过程rncreate proc p_backuprn @dbname nvarchar(128)='',rn @bkname nvarchar(128)='',rn @bkpath nvarchar(1024)='',rn @bktype nvarchar(10)=N'DB'rnasrn declare @str nvarchar(1024)rn declare @sql nvarchar(1024)rn if isnull(@dbname,'')=''rn set @dbname=db_name()rn if isnull(@bkpath,'')=''rn set @bkpath=dbo.get_db_path(@dbname)rn rn if @bktype='DB'rn set @str=@bkpath+convert(varchar,getdate(),112)+'\'rn else if @bktype='DIF'rn set @str=@bkpath+convert(varchar,getdate(),112)+'\'rn +convert(varchar,getdate(),112)+'_'+replace(convert(char(5),getdate(),114),':','')+'\'rn set @sql='md '+@strrn exec master..xp_cmdshell @sql,no_outputrnrn if isnull(@bkname,'')=''rn beginrn set @bkname=N'DBNAME\_DATE\_TIME\_TYPE.bak'rn select @bkname=replace(@bkname,'DBNAME\',@dbname),rn @bkname=replace(@bkname,'DATE\',convert(varchar,getdate(),112)),rn @bkname=replace(@bkname,'TIME\',replace(convert(char(5),getdate(),114),':','')),rn @bkname=replace(@bkname,'TYPE',@bktype)rn endrn elsern if right(@bkname,4)<>'.bak' set @bkname=@bkname+'.bak'rn rn set @sql='backup '+case when @bktype='LOG' then 'log ' else 'database ' end +@dbnamern +' to disk='''+@str+@bkname+''' with '+case when @bktype='DIF' then 'differential' else 'format' endrn --print @sqlrn exec (@sql)rngo[/code]rnrn 论坛

安卓蓝牙开发有点小问题

08-12

package sss.seventh;rnrnimport android.support.v7.app.ActionBarActivity;rnimport android.bluetooth.BluetoothAdapter;rnimport android.bluetooth.BluetoothDevice;rnimport android.content.BroadcastReceiver;rnimport android.content.Context;rnimport android.content.Intent;rnimport android.content.IntentFilter;rnimport android.os.Bundle;rnimport android.view.View;rnimport android.view.View.OnClickListener;rnimport android.widget.Button;rnrnpublic class MainActivity extends ActionBarActivity rn private Button discoveryButton = null;rn private Button scanButton = null;rn private BluetoothReceiver bluetoothReceiver = null;rn private BluetoothAdapter bluetoothAdater = null;rn @Overridern protected void onCreate(Bundle savedInstanceState) rn super.onCreate(savedInstanceState);rn setContentView(R.layout.main);rn rn discoveryButton = (Button)findViewById(R.id.discoverButton);rn discoveryButton.setOnClickListener(new DiscoveryButtonClickListener());rn rn //创建一个IntentFilter对象,将其action指定为BluetoothDevice.ACTIVITY_FOUNDrn IntentFilter intentFilter = new IntentFilter(BluetoothDevice.ACTION_FOUND);rn bluetoothReceiver = new BluetoothReceiver();rn //注册广播接收器rn registerReceiver(bluetoothReceiver, intentFilter);rn //得到bluetoothAdaterrn bluetoothAdater = BluetoothAdapter.getDefaultAdapter();rn scanButton = (Button)findViewById(R.id.scanButton);rn System.out.println(scanButton);rn scanButton.setOnClickListener(new ScanButtonClickListener());rn rn private class BluetoothReceiver extends BroadcastReceiverrn @Overridern public void onReceive(Context context, Intent intent) rn String action = intent.getAction();rn //可以从收到的Intent对象中,将代表远程蓝牙适配器的对象取出rn if(BluetoothDevice.ACTION_FOUND.equals(action))rn BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);rn System.out.println(device.getAddress());rn rn rn rn //该监听器用于修改蓝牙设备可见性rn private class DiscoveryButtonClickListener implements OnClickListenerrn @Overridern public void onClick(View v) rn //创建一个Intent对象,并将其action的值设置为BluetoothAdapter.ACTION_REQUEST_DISCOVERABLErn Intent discoverableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);rn //讲一个键值对存放到Intent对象中,主要用于指定可见状态的持续时间rn discoverableIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 300);rn startActivity(discoverableIntent);rn rn rn private class ScanButtonClickListener implements OnClickListenerrn @Overridern public void onClick(View v) rn //开始扫描,需时12秒,功耗大rn bluetoothAdater.startDiscovery();rn rn rn @Overridern protected void onDestroy() rn unregisterReceiver(bluetoothReceiver);rn super.onDestroy();rn rnrnrnrnrn对着视频写的,权限和布局都没错,可是放到手机上,可以运行,但是点击任意一个Button就退出,求各路大神帮帮忙~~~ 论坛

有点小问题的程序

03-30

//记事本程序rnimport javax.swing.*; rnimport java.awt.event.*; rnimport java.awt.*; rnrnclass EditBook rn rnpublic static void main(String[] args) rn rnEdit e=new Edit(); rne.run(); rn rn rnclass Edit extends JFrame rn rnrnJMenuBar jmb; rnJMenu file; rnJMenu compile; rnJMenu tool; rnJMenu help; rnJMenuItem newF; rnJMenuItem open; rnJMenuItem save; rnJMenuItem exit; rnJMenuItem copy; rnJMenuItem cut; rnJMenuItem paste; rnJMenuItem s_all; rnJMenuItem color; rnJMenuItem toolb; rnJMenuItem toolc; rnJMenuItem h; rnJTextArea jta; rnJDialog jd; rnJPanel jp; rnrnJToolBar jtb; rnrnString message; rnrnpublic void run() rnjmb=new JMenuBar(); rnjp=new JPanel(); rnfile=new JMenu("文件"); rncompile=new JMenu("编辑"); rntool=new JMenu("工具"); rnhelp=new JMenu("帮助"); rnrnnewF=new JMenuItem("新建"); rnopen=new JMenuItem("打开"); rnsave=new JMenuItem("保存"); rnexit=new JMenuItem("退出"); rnrncopy=new JMenuItem("Copy"); rncut=new JMenuItem("Cut"); rnpaste=new JMenuItem("Paste"); rns_all=new JMenuItem("保存全部"); rncolor=new JMenuItem("Color"); rnrntoolb=new JMenuItem("MS记事本"); rntoolc=new JMenuItem("MS计算器"); rnrnh=new JMenuItem("关于"); rnrnjtb=new JToolBar("MyJToolBar"); rnrnrnjta=new JTextArea(20,30); rnrn/* rnef.addWindowListener(new WindowAdapter(WindowEvent e) rnSystem.exit(0); rn); rn*/ rnrnrn//文件 rnfile.add(newF); rnfile.add(open); rnrn//////////如何显示文件内容 rnopen.addActionListener(new ActionListener() rnpublic void actionPerformed(ActionEvent e) rnjd=new JDialog(new JFrame(),"Color"); rnJFileChooser jfc=new JFileChooser(); rnString f=jfc.getName(); rnSystem.out.println(f); rnjd.add(jfc); rnjd.pack(); rnjd.setVisible(true); rn rn); rnfile.add(save); rnfile.add(exit); rnexit.addActionListener(new ActionListener() rnpublic void actionPerformed(ActionEvent e) rnSystem.exit(0); rn rn); rnrnrn//编辑 rncompile.add(copy); rncopy.addActionListener(new ActionListener() rnpublic void actionPerformed(ActionEvent e) rnjta.copy(); rn rn); rncompile.add(cut); rncut.addActionListener(new ActionListener() rnpublic void actionPerformed(ActionEvent e) rnjta.cut(); rn rn); rncompile.add(paste); rnpaste.addActionListener(new ActionListener() rnpublic void actionPerformed(ActionEvent e) rnjta.paste(); rn rn); rncompile.add(s_all); rncompile.add(color); rncolor.addActionListener(new ActionListener() rnpublic void actionPerformed(ActionEvent e) rnjd=new JDialog(new JFrame(),"Color"); rnjd.add(new JColorChooser()); rnjd.pack(); rnjd.setVisible(true); rn rn); rnrnrn//工具 rntool.add(toolb); rntool.add(toolc); rntoolc.addActionListener(new ActionListener() rnpublic void actionPerformed(ActionEvent e) rnCalculate cc=new Calculate(); rncc.display(); rn rn); rnrnrn//帮助 rnhelp.add(h); rnrnjmb.add(file); rnjmb.add(compile); rnjmb.add(tool); rnjmb.add(help); rnrnjtb.add(new JButton(new ImageIcon("copy.jpg"))); rnjtb.add(new JButton(new ImageIcon("copy.jpg"))); rnjtb.add(new JButton(new ImageIcon("copy.jpg"))); rnrnjp.setLayout(new BorderLayout()); rnjp.add("North",jtb); rnjp.add("Center",jta); rnthis.setJMenuBar(jmb); rnthis.add(jp); rnthis.pack(); rnthis.setTitle("简单文本编辑器"); rnthis.setLocation(100,150); rnthis.setVisible(true); rn rnrnrnrn//Calculate程序rnimport java.awt.*; rnimport java.awt.event.*; rnimport java.awt.Color; rnpublic class Calculate implements ActionListener rnFrame f1; rnPanel p1=new Panel(); rnPanel p2=new Panel(); rndouble x,y=0; rnint f=0; rnString s=""; rnTextField tf1,tf2; rnButton b1,b2,b3,b4,b5,b6; rnButton b[]=new Button[11]; rnrnpublic static void main(String args[]) rn(new Calculate()).display(); rn rnrnpublic void display() rnf1=new Frame("窗口界面计算器"); rnf1.setSize(260,150); rnf1.setLocation(320,240); rnf1.setBackground(Color.orange); rnf1.setLayout(new FlowLayout(FlowLayout.LEFT)); rnf1.add(p1); rnf1.add(p2); rnp1.setLayout(new GridLayout(2,1)); rnp2.setLayout(new GridLayout(2,9)); rntf1=new TextField(30); rntf2=new TextField(30); rntf1.setEditable(false); rnp1.add(tf1); rntf2.setEditable(false); rnp1.add(tf2); rnfor(int i=0;i <10;i++) rnString s1=""+i; rnb[i]=new Button(s1); rnp2.add(b[i]); rnb[i].addActionListener(this); rn rnb[10]=new Button("."); rnp2.add(b[10]); rnb[10].addActionListener(this); rnb1=new Button("+"); rnb2=new Button("-"); rnb3=new Button("*"); rnb4=new Button("/"); rnb5=new Button("="); rnb6=new Button("C"); rnp2.add(b1); rnp2.add(b2); rnp2.add(b3); rnp2.add(b4); rnp2.add(b5); rnp2.add(b6); rnb1.addActionListener(this); rnb2.addActionListener(this); rnb3.addActionListener(this); rnb4.addActionListener(this); rnb5.addActionListener(this); rnb6.addActionListener(this); rnf1.addWindowListener(new WinClose()); rnf1.setVisible(true); rn rnpublic void actionPerformed(ActionEvent e) rns=s+e.getActionCommand(); rnfor(int i=0;i <11;i++) rnif(e.getSource()==b[i]) rntf1.setText(tf1.getText()+e.getActionCommand()); rn rnif(e.getSource()==b6) rntf1.setText(""); rntf2.setText(""); rnx=0; rny=0; rnf=0; rns=""; rn rnif(e.getSource()==b1) rnx=Double.parseDouble(tf1.getText()); rntf1.setText(""); rntf2.setText(""+(y+x)); rny=y+x; rnf=1; rn rnif(e.getSource()==b2) rnx=Double.parseDouble(tf1.getText()); rntf1.setText(""); rnif(y==0) rntf2.setText(""+x); rny=x; rn rnelse rntf2.setText(""+(y-x)); rny=y-x; rn rnf=2; rn rnif(e.getSource()==b3) rnx=Double.parseDouble(tf1.getText()); rntf1.setText(""); rnif(y==0) rntf2.setText(""+x); rny=x; rn rnelse rntf2.setText(""+(y*x)); rny=y*x; rn rnf=3; rn rnif(e.getSource()==b4) rnx=Double.parseDouble(tf1.getText()); rntf1.setText(""); rnif(y==0) rntf2.setText(""+x);y=x; rn rnelse rntf2.setText(""+(y/x)); rny=y/x; rn rnf=4; rn rnif(e.getSource()==b5) rnx=Double.parseDouble(tf1.getText()); rnif(f==1) tf1.setText(""+(y+x)); rnif(f==2) tf1.setText(""+(y-x)); rnif(f==3) tf1.setText(""+(y*x)); rnif(f==4) tf1.setText(""+(y/x)); rny=0; rntf2.setText(s+tf1.getText()); rn rn rnclass WinClose extends WindowAdapter rnpublic void windowClosing(WindowEvent e) rnSystem.exit(0); rn rn rn rnrnrn问题:在运行Editplus界面出来的时候怎么在菜单栏那里出现了一个奇怪的光标。。。 rn 点击那里的话 也出现了窗体标题。。。。。rn 论坛

没有更多推荐了,返回首页