源码版本

chromium源码基于r274914(35.0.1916.153)

吐槽

scope大法好,lock保平安,new在做,weakptr在看,不信factory留隐患,refcount不对自身灭。

chromium代码都是多个类按照一个模式进行组合,要按功能以模式为单位多个类放在一起理解。

用C++的OO写的代码,不管是好代码和烂代码都一样的不易读。好代码和烂代码唯一的区别就是读完了好代码结构比较清晰,而烂代码还是一样的烂。 继承给调试带来了无尽的痛苦,因为你跟到基类的方法不知道这个到底是基类实例化的对象还是子类实例化的对象。

一入chromium深似海,从此美剧是路人。

思路

            +--答案不正确-----+
            |                  \
            V                   \
提出问题->假设答案-+->静态走读代码印证答案--->调试代码确认答案-+->整理关系
                    \            |                  ^           \
                 没有思路        |                  |            +->整理时序
                      \          V                 /    
                       +->查找相关资料------------+    

每日工作

~note.txt +----> ~issuse.txt | +----> archive.md * 每日知识点,心得,问题记录在~note.txt中。 * 整理note内容,知识点和心得的归档为markdown格式的文档,问题归入issuse中, 未整理好的继续保留在note中。 * 使用有道词典管理chromium文档或源码中的词汇,每日复习词汇。

文档阅读

 略读 - 总结
  |
 保存
  |
 文中引用链接添加至~links.txt中
  |
找到作者其他相关的文档添加至~link.txt中

文档命名规则

0开头为笔记和总结 1开头的为base模块相关的源码分析

专有名词和缩写

  • POD Plain Old Data 在C++中,我们把传统的C风格的struct叫做POD(Plain Old Data)对象。 POD
标签: chromium
日期: 2014-06-27 17:30:06, 10 years and 203 days ago
  • force reset to the version of the last two 取消当前版本之前的两次提交
git reset --hard HEAD~2 
  • force push to the remote re 强制提交到远程版本库,从而删除之前的两次提交数据
git push origin HEAD --force
标签: git
日期: 2014-06-20 17:30:06, 10 years and 210 days ago

获取windows网络状态有三种方式:

  • InternetGetConnectedState(wininet.dll)直接获取

  • GetAdaptersAddresses(iphlpapi.dll)枚举网络适配器

  • Network Awareness

    • NLA in Windows XP

    • NLM in Vista or windows 7

源代码 source code

netaware - https://raw.githubusercontent.com/codepongo/utocode/master/windows/netaware.cpp

  • with iphlp - webkit的GetAdaptersAddresses方式的实现 webkit implementation
  • with nlm - NLM的同步实现 NLM synchronous implementation
  • with nlm event - NLM的异步实现 NLM asynchronous implementation
  • with wininet - InternetGetConnectedState的实现 InternetGetConnectedState implementation
  • with winsock - NLA的同步实现 NLA synchronous implementation
  • wait for change with winsock - NLA的异步实现 NLA asynchronous implementation
  • GetAdaptersAddresses方式的更准确实现可参考firefox的源码
    • 如果确定不了网络是否连接(如API失败等情况),则返回已连接状态
    • 通过获取AdapaterAddress AdapaterInfo和IPAddressTable进行综合判断
    • 通过NotifyAddrChange(http://msdn.microsoft.com/en-us/library/windows/desktop/aa366329.aspx)异步通知 伪代码如下:
def CheckAdapterAddress():
    addresses = GetAdaptersAddresses()
    for a in addresses:
        if a.OperStatus == IfOperStatusUp 
        and a.IfType != IF_TYPE_SOFTWARE_LOOPBACK
        and a.FirstUnicastAddress->Address.lpSockaddr != '192.168.0.1':
            return True;
    return False

def CheckAdaptersInfo():
    adapters = GetAdaptersInfo()
    for a in adapters:
        if a.DhcpEnabled:
            if a.DhcpServer.IpAddress == '255.255.255.255':
                return True;
            else:
                for ip in a.IpAddressList:
                    if ip == '0.0.0.0':
                        return True;
        return False;

def CheckIPAddrTable():
    tables = GetIpAddrTable()
    for t in tables:
        if t.dwAddr != 0 && t.dwAddr !=  0x0100007F:
            return True
    return False

reference 参考

标签: windows, webbrowser
日期: 2014-06-12 17:30:06, 10 years and 218 days ago
  • create a file and name it "desktop.scf" 新建名为“desktop.scf“的文件

  • copy bellow content in it 复制下面内容到文件中

[Shell]
Command=2
IconFile=%SystemRoot%system32SHELL32.dll,34
[Taskbar]
Command=ToggleDesktop
  • create a shortcut and move it into the "~\favorites\links" 创建一个快捷方式并拷贝到用户目录下的favorites\links下 ~ belongs to your home directory
标签: windows
日期: 2014-06-06 17:30:06, 10 years and 224 days ago