以上版本的依靠新的OpenFlowJ-Loxigen库

在前面的章节中,我们了解到一个PHP文件在服务器端的执行过程包括以下两个大的过程:

递给php程序需要执行的文件, php程序完成基本的准备工作后启动PHP及Zend引擎, 加载注册的扩展模块。

初始化完成后读取脚本文件,Zend引擎对脚本文件进行词法分析,语法分析。然后编译成opcode执行。如过安装了apc之类的opcode缓存, 编译环节可能会被跳过而直接从缓存中读取opcode执行。

在第二步中,词法分析、语法分析,编译中间代码,执行中间代码等各个部分统称为Zend虚拟机。与Java、C#等编译型语言相比,PHP少了一个手动编译的过程,它们无需编译即可运行,我们称其为解释性语言。 Java有自己的Java虚拟机,它在多个平台上实现统一语言; C#有自己的.NET虚拟机,它在单一平台实现多种语言; PHP跟他们一样,也有属于自己的Zend虚拟机。它们在本质是相同的,它们都是抽象的计算机。这些虚拟机都是在某种较底层的语言上抽象出另外一种语言,有自己的指令集,有自己的内存管理体系。它们最终都会将抽象级别较高的语言实现转化为抽象级别较低的语言实现,并且实现其它辅助功能,如内存管理,垃圾回收等机制,以减少程序员在具体实现上的工作,从而可以将更多的时间和精力投入到业务逻辑中。从抽象层次看,Zend虚拟机比Java等语言更高级一些,这里的高级不是说功能更强大或效率更高,简单点说,Zend虚拟机离真正的机器实现更远一些。最近这些年,语言的发展只是不断的抽象,不断的远离机器,没有根本性的变化。
本章,我们从虚拟机的前世今生讲起,叙述Zend虚拟机的实现原理,关键的数据结构,并其中穿插一个关于语法实现的示例和源码加密解密的过程说明。

在wiki中虚拟机的定义是:虚拟机(Virtual Machine),在计算机科学中的体系结构里,是指一种特殊的软件,他可以在计算机平台和终端用户之间创建一种环境,而终端用户则是基于这个软件所创建的环境来操作软件。在计算机科学中,虚拟机是指可以像真实机器一样运行程序的计算机的软件实现。

Camera API 是Android提供的用于拍照的类,Camera实例提供了对设备相机硬件级别的调用。相机是一种独占性资源,一次只能有一个Activity调用相机。
也就是说,在使用Camera时,需要时使用,用完需立即释放,若忘记释放,除非重启设备,否则其他应用将无法使用相机。

SurfaceView实例是相机的取景器,SurfaceView是一种特殊的视图,可直接将要显示的内容渲染输出到设备的屏幕上。
简单地说,SurfaceView可以完成单位时间内大量界面变化的需求,比如视频播放器,游戏画面,照相机取景等。
SurfaceView的内部利用了双缓冲机制实现了画面的快速刷新,所谓的双缓冲机制,就是利用SurfaceView内部包含的两个子线程(假设为Thread A和Thread B)交替工作,其工作示意图如下:

Thread A : 解码图像—>前台显示—>解码图像—>前台显示 。。。
Thread B : —(空)—- 解码图像—>前台显示—>解码图像 。。。

也就是说,Thread A 和Thread B交替工作,当A线程解码图像的时候,B线程在同一时刻把刚刚解码的图像切换至UI线程(主线程)并进行显示,以保证在任意时刻总有解码完毕的图像显示在界面上,这样,就达到了流畅的视频播播放效果。

在SurfaceView中了实现SurfaceHolder.Callback接口,SurfaceHolder是用户与Surface对象联系的纽带,而Surface对象代表原始像素数据的缓冲区。

当SurfaceView出现在屏幕上时,会创建Surface;当SurfaceView从屏幕上消失时候,Surface随即被销毁。Surface不存在时候,必须保证没有任何内容要在它上面绘制。

不同于其他视图对象,SurfaceView及其协同工作对象都不会自我绘制内容,对于任何想将内容绘制到Surface缓冲区的对象,我们将其称之为Surface客户端,Camera对象就是一个Surface客户端。

也就是说,只有当Surface对象创建完成后,Surface的客户端(如Camera)才能在Surface的缓冲区绘制,而当Surface不存在时,Surface的缓冲区不能有任何绘制的内容。SurfaceHolder.Callback接口就是用于监听Surface的生命周期事件,以便控制Surface与其客户端协同工作,其三个回调方法如下(当Surface和其客户端关联/不再关联时回调):

http://bbs.zhulong.com/101030_group_693/detail30595747
http://bbs.zhulong.com/101030_group_693/detail30595750
http://bbs.zhulong.com/101030_group_693/detail30595753
http://bbs.zhulong.com/101030_group_693/detail30595756
http://bbs.zhulong.com/101030_group_693/detail30595759
http://bbs.zhulong.com/101030_group_693/detail30595762
http://bbs.zhulong.com/101030_group_693/detail30595768
http://bbs.zhulong.com/101030_group_693/detail30595774
http://bbs.zhulong.com/101030_group_693/detail30595765
http://bbs.zhulong.com/101030_group_693/detail30595777
http://bbs.zhulong.com/101030_group_693/detail30595780
http://bbs.zhulong.com/101030_group_693/detail30595786
http://bbs.zhulong.com/101030_group_693/detail30595783
http://bbs.zhulong.com/101030_group_693/detail30595792
http://bbs.zhulong.com/101030_group_693/detail30595789
http://bbs.zhulong.com/101030_group_693/detail30595795
http://bbs.zhulong.com/101030_group_693/detail30595798
http://bbs.zhulong.com/101030_group_693/detail30595801
http://bbs.zhulong.com/101030_group_693/detail30595804
http://bbs.zhulong.com/101030_group_693/detail30595807
http://bbs.zhulong.com/101030_group_693/detail30595810
http://bbs.zhulong.com/101030_group_693/detail30595813
http://bbs.zhulong.com/101030_group_693/detail30595816
http://bbs.zhulong.com/101030_group_693/detail30595819
http://bbs.zhulong.com/101030_group_693/detail30595822
http://bbs.zhulong.com/101030_group_693/detail30595825
http://bbs.zhulong.com/101030_group_693/detail30595828
http://bbs.zhulong.com/101030_group_693/detail30595831
http://bbs.zhulong.com/101030_group_693/detail30595834
http://bbs.zhulong.com/101030_group_693/detail30595837
http://bbs.zhulong.com/101030_group_693/detail30595840
http://bbs.zhulong.com/101030_group_693/detail30595843
http://bbs.zhulong.com/101030_group_693/detail30595846
http://bbs.zhulong.com/101030_group_693/detail30595849
http://bbs.zhulong.com/101030_group_693/detail30595852
http://bbs.zhulong.com/101030_group_693/detail30595855
http://bbs.zhulong.com/101030_group_693/detail30595858
http://bbs.zhulong.com/101030_group_693/detail30595861
http://bbs.zhulong.com/101030_group_693/detail30595864
http://bbs.51cto.com/thread-1477798-1.html
http://bbs.51cto.com/thread-1477799-1.html
http://bbs.51cto.com/thread-1477800-1.html
http://bbs.51cto.com/thread-1477801-1.html
http://bbs.51cto.com/thread-1477802-1.html
http://bbs.51cto.com/thread-1477803-1.html
http://bbs.51cto.com/thread-1477804-1.html
http://bbs.51cto.com/thread-1477805-1.html
http://bbs.51cto.com/thread-1477806-1.html
http://bbs.51cto.com/thread-1477807-1.html
http://bbs.51cto.com/thread-1477808-1.html
http://bbs.51cto.com/thread-1477809-1.html
http://bbs.51cto.com/thread-1477810-1.html
http://bbs.51cto.com/thread-1477811-1.html
http://bbs.51cto.com/thread-1477812-1.html
http://bbs.51cto.com/thread-1477813-1.html
http://bbs.51cto.com/thread-1477814-1.html
http://bbs.51cto.com/thread-1477815-1.html
http://bbs.51cto.com/thread-1477816-1.html
http://bbs.51cto.com/thread-1477817-1.html
http://bbs.51cto.com/thread-1477818-1.html
http://bbs.51cto.com/thread-1477819-1.html
http://bbs.51cto.com/thread-1477820-1.html
http://bbs.51cto.com/thread-1477821-1.html
http://bbs.51cto.com/thread-1477822-1.html
http://bbs.51cto.com/thread-1477823-1.html
http://bbs.51cto.com/thread-1477824-1.html
http://bbs.51cto.com/thread-1477825-1.html
http://bbs.51cto.com/thread-1477826-1.html
http://bbs.51cto.com/thread-1477827-1.html
http://bbs.51cto.com/thread-1477828-1.html
http://bbs.51cto.com/thread-1477829-1.html
http://bbs.51cto.com/thread-1477830-1.html
http://bbs.51cto.com/thread-1477831-1.html
http://bbs.51cto.com/thread-1477832-1.html
http://bbs.51cto.com/thread-1477833-1.html
http://bbs.51cto.com/thread-1477835-1.html
http://bbs.51cto.com/thread-1477834-1.html
http://bbs.51cto.com/thread-1477836-1.html
http://bbs.51cto.com/thread-1477837-1.html
http://bbs.51cto.com/thread-1477838-1.html
http://bbs.51cto.com/thread-1477839-1.html
http://bbs.51cto.com/thread-1477840-1.html
http://bbs.51cto.com/thread-1477842-1.html
http://bbs.51cto.com/thread-1477843-1.html
http://bbs.51cto.com/thread-1477844-1.html
http://bbs.51cto.com/thread-1477845-1.html
http://bbs.51cto.com/thread-1477846-1.html
http://bbs.51cto.com/thread-1477847-1.html
http://bbs.51cto.com/thread-1477848-1.html
http://bbs.51cto.com/thread-1477849-1.html
http://bbs.51cto.com/thread-1477850-1.html
http://bbs.51cto.com/thread-1477851-1.html
http://bbs.51cto.com/thread-1477853-1.html
http://bbs.51cto.com/thread-1477852-1.html
http://bbs.51cto.com/thread-1477854-1.html
http://bbs.51cto.com/thread-1477855-1.html
http://bbs.51cto.com/thread-1477856-1.html
http://bbs.51cto.com/thread-1477857-1.html
http://bbs.51cto.com/thread-1477858-1.html
http://bbs.51cto.com/thread-1477859-1.html
http://bbs.51cto.com/thread-1477860-1.html
http://bbs.51cto.com/thread-1477861-1.html
http://bbs.51cto.com/thread-1477862-1.html
http://bbs.51cto.com/thread-1477863-1.html
http://bbs.51cto.com/thread-1477864-1.html
http://bbs.51cto.com/thread-1477865-1.html
http://bbs.51cto.com/thread-1477866-1.html
http://bbs.51cto.com/thread-1477867-1.html
http://bbs.51cto.com/thread-1477868-1.html
http://bbs.51cto.com/thread-1477869-1.html
http://bbs.51cto.com/thread-1477870-1.html
http://bbs.51cto.com/thread-1477871-1.html
http://bbs.51cto.com/thread-1477873-1.html
http://bbs.51cto.com/thread-1477872-1.html
http://bbs.51cto.com/thread-1477874-1.html
http://bbs.51cto.com/thread-1477875-1.html
http://bbs.51cto.com/thread-1477876-1.html
http://bbs.51cto.com/thread-1477877-1.html
http://bbs.51cto.com/thread-1477879-1.html
http://bbs.51cto.com/thread-1477878-1.html
http://bbs.51cto.com/thread-1477880-1.html
http://bbs.51cto.com/thread-1477882-1.html
http://bbs.51cto.com/thread-1477883-1.html
http://bbs.51cto.com/thread-1477884-1.html
http://bbs.51cto.com/thread-1477885-1.html
http://bbs.51cto.com/thread-1477886-1.html
http://bbs.51cto.com/thread-1477887-1.html
http://bbs.51cto.com/thread-1477888-1.html
http://bbs.51cto.com/thread-1477889-1.html
http://bbs.51cto.com/thread-1477890-1.html
http://bbs.51cto.com/thread-1477891-1.html
http://bbs.51cto.com/thread-1477892-1.html
http://bbs.51cto.com/thread-1477893-1.html
http://bbs.51cto.com/thread-1477894-1.html
http://bbs.51cto.com/thread-1477895-1.html
http://bbs.51cto.com/thread-1477896-1.html
http://bbs.51cto.com/thread-1477897-1.html
http://bbs.51cto.com/thread-1477898-1.html
http://bbs.51cto.com/thread-1477899-1.html
http://bbs.51cto.com/thread-1477901-1.html
http://bbs.51cto.com/thread-1477902-1.html
http://bbs.51cto.com/thread-1477903-1.html
http://bbs.51cto.com/thread-1477904-1.html
http://bbs.51cto.com/thread-1477905-1.html
http://bbs.51cto.com/thread-1477906-1.html
http://bbs.51cto.com/thread-1477907-1.html
http://bbs.51cto.com/thread-1477908-1.html
http://bbs.51cto.com/thread-1477909-1.html
http://bbs.51cto.com/thread-1477910-1.html
http://bbs.51cto.com/thread-1477911-1.html
http://bbs.51cto.com/thread-1477912-1.html
http://bbs.51cto.com/thread-1477913-1.html
http://bbs.51cto.com/thread-1477914-1.html
http://bbs.51cto.com/thread-1477915-1.html
http://bbs.51cto.com/thread-1477916-1.html
http://bbs.51cto.com/thread-1477917-1.html
http://bbs.51cto.com/thread-1477918-1.html
http://bbs.51cto.com/thread-1477920-1.html
http://bbs.51cto.com/thread-1477921-1.html
http://bbs.51cto.com/thread-1477923-1.html
http://bbs.51cto.com/thread-1477924-1.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值