Awesomium::WebCore Class Reference

#include <WebCore.h>

List of all members.

Public Member Functions

 WebCore (const std::wstring &cachePath=L"", const std::wstring &cookiePath=L"", const std::wstring &pluginPath=L"", const std::wstring &logPath=L"", LogLevel level=LOG_NORMAL, bool enablePlugins=false, PixelFormat pixelFormat=PF_BGRA)
 ~WebCore ()
void setBaseDirectory (const std::string &baseDirectory)
void setBaseDirectory (const std::wstring &baseDirectory)
WebViewcreateWebView (int width, int height, bool isTransparent=false, bool enableAsyncRendering=false, int maxAsyncRenderPerSec=70)
void setCustomResponsePage (int statusCode, const std::string &filePath)
void update ()
const std::wstring & getBaseDirectory () const
PixelFormat getPixelFormat () const
bool arePluginsEnabled () const
void pause ()
void resume ()

Static Public Member Functions

static WebCoreGet ()
static WebCoreGetPointer ()

Protected Member Functions

void queueEvent (WebViewEvent *event)
void removeWebView (WebView *view)
void purgePluginMessages ()
void resolveJSValueFuture (WebView *view, int requestID, JSValue *result)
void getCustomResponsePage (int statusCode, std::string &filePathResult)

Protected Attributes

base::Thread * coreThread
WebCoreProxy * coreProxy
base::AtExitManager * atExitMgr
std::vector< WebView * > views
std::queue< WebViewEvent * > eventQueue
std::map< int, std::string > customResponsePageMap
std::wstring baseDirectory
bool logOpen
bool pluginsEnabled
const PixelFormat pixelFormat
Lock * eventQueueLock
Lock * baseDirLock
Lock * customResponsePageLock

Static Protected Attributes

static WebCoreinstance = 0

Friends

class WebView
class FutureJSValue
class ::WebCoreProxy
class ::WebViewProxy
class ::NamedCallback
class ::WindowlessPlugin
std::string GetDataResource (int id)


Detailed Description

The WebCore singleton manages the creation of WebViews, the internal worker thread, and various other global states that are required to embed Chromium.

Constructor & Destructor Documentation

Awesomium::WebCore::WebCore ( const std::wstring &  cachePath = L"",
const std::wstring &  cookiePath = L"",
const std::wstring &  pluginPath = L"",
const std::wstring &  logPath = L"",
LogLevel  level = LOG_NORMAL,
bool  enablePlugins = false,
PixelFormat  pixelFormat = PF_BGRA 
)

Instantiates the WebCore singleton (you can access it later with WebCore::Get or GetPointer).

Parameters:
cachePath An absolute path to the directory that will be used to store the cache. If an empty string is specified, the cache will not persist between sessions.
cookiePath An absolute path to the directory that will be used to store cookies. If an empty string is specified, cookies will not persist between sessions.
pluginPath An absolute path that will be included in the search for plugins. This is useful if you wish to bundle certain plugins with your application.
logPath The path to store the awesomium.log. If none is specified, the log will be stored in the working directory.
level The logging level to use (default is LOG_NORMAL).
enablePlugins Whether or not to enable embedded plugins. (default is FALSE) Note that the Flash and Silverlight plugins are only fully-supported on the Windows platform at this time.
pixelFormat The pixel-format/byte-ordering to use when rendering WebViews.

Awesomium::WebCore::~WebCore (  ) 

Destroys the WebCore singleton. (Also destroys any lingering WebViews)


Member Function Documentation

bool Awesomium::WebCore::arePluginsEnabled (  )  const

Returns whether or not plugins are enabled.

Awesomium::WebView * Awesomium::WebCore::createWebView ( int  width,
int  height,
bool  isTransparent = false,
bool  enableAsyncRendering = false,
int  maxAsyncRenderPerSec = 70 
)

Creates a new WebView.

Parameters:
width The width of the WebView in pixels.
height The height of the WebView in pixels.
isTransparent Whether or not the background of a WebView should be rendered as transparent.
enableAsyncRendering Enables fully-asynchronous rendering, see the note below.
maxAsyncRenderPerSec The maximum times per second this WebView should asynchronously render.
Note:
When asynchronous rendering is enabled, all rendering takes place on another thread asynchronously. The benefit of this behavior is that you may see a marked performance increase on machines with multi-core processors (especially when a WebView has high-animation content).
Returns:
Returns a pointer to the created WebView.

WebCore & Awesomium::WebCore::Get (  )  [static]

Retrieves the WebCore singleton.

Note:
This will assert if the singleton is not instantiated.
Returns:
Returns a reference to the instance.

const std::wstring & Awesomium::WebCore::getBaseDirectory (  )  const

Retrieves the base directory.

Returns:
Returns the current base directory.

PixelFormat Awesomium::WebCore::getPixelFormat (  )  const

Retrieves the pixel format being used.

WebCore * Awesomium::WebCore::GetPointer (  )  [static]

Retrieves the WebCore singleton.

Returns:
Returns a pointer to the instance.

void Awesomium::WebCore::pause (  ) 

Pauses the internal thread of the Awesomium WebCore.

Note:
The pause and resume functions were added as a temporary workaround for threading issues with Flash plugins on the Mac OSX platform. You should call WebCore::pause right before handling the message loop in your main thread (usually via SDL_PollEvents) and immediately call resume after. Note that this method is not foolproof and is quite experimental. A much better method has since been discovered but to implement it will require a major change to the current architecture of Awesomium. This architecture rehaul will be conducted in an upcoming release.

void Awesomium::WebCore::resume (  ) 

Resumes the internal thread of the Awesomium WebCore.

Note:
See WebCore::pause.

void Awesomium::WebCore::setBaseDirectory ( const std::wstring &  baseDirectory  ) 

Sets the base directory.

Parameters:
baseDirectory The absolute path to your base directory. The base directory is a location that holds all of your local assets. It will be used for WebView::loadFile and WebView::loadHTML (to resolve relative URLs).

void Awesomium::WebCore::setBaseDirectory ( const std::string &  baseDirectory  ) 

Sets the base directory.

Parameters:
baseDirectory The absolute path to your base directory. The base directory is a location that holds all of your local assets. It will be used for WebView::loadFile and WebView::loadHTML (to resolve relative URLs).

void Awesomium::WebCore::setCustomResponsePage ( int  statusCode,
const std::string &  filePath 
)

Sets a custom response page to use when a WebView encounters a certain HTML status code from the server (such as '404 - File not found').

Parameters:
statusCode The status code this response page should be associated with. See <http://en.wikipedia.org/wiki/List_of_HTTP_status_codes>
filePath The local page to load as a response, should be a path relative to the base directory.

void Awesomium::WebCore::update (  ) 

Updates the WebCore and allows it to conduct various operations such as the propagation of bound JS callbacks and the invocation of any queued listener events.


The documentation for this class was generated from the following files:

Generated on Wed Sep 23 14:27:48 2009 for Awesomium by  doxygen 1.5.8