- Initialize WebKit in the UI thread to avoid asserts due to WTF::isMainThread() returning false. (Issue #21, Issue #24).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@27 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2009-06-01 14:12:34 +00:00
parent c295931b1e
commit a0a0ae326c
3 changed files with 17 additions and 6 deletions

View File

@ -9,6 +9,7 @@
#include "browser_resource_loader_bridge.h"
#include "browser_request_context.h"
#include "browser_webkit_glue.h"
#include "browser_webkit_init.h"
#include "../include/cef_nplugin.h"
#include "base/command_line.h"
@ -162,6 +163,12 @@ bool CefContext::DoInitialize()
// Initialize the global CommandLine object.
CommandLine::Init(0, NULL);
// Initialize WebKit.
webkit_init_ = new BrowserWebKitInit();
// Initialize WebKit encodings
webkit_glue::InitializeTextEncoding();
// Initializing with a default context, which means no on-disk cookie DB,
// and no support for directory listings.
//PathService::Get(base::DIR_EXE, &cache_path);
@ -209,6 +216,10 @@ void CefContext::DoUninitialize()
delete statstable_;
statstable_ = NULL;
// Shut down WebKit.
delete webkit_init_;
webkit_init_ = NULL;
// Uninitialize COM stuff
OleUninitialize();
@ -249,6 +260,7 @@ CefContext::CefContext()
webprefs_ = NULL;
hinstance_ = ::GetModuleHandle(NULL);
next_browser_id_ = 1;
webkit_init_ = NULL;
}
CefContext::~CefContext()
@ -292,9 +304,6 @@ bool CefContext::Initialize(bool multi_threaded_message_loop,
};
RegisterClassEx(&wcex);
// Initialize WebKit encodings
webkit_glue::InitializeTextEncoding();
#ifndef _DEBUG
// Only log error messages and above in release build.
logging::SetMinLogLevel(logging::LOG_ERROR);

View File

@ -9,10 +9,11 @@
#include "../include/cef.h"
#include "base/at_exit.h"
#include "base/message_loop.h"
#include "base/stats_table.h"
#include "base/gfx/native_widget_types.h"
#include "webkit/glue/webpreferences.h"
#include "browser_webkit_init.h"
class BrowserWebKitInit;
class CefBrowserImpl;
class CefContext : public CefThreadSafeBase<CefBase>
@ -78,8 +79,8 @@ protected:
// Initialize the AtExitManager to avoid asserts and possible memory leaks.
base::AtExitManager at_exit_manager_;
// Initialize WebKit for this scope.
BrowserWebKitInit webkit_init_;
// WebKit implementation class.
BrowserWebKitInit* webkit_init_;
// Used for assigning unique IDs to browser instances.
int next_browser_id_;

View File

@ -7,6 +7,7 @@
#include "context.h"
#include "tracker.h"
#include "base/lazy_instance.h"
#include "base/string_util.h"
#include "webkit/api/public/WebKit.h"