- 浏览: 139605 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
zoutm:
文章写得深入浅出,顶
我们为什么要关注MapReduce? -
gongmingwind:
写的不错
Cookie的格式及组成 -
yanite:
翻译的不全,而且把不该翻译的也译了,郁闷.
HTTP/1.1 RFC2616中文 -
RStallman:
哪一个兼容性最好?最快?前提是免费的。
总结Embedding Brower JAVA API -
jiangzhx:
你好,请问你找到不带GUI,可以渲染html的工具了吗,谢谢j ...
总结Embedding Brower JAVA API
Google一直传言要做自己的浏览器,上周三终于出了Windows环境下的Beta版。Google总是提供免费的午餐,这次也不例外,不是指免费使用google浏览器,而是指代码完全开源。
本来还没开始编译,先Copy在这:http://sites.google.com/a/chromium.org/dev/developers/how-tos/getting-started
Getting Started
If you're serious about learning how Chromium works, this is the page for you. You'll get the Chromium code and build it. Then you'll use the Visual Studio 2005 debugger to see how the browser works — in particular, how it responds to common user actions.
Get the software you need
Prerequisite software
First, your computer must have the following software installed:- Windows XP (SP2 or later) or Windows Vista
- Microsoft Visual Studio 2005 (8.0)
Additional (free) downloads
Once Visual Studio is installed, you need to download and install some more software.
- Download and install Microsoft Visual Studio 2005 Service Pack 1
.
Depending on your computer, installation can take about an hour, and you might need to reboot.
- Download and install the Microsoft Windows SDK
.
You might need to reboot. You can save space by not installing the documentation and code samples.
Note: Although the SDK says it's for Vista, it works on both XP and Vista. If you already have the Microsoft 2008 SDK, you don't need to install a new one.
- Integrate the SDK with Visual Studio:
Start > All Programs > Microsoft Windows SDK > Visual Studio Registration > Integrate Windows SDK with Visual Studio 2005
- Get the Chromium depot_tools
:
- Download depot_tools.zip
.
- Unzip the file.
Note: If you have Cygwin installed, don't use its unzip tool; it will mess up the permissions.
- Add the depot tools directory to your PATH. Example: C:\bin\depot_tools
Note: By default, the depot_tools will automatically update to the latest version every time you run gclient . See the depot_tools page if you want to disable this behavior.
- Download depot_tools.zip
.
Chromium code
If you only want to look at the source code, you'll need at least 1.6 GB of hard drive space available. If you want to build it, you will need just under 10 GB of space, including all the object files and executables.
To bootstrap using the tarball:
- Make sure that you have a program that can untar .tar.gz
files. Examples include the open-source 7-Zip
archiver, the free BsdTar utility (part of LibArchive
), and WinZip.
- Download the source tarball
.
- Choose a directory to hold your source code. Example: c:\chromiumtrunk
Important: Make sure the directory path has no spaces .
- Untar the source tarball into the directory you've chosen. Example: If you're using LibArchive, issue the following command:
"C:\Program Files\GnuWin32\bin\bsdtar.exe" -xzf chromium.tgz
- Optionally, sync to the latest revision of Chromium:
-
Visit the Chromium Buildbot waterfall
to see the state of the tree. [Note: If this part of the infrastructure is not yet working, please check the topic of the #chromium IRC
channel on irc.freenode.net instead.]
If the top of the waterfall says:
OPEN - The tree is in a good state and you should be able to compile the code. Go to the next step.
CLOSED - There might be compile or test failures. You can download the code, but you'll get those same failures when you try to compile or run tests. Best to check back later.
- In a shell window, execute the following commands:
cd c:\chromiumtrunk
gclient sync
The gclient tool is included in the depot tools described above. The first time you execute gclient, there will be a delay (a minute or so) while it updates the depot tools.
-
Visit the Chromium Buildbot waterfall
to see the state of the tree. [Note: If this part of the infrastructure is not yet working, please check the topic of the #chromium IRC
channel on irc.freenode.net instead.]
If the top of the waterfall says:
You'll use the gclient depot tool to download the Chromium code from its SVN repository.
- Create a directory to hold your source code. Example: c:\chromiumtrunk
Important: Make sure the directory path has no spaces .
- Visit the Chromium Buildbot waterfall
to see the state of the tree. [Note: If this part of the infrastructure is not yet working, please check the topic of the #chromium IRC
channel on irc.freenode.net instead.]
If the top of the waterfall says:
OPEN - The tree is in a good state and you should be able to compile the code. Go to the next step.
CLOSED - There might be compile or test failures. You can download the code, but you'll get those same failures when you try to compile or run tests. Best to check back later.
- In a shell window, execute the following commands:
cd c:\chromiumtrunk
gclient config http://src.chromium.org/svn/trunk/src
gclient sync
The first time you execute gclient , there will be a delay (a minute or so) while it updates the depot tools. Downloading the Chromium code takes about an hour.
Build and launch Chromium
- Launch Visual Studio.
- Choose File > Open Project/Solution...
, go to the src\chrome
directory (under c:\chromiumtrunk
or wherever you put the Chromium files), and open the file chrome.sln
.
- In the Solution Explorer, go to the App
directory, right-click chrome_exe
, and choose Set as StartUp Project
.
- Set the user profile used by your build of Chromium:
- Right-click chrome_exe
, and choose Properties
.
- In the left column, choose Configuration Properties > Debugging
.
- In the right column, change the value of Command Arguments
to something like this:
--user-data-dir=c:\tmp\DebugProfile
Click Ok . Chromium creates the specified profile directory (c:\tmp\DebugProfile in the previous example) if the directory doesn't already exist.
Note: If you don't set the profile, then if you try to launch Chromium when Google Chrome or Chromium is already running, a new window comes up in the already running browser . This behavior ensures exclusive access to the user profile, but it means that you can't debug your version of Chromium!
Warning: If the latest build of Chromium has a new profile format, Google Chrome and older versions of Chromium might not be able to read that format. Unless you set the profile, you could lose your Google Chrome profile data.
- Right-click chrome_exe
, and choose Properties
.
- Press F5
, which builds the chrome_exe
solution and launches Chromium in debug mode. When you're asked whether to build out-of-date projects, choose Yes
.
-
Building takes 15-40 minutes. When the build completes, a browser window appears on your desktop.
If the build fails or a new browser window does not appear, go to Build Instructions (Windows) for help.
Take the tour
User action: Entering URLs
You can easily find the code that's executed when the user enters a URL at the address bar.
- Open (Ctrl+O
) the file src\chrome\browser\autocomplete\autocomplete_edit.cc
.
- Place a breakpoint at the AutocompleteEdit::AcceptInput
method.
The AcceptInput method is called whenever the user enters a URL.
- Go to your Chromium browser window, type in a web address such as google.com
, and press Return. The UI should freeze when the breakpoint is hit.
Note: If the UI doesn't freeze, then you probably didn't set the profile used by your build of Chromium. Please do so (see Step 4 of Build and launch Chromium ) or close all Google Chrome and Chromium windows on your desktop. Then go back to Visual Studio and press F5 again to run the browser within the debugger.
- Take a look at the call stack (Debug > Windows > Call Stack
).
It shows you the path that the event took from the window system to the
Chromium code that starts processing the user-entered URL.
- Step through the code (F10
), looking at the Locals
tab to see the values of variables such as url
, until you reach the line that invokes the OpenURL
method.
- Look at the code and the Locals
tab to see the values of the arguments to OpenURL
.
You can see that the URL has been fleshed out (from "google.com" to
"http://google.com/", for example), the transition is set to 1 (PageTransition::LINK
),
and so on. Because you entered the URL by typing, rather than clicking
an item in the drop-down, the next-to-last variable is set to AutocompletePopup::kNoMatch
.
- To find out more about page transitions, select the word PageTransition
, right-click, and choose Go To Definition
. You'll see the definition of PageTransition
in src\chrome\common\page_transition_types.h
.
As the source code and comments show, page transitions describe what
triggered the page visit. Transitions include clicks on links, typed-in
URLs (like the one in this case), form submissions, reloads, and more.
- Go back to the autocomplete_edit.cc
tab, and step into the OpenURL
method (F11
). When you find yourself looking at code that's too low level, step out (Shift-F11
) and step again (F11
). Continue stepping through the code to follow what happens as the page is loaded.
- When you're ready to go on, press F5
to continue executing the browser.
- Optional: Try other ways of entering a URL. For example:
- Start typing in a URL, but instead of pressing Enter, use the mouse
to click a URL from the drop-down. Compare the call stack and variable
values to the ones that you saw previously.
- Enter one character or word -- one you haven't used before, such as x
-- into the URL field. Note that the variable alternative_nav_url
soon has a value, such as http://x/
. Also note that the transition is 5, indicating that the URL has been generated (PageTransition::GENERATED
).
- Drag a URL into the browser. Note that the call stack is different, since AcceptInput
is called by a drop event handler.
For more information, see the Navigating from the URL bar section of Getting Around the Chromium Source Code .
User action: Clicking links
The browser's response to clicks on links is a bit complicated, due to Chromium's multi-process, multi-threaded architecture.
- Open (Ctrl+O) the file src\chrome\browser\browser.cc
.
- Place a breakpoint at the Browser::NavigationStateChanged
method.
- Click a link in any page. You'll hit the breakpoint.
- Look at the call stack. You'll see method calls related to message passing between threads in the same process (such as MessageLoop::QueueOrRunTask
; see Threading
) and between processes (such as RenderViewHost::OnMessageReceived
; see Multi-process Architecture
and Inter-process Communication
).
- Press F5 to start executing again. You'll immediately hit another breakpoint, as the tab redraws itself.
Feature: Browser commands
Often, the user can request an operation in more than one way. For example, the user can reload a page by pressing the Reload button or by pressing F5. To avoid duplicating code, many operations are handled by common code, in the form of commands .
- Open (Ctrl+O) the file src\chrome\browser\browser_commands.cc
.
- Place a breakpoint at the Browser::ExecuteCommand
method.
- In the browser, press the star button
to the left of the address bar. You'll hit the breakpoint.
- Look at the call stack. It includes a chain of mouse-release event handlers, including BaseButton::OnMouseReleased
.
- In the Locals tab, look at the value of id
. It identifies the operation that the user requested.
- Step into the case statement (IDC_STAR
)
that handles this operation. Note that the action is being recorded
into user metrics, and then the code to perform the action is called.
- Select IDC_STAR
, right-click, and choose Go To Definition. You'll see its definition (and those of many other commands) in chrome_dll_resource.h
.
- Press F5
to continue executing the browser.
- Press Ctrl+D
, the keyboard alternative for star. You'll hit the breakpoint again.
- Look at the call stack. This time, it contains mostly calls related
to inter-process and thread-to-thread communication. The only keyboard
event handler that's visible in the call stack is WebContents::HandleKeyboardEvent
.
- Note that the value of id
is the same as before, so the same code will be executed as when you used the star button.
- Optional:
Look at other browser commands, including some menu commands. For example:
- Ctrl+T
and the New tab
menu item
- Reload button
and F5
What next?
Now that you've built Chromium and stepped through some of its code, here are some suggestions for what you might want to do now.
- Read Getting Around the Chromium Source Code
- Read the design docs
- Visit the Chromium blog and subscribe to its RSS feed
- Visit developer discussion groups
- Think about how you want to get involved
发表评论
-
ant start stop tomcat
2009-05-30 11:55 2526<target name="tomca ... -
暂时存记录:spring乱码过滤器
2008-11-05 22:59 1505<filter> <filt ... -
关于http的Last-Modified和ETag
2008-09-02 17:05 20751) 什么是”Last-Modifie ... -
Http的一些编码
2008-09-01 15:43 1885HTTP Headers The headers of a H ... -
分布式Web爬虫的设计
2008-08-20 11:55 3300URL管理服务器(URL-Server):负责url的集中管理 ... -
Java 5.0的多线程类或接口
2008-08-19 17:49 1089Executor ExecutorService Callab ... -
JDK5.0 Excutor创建线程池
2008-08-19 16:11 1860import java.util.concurrent.Exe ... -
Java正则表达式
2008-08-10 13:21 1325两个问题 a. 如何知道一个url是 ... -
Java theory and practice: Dealing with Interrupte
2008-07-29 15:07 1376Many Java™ language methods, su ... -
Swing HTML显示组件
2008-07-17 10:33 5967Java Swing本身没有提供好的html显示组件,而且也不 ... -
总结Embedding Brower JAVA API
2008-07-10 11:32 3824总结一些找到的嵌入浏览器: WebRenderer 对 ... -
Cookie的格式及组成
2008-06-26 10:49 30027Cookie由变量名和值组 ... -
HTTP头信息
2008-06-25 16:24 1851HTTP的头域包括通用头,请求头,响应头和实体头四个部 ... -
HTTP Cookie & Session
2008-06-25 15:50 3747COOKIECOOKIE是大家都非常 ... -
HTTP 1.0 与 1.1比较
2008-06-25 14:32 5273一个WEB站点每天可能要接收到上百万的用户请求,为了提高系统 ... -
HTTP/1.1 RFC2616中文
2008-06-25 14:27 6497官方RFC2616文档: http://www ... -
Watij - Web Application Testing in Java
2008-05-29 16:54 2357发现一个抓取动态网页的好东东: Watij (pro ... -
Commons 命令行接口使用(未翻译)
2008-05-15 16:12 1376暂未翻译,链接主页http://commons.apache. ... -
Java局部线程变量---ThreadLocal
2008-05-15 16:02 6241ThreadLocal是什么 早在J ... -
Heritrix QueueAssignmentPolicy问题
2008-04-30 17:51 3759Re: [archive-crawler] Extend Qu ...
相关推荐
google_chrome浏览器编译过程
编译google浏览器所需要的工具
Google 浏览器Chrome 那么多进程怎么办?.docx
最好的开发调试浏览器chrome,还需要一个json数据格式化展示插件
qt+cef调用浏览器,必须安装谷歌浏览器,基于谷歌内核的
使用CEF接口 将google chrome内核嵌入win32程序,使用VC编译的google内核浏览器
基于更强大的JavaScript V8引擎极强高效超快的浏览器,谷歌浏览器是一款可让您更快速、轻松且安全地使用网络的浏览器,它的设计超级简洁,使用起来更加方便,Google Chrome支持多标签浏览,每个标签页面都在独立的...
Winfrom上替代自带浏览器,最新谷歌内核:96.0.4664.55,本人测试支持.NET Framework和.NET 5.0版本Winform,理论上支持WPF。使用时将对应平台Release文件夹复制到程序目录即可,96.0.14版本CefSharp适用。
非常简单的一个实例,可在此基础上开发自己的作品。 CEF功能强大 但使用起来比 Web Browser 复杂的多,而且它的官方例子 cefsimple 和 cefclient 都是使用 Win32 API 开发的,这给大家...vs2012及更高版本可编译运行。
易语言爱好者的福星,cef浏览器框架,c++封装的易语言支持库,开发者可以轻松的使用易语言调用谷歌内核框架,实现各种操作。内部包含了各种调用实例。
Otter Browser 水獭浏览器 水獭浏览器 - 模仿opera12界面, 基于qt5的webkit浏览器. 等于个人制作山寨版Safari, 支持二代半引擎, 苹果WebEngine/谷歌Blink. 作者: 波兰 Emdek 恩德克 代码可用,本人亲测,qt5.5+vs...
vue.js的devtools安装,实现了谷歌浏览器可以直接查看vue源码,类似h5的元素开发者模式。 方法1:打开谷歌浏览器>更多工具>拓展程序(直接把解压缩的文件拖进去,ctrl+r即可) 方法2:打开谷歌浏览器>输入网址:...
由于文件比较大房子百度网盘里,资源文件里是百度网盘的链接及提起码。资源包括源码,cmake安装包,编译后生成的可执行程序,及cmake生成后的vs2019工程。 内容:mfc 集成 cef3 生成 vs 工程及编译示例
自定义浏览器,支持视频播放,flash播放,谷歌浏览器内核,自主编译,内包含已经编译的dll
mfc对话框程序中嵌入chrome浏览器,包含完整h、lib、dll。开始下载的最新版开发包CEF 3.3578.1864.gfa073f3,发现程序运行10几秒后,总是会弹出新窗口。后改用稳定版开发包cef3.2623.1401.gb90a3be,该问题得到解决...
经过两周探索编译chrome源码,终于编译出了google浏览器的chrome.exe文件,编译方法总结为一篇文档
谷歌WebRTC,名称源自网页实时通信,是一个支持网页浏览器进行实时语音对话或视频对话的技术。本人第一次编译webrtc,记录了编译中遇到的问题,供大家学习交流.zip
谷歌vue调试插件,vue-detools,已经编译好,用户只需要用浏览器加载src/chrome即可
仿谷歌浏览器的TabWidget,实现Tab右侧的增加按钮,Tab可拖出,拖动时缩略图显示。用VS2012开发
谷歌Chrome浏览器的js引擎源码啊,想要的快下!~