Showing posts with label WebKit. Show all posts
Showing posts with label WebKit. Show all posts

Wednesday, March 31, 2010

JavaScript Performance on Cortex-A8

You know, V8 by Google has the fastest JIT compiler. Many benchmarks get the top score on x86 environment. But how about on other CPU such as ARM? Any web sites don't research the benchmark on ARM.

I have a netbook using Freescale i.MX515. Although this net book "netwalker" is sold ($400?) at Japan market, I have tested Chromium 5.0 and Firefox 3.6 using Ubuntu 10.04 (lucid) beta. This data is on this environment.

This is interesting... V8 on ARM isn't optimized!. They should improve it for mobile market.

Tuesday, January 15, 2008

Using WebKit on Windows

Since I research WebKit, I try writing how to use WebKit in your application.

WebKit has COM interface, so you need use it via COM interface. This way is same as Trident (MSHTML Web Browser Control) of Internet Explorer.

Initialize

At first, you get IWebView interface using CoCreateInstance(). Then, when you call IWebView::initWithFrame() with window handle of parent window, so you can create WebKit window.

IWebView *pWebView;
HRESULT hr;

hr = ::CoCreateInstance(CLSID_WebView,
                        0,
                        CLSCTX_ALL,
                        IID_IWebView,
                        (void**)&pWebView);
if(hr != S_OK)
    goto error;

hr = pWebView->setHostWindow((OLE_HANDLE) hWnd);
if(hr != S_OK)
    goto error;

::GetClientRect(hWnd,&clientRect);
hr = pWebView->initWithFrame(clientRect, NULL, NULL);
if(hr != S_OK)
    goto error;

Loading URL...

You cannot use takeStringURL like MacOS X sample. This method will return E_NOTIMPL.

If you want to use WebKit on Windows, you get IWebURLRequest object via CoCreateInstance(), then, you call IWebFrame::loadRequest(). If you want to open HTML stirng, you can use other method of IWebView.

HRESULT hr;
BSTR str;
IWebFrame* pWebFrame;
IWebURLRequest * pWebURLRequest;
IWebView* pWebView;

hr = ::CoCreateInstance(CLSID_WebURLRequest,
                        0,
                        CLSCTX_ALL,
                        IID_IWebURLRequest,
                        (void**)&pWebURLRequest);
if(hr != S_OK)
    goto error;

str = ::SysAllocString(L"http://www.apple.com/");
hr = pWebURLRequest->initWithURL(str,
                                 WebURLRequestUseProtocolCachePolicy,
                                 60);
if(hr != S_OK)
    goto error;

hr = pWebView->mainFrame(&pWebFrame);
if(hr != S_OK)
    goto error;

hr = pWebFrame->loadRequest(pWebURLRequest);
if(hr != S_OK)
    goto error;

pWebURLRequest->Release();
pWebFrame->Release();