Update to Chromium rev 55388. Note that the Windows 7 SDK is now required to build Chromium.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@93 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2010-08-09 19:13:43 +00:00
parent 9ab2eca392
commit e5e560c64a
16 changed files with 578 additions and 535 deletions

View File

@@ -51,3 +51,4 @@ Date | CEF Revision | Chromium Revision
2010-02-11 | /trunk@71 | /trunk@38776 2010-02-11 | /trunk@71 | /trunk@38776
2010-03-29 | /trunk@72 | /trunk@42941 2010-03-29 | /trunk@72 | /trunk@42941
2010-06-21 | /trunk@82 | /trunk@50325 2010-06-21 | /trunk@82 | /trunk@50325
2010-08-09 | /trunk@93 | /trunk@55388

View File

@@ -219,6 +219,11 @@
'libcef_dll/transfer_util.cpp', 'libcef_dll/transfer_util.cpp',
'libcef_dll/transfer_util.h', 'libcef_dll/transfer_util.h',
], ],
'link_settings': {
'libraries': [
'-lcomctl32.lib',
],
},
}, },
{ {
'target_name': 'libcef_dll_wrapper', 'target_name': 'libcef_dll_wrapper',

View File

@@ -1,445 +1,450 @@
// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this // Copyright (c) 2010 The Chromium Authors. All rights reserved.
// source code is governed by a BSD-style license that can be found in the // Use of this source code is governed by a BSD-style license that can be
// LICENSE file. // found in the LICENSE file.
#include "browser_appcache_system.h" #include "browser_appcache_system.h"
#include "browser_resource_loader_bridge.h" #include "browser_resource_loader_bridge.h"
#include "base/callback.h" #include "base/callback.h"
#include "base/lock.h" #include "base/lock.h"
#include "base/task.h" #include "base/task.h"
#include "base/waitable_event.h" #include "base/waitable_event.h"
#include "webkit/appcache/appcache_interceptor.h" #include "webkit/appcache/appcache_interceptor.h"
#include "webkit/appcache/web_application_cache_host_impl.h" #include "webkit/appcache/web_application_cache_host_impl.h"
using WebKit::WebApplicationCacheHost; using WebKit::WebApplicationCacheHost;
using WebKit::WebApplicationCacheHostClient; using WebKit::WebApplicationCacheHostClient;
using appcache::WebApplicationCacheHostImpl; using appcache::WebApplicationCacheHostImpl;
using appcache::AppCacheBackendImpl; using appcache::AppCacheBackendImpl;
using appcache::AppCacheInterceptor; using appcache::AppCacheInterceptor;
using appcache::AppCacheThread; using appcache::AppCacheThread;
namespace appcache { namespace appcache {
// An impl of AppCacheThread we need to provide to the appcache lib. // An impl of AppCacheThread we need to provide to the appcache lib.
bool AppCacheThread::PostTask( bool AppCacheThread::PostTask(
int id, int id,
const tracked_objects::Location& from_here, const tracked_objects::Location& from_here,
Task* task) { Task* task) {
if (BrowserAppCacheSystem::thread_provider()) { if (BrowserAppCacheSystem::thread_provider()) {
return BrowserAppCacheSystem::thread_provider()->PostTask( return BrowserAppCacheSystem::thread_provider()->PostTask(
id, from_here, task); id, from_here, task);
} }
scoped_ptr<Task> task_ptr(task); scoped_ptr<Task> task_ptr(task);
MessageLoop* loop = BrowserAppCacheSystem::GetMessageLoop(id); MessageLoop* loop = BrowserAppCacheSystem::GetMessageLoop(id);
if (loop) if (loop)
loop->PostTask(from_here, task_ptr.release()); loop->PostTask(from_here, task_ptr.release());
return loop ? true : false; return loop ? true : false;
} }
bool AppCacheThread::CurrentlyOn(int id) { bool AppCacheThread::CurrentlyOn(int id) {
if (BrowserAppCacheSystem::thread_provider()) if (BrowserAppCacheSystem::thread_provider())
return BrowserAppCacheSystem::thread_provider()->CurrentlyOn(id); return BrowserAppCacheSystem::thread_provider()->CurrentlyOn(id);
return MessageLoop::current() == BrowserAppCacheSystem::GetMessageLoop(id); return MessageLoop::current() == BrowserAppCacheSystem::GetMessageLoop(id);
} }
} // namespace appcache } // namespace appcache
// BrowserFrontendProxy -------------------------------------------------------- // BrowserFrontendProxy --------------------------------------------------------
// Proxies method calls from the backend IO thread to the frontend UI thread. // Proxies method calls from the backend IO thread to the frontend UI thread.
class BrowserFrontendProxy class BrowserFrontendProxy
: public base::RefCountedThreadSafe<BrowserFrontendProxy>, : public base::RefCountedThreadSafe<BrowserFrontendProxy>,
public appcache::AppCacheFrontend { public appcache::AppCacheFrontend {
public: public:
explicit BrowserFrontendProxy(BrowserAppCacheSystem* appcache_system) explicit BrowserFrontendProxy(BrowserAppCacheSystem* appcache_system)
: system_(appcache_system) { : system_(appcache_system) {
} }
void clear_appcache_system() { system_ = NULL; } void clear_appcache_system() { system_ = NULL; }
virtual void OnCacheSelected(int host_id, int64 cache_id , virtual void OnCacheSelected(int host_id,
appcache::Status status) { const appcache::AppCacheInfo& info) {
if (!system_) if (!system_)
return; return;
if (system_->is_io_thread()) if (system_->is_io_thread())
system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
this, &BrowserFrontendProxy::OnCacheSelected, this, &BrowserFrontendProxy::OnCacheSelected,
host_id, cache_id, status)); host_id, info));
else if (system_->is_ui_thread()) else if (system_->is_ui_thread()) {
system_->frontend_impl_.OnCacheSelected(host_id, cache_id, status); system_->frontend_impl_.OnCacheSelected(host_id, info);
else }
NOTREACHED(); else
} NOTREACHED();
}
virtual void OnStatusChanged(const std::vector<int>& host_ids,
appcache::Status status) { virtual void OnStatusChanged(const std::vector<int>& host_ids,
if (!system_) appcache::Status status) {
return; if (!system_)
if (system_->is_io_thread()) return;
system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( if (system_->is_io_thread())
this, &BrowserFrontendProxy::OnStatusChanged, host_ids, status)); system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
else if (system_->is_ui_thread()) this, &BrowserFrontendProxy::OnStatusChanged, host_ids, status));
system_->frontend_impl_.OnStatusChanged(host_ids, status); else if (system_->is_ui_thread())
else system_->frontend_impl_.OnStatusChanged(host_ids, status);
NOTREACHED(); else
} NOTREACHED();
}
virtual void OnEventRaised(const std::vector<int>& host_ids,
appcache::EventID event_id) { virtual void OnEventRaised(const std::vector<int>& host_ids,
if (!system_) appcache::EventID event_id) {
return; if (!system_)
if (system_->is_io_thread()) return;
system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( if (system_->is_io_thread())
this, &BrowserFrontendProxy::OnEventRaised, host_ids, event_id)); system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
else if (system_->is_ui_thread()) this, &BrowserFrontendProxy::OnEventRaised, host_ids, event_id));
system_->frontend_impl_.OnEventRaised(host_ids, event_id); else if (system_->is_ui_thread())
else system_->frontend_impl_.OnEventRaised(host_ids, event_id);
NOTREACHED(); else
} NOTREACHED();
}
virtual void OnProgressEventRaised(const std::vector<int>& host_ids,
const GURL& url, virtual void OnProgressEventRaised(const std::vector<int>& host_ids,
int num_total, int num_complete) { const GURL& url,
if (!system_) int num_total, int num_complete) {
return; if (!system_)
if (system_->is_io_thread()) return;
system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( if (system_->is_io_thread())
this, &BrowserFrontendProxy::OnProgressEventRaised, host_ids, url, num_total, num_complete)); system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
else if (system_->is_ui_thread()) this, &BrowserFrontendProxy::OnProgressEventRaised,
system_->frontend_impl_.OnProgressEventRaised(host_ids, url, num_total, num_complete); host_ids, url, num_total, num_complete));
else else if (system_->is_ui_thread())
NOTREACHED(); system_->frontend_impl_.OnProgressEventRaised(
} host_ids, url, num_total, num_complete);
else
virtual void OnContentBlocked(int host_id){ NOTREACHED();
if (!system_) }
return;
if (system_->is_io_thread()) virtual void OnErrorEventRaised(const std::vector<int>& host_ids,
system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( const std::string& message) {
this, &BrowserFrontendProxy::OnContentBlocked, host_id)); if (!system_)
else if (system_->is_ui_thread()) return;
system_->frontend_impl_.OnContentBlocked(host_id); if (system_->is_io_thread())
else system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
NOTREACHED(); this, &BrowserFrontendProxy::OnErrorEventRaised,
host_ids, message));
} else if (system_->is_ui_thread())
system_->frontend_impl_.OnErrorEventRaised(
virtual void OnLogMessage(int host_id, appcache::LogLevel log_level, host_ids, message);
const std::string& message) { else
NOTREACHED();
if (!system_) }
return;
if (system_->is_io_thread()) virtual void OnLogMessage(int host_id,
system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( appcache::LogLevel log_level,
this, &BrowserFrontendProxy::OnLogMessage, host_id, log_level, message)); const std::string& message) {
else if (system_->is_ui_thread()) if (!system_)
system_->frontend_impl_.OnLogMessage(host_id, log_level, message); return;
else if (system_->is_io_thread())
NOTREACHED(); system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
} this, &BrowserFrontendProxy::OnLogMessage,
host_id, log_level, message));
private: else if (system_->is_ui_thread())
friend class base::RefCountedThreadSafe<BrowserFrontendProxy>; system_->frontend_impl_.OnLogMessage(
host_id, log_level, message);
~BrowserFrontendProxy() {} else
NOTREACHED();
BrowserAppCacheSystem* system_; }
};
virtual void OnContentBlocked(int host_id, const GURL& manifest_url) {}
// BrowserBackendProxy -------------------------------------------------------- private:
// Proxies method calls from the frontend UI thread to the backend IO thread. friend class base::RefCountedThreadSafe<BrowserFrontendProxy>;
class BrowserBackendProxy ~BrowserFrontendProxy() {}
: public base::RefCountedThreadSafe<BrowserBackendProxy>,
public appcache::AppCacheBackend { BrowserAppCacheSystem* system_;
public: };
explicit BrowserBackendProxy(BrowserAppCacheSystem* appcache_system)
: system_(appcache_system), event_(true, false) {
get_status_callback_.reset( // BrowserBackendProxy --------------------------------------------------------
NewCallback(this, &BrowserBackendProxy::GetStatusCallback)); // Proxies method calls from the frontend UI thread to the backend IO thread.
start_update_callback_.reset(
NewCallback(this, &BrowserBackendProxy::StartUpdateCallback)); class BrowserBackendProxy
swap_cache_callback_.reset( : public base::RefCountedThreadSafe<BrowserBackendProxy>,
NewCallback(this, &BrowserBackendProxy::SwapCacheCallback)); public appcache::AppCacheBackend {
} public:
explicit BrowserBackendProxy(BrowserAppCacheSystem* appcache_system)
virtual void RegisterHost(int host_id) { : system_(appcache_system), event_(true, false) {
if (system_->is_ui_thread()) { get_status_callback_.reset(
system_->io_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( NewCallback(this, &BrowserBackendProxy::GetStatusCallback));
this, &BrowserBackendProxy::RegisterHost, host_id)); start_update_callback_.reset(
} else if (system_->is_io_thread()) { NewCallback(this, &BrowserBackendProxy::StartUpdateCallback));
system_->backend_impl_->RegisterHost(host_id); swap_cache_callback_.reset(
} else { NewCallback(this, &BrowserBackendProxy::SwapCacheCallback));
NOTREACHED(); }
}
} virtual void RegisterHost(int host_id) {
if (system_->is_ui_thread()) {
virtual void UnregisterHost(int host_id) { system_->io_message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
if (system_->is_ui_thread()) { this, &BrowserBackendProxy::RegisterHost, host_id));
system_->io_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( } else if (system_->is_io_thread()) {
this, &BrowserBackendProxy::UnregisterHost, host_id)); system_->backend_impl_->RegisterHost(host_id);
} else if (system_->is_io_thread()) { } else {
system_->backend_impl_->UnregisterHost(host_id); NOTREACHED();
} else { }
NOTREACHED(); }
}
} virtual void UnregisterHost(int host_id) {
if (system_->is_ui_thread()) {
virtual void SelectCache(int host_id, system_->io_message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
const GURL& document_url, this, &BrowserBackendProxy::UnregisterHost, host_id));
const int64 cache_document_was_loaded_from, } else if (system_->is_io_thread()) {
const GURL& manifest_url) { system_->backend_impl_->UnregisterHost(host_id);
if (system_->is_ui_thread()) { } else {
system_->io_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( NOTREACHED();
this, &BrowserBackendProxy::SelectCache, host_id, document_url, }
cache_document_was_loaded_from, manifest_url)); }
} else if (system_->is_io_thread()) {
system_->backend_impl_->SelectCache(host_id, document_url, virtual void SelectCache(int host_id,
cache_document_was_loaded_from, const GURL& document_url,
manifest_url); const int64 cache_document_was_loaded_from,
} else { const GURL& manifest_url) {
NOTREACHED(); if (system_->is_ui_thread()) {
} system_->io_message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
} this, &BrowserBackendProxy::SelectCache, host_id, document_url,
cache_document_was_loaded_from, manifest_url));
virtual void SelectCacheForWorker( } else if (system_->is_io_thread()) {
int host_id, system_->backend_impl_->SelectCache(host_id, document_url,
int parent_process_id, cache_document_was_loaded_from,
int parent_host_id) { manifest_url);
} else {
if (system_->is_ui_thread()) { NOTREACHED();
system_->io_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( }
this, &BrowserBackendProxy::SelectCacheForWorker, host_id, parent_process_id, }
parent_host_id));
} else if (system_->is_io_thread()) { virtual void GetResourceList(
system_->backend_impl_->SelectCacheForWorker(host_id, parent_process_id, int host_id,
parent_host_id); std::vector<appcache::AppCacheResourceInfo>* resource_infos) {
} else { if (system_->is_ui_thread()) {
NOTREACHED(); system_->io_message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
} this, &BrowserBackendProxy::GetResourceList,
} host_id, resource_infos));
} else if (system_->is_io_thread()) {
virtual void SelectCacheForSharedWorker( system_->backend_impl_->GetResourceList(host_id, resource_infos);
int host_id, } else {
int64 appcache_id){ NOTREACHED();
if (system_->is_ui_thread()) { }
system_->io_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( }
this, &BrowserBackendProxy::SelectCacheForSharedWorker, host_id, appcache_id));
} else if (system_->is_io_thread()) { virtual void SelectCacheForWorker(
system_->backend_impl_->SelectCacheForSharedWorker(host_id, appcache_id); int host_id,
} else { int parent_process_id,
NOTREACHED(); int parent_host_id) {
} NOTIMPLEMENTED(); // Workers are not supported in test_shell.
} }
virtual void MarkAsForeignEntry(int host_id, const GURL& document_url, virtual void SelectCacheForSharedWorker(
int64 cache_document_was_loaded_from) { int host_id,
if (system_->is_ui_thread()) { int64 appcache_id) {
system_->io_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( NOTIMPLEMENTED(); // Workers are not supported in test_shell.
this, &BrowserBackendProxy::MarkAsForeignEntry, host_id, document_url, }
cache_document_was_loaded_from));
} else if (system_->is_io_thread()) { virtual void MarkAsForeignEntry(int host_id, const GURL& document_url,
system_->backend_impl_->MarkAsForeignEntry( int64 cache_document_was_loaded_from) {
host_id, document_url, if (system_->is_ui_thread()) {
cache_document_was_loaded_from); system_->io_message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
} else { this, &BrowserBackendProxy::MarkAsForeignEntry, host_id, document_url,
NOTREACHED(); cache_document_was_loaded_from));
} } else if (system_->is_io_thread()) {
} system_->backend_impl_->MarkAsForeignEntry(
host_id, document_url,
virtual appcache::Status GetStatus(int host_id) { cache_document_was_loaded_from);
if (system_->is_ui_thread()) { } else {
status_result_ = appcache::UNCACHED; NOTREACHED();
event_.Reset(); }
system_->io_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( }
this, &BrowserBackendProxy::GetStatus, host_id));
event_.Wait(); virtual appcache::Status GetStatus(int host_id) {
} else if (system_->is_io_thread()) { if (system_->is_ui_thread()) {
system_->backend_impl_->GetStatusWithCallback( status_result_ = appcache::UNCACHED;
host_id, get_status_callback_.get(), NULL); event_.Reset();
} else { system_->io_message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
NOTREACHED(); this, &BrowserBackendProxy::GetStatus, host_id));
} event_.Wait();
return status_result_; } else if (system_->is_io_thread()) {
} system_->backend_impl_->GetStatusWithCallback(
host_id, get_status_callback_.get(), NULL);
virtual bool StartUpdate(int host_id) { } else {
if (system_->is_ui_thread()) { NOTREACHED();
bool_result_ = false; }
event_.Reset(); return status_result_;
system_->io_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( }
this, &BrowserBackendProxy::StartUpdate, host_id));
event_.Wait(); virtual bool StartUpdate(int host_id) {
} else if (system_->is_io_thread()) { if (system_->is_ui_thread()) {
system_->backend_impl_->StartUpdateWithCallback( bool_result_ = false;
host_id, start_update_callback_.get(), NULL); event_.Reset();
} else { system_->io_message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
NOTREACHED(); this, &BrowserBackendProxy::StartUpdate, host_id));
} event_.Wait();
return bool_result_; } else if (system_->is_io_thread()) {
} system_->backend_impl_->StartUpdateWithCallback(
host_id, start_update_callback_.get(), NULL);
virtual bool SwapCache(int host_id) { } else {
if (system_->is_ui_thread()) { NOTREACHED();
bool_result_ = false; }
event_.Reset(); return bool_result_;
system_->io_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( }
this, &BrowserBackendProxy::SwapCache, host_id));
event_.Wait(); virtual bool SwapCache(int host_id) {
} else if (system_->is_io_thread()) { if (system_->is_ui_thread()) {
system_->backend_impl_->SwapCacheWithCallback( bool_result_ = false;
host_id, swap_cache_callback_.get(), NULL); event_.Reset();
} else { system_->io_message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
NOTREACHED(); this, &BrowserBackendProxy::SwapCache, host_id));
} event_.Wait();
return bool_result_; } else if (system_->is_io_thread()) {
} system_->backend_impl_->SwapCacheWithCallback(
host_id, swap_cache_callback_.get(), NULL);
void GetStatusCallback(appcache::Status status, void* param) { } else {
status_result_ = status; NOTREACHED();
event_.Signal(); }
} return bool_result_;
}
void StartUpdateCallback(bool result, void* param) {
bool_result_ = result; void GetStatusCallback(appcache::Status status, void* param) {
event_.Signal(); status_result_ = status;
} event_.Signal();
}
void SwapCacheCallback(bool result, void* param) {
bool_result_ = result; void StartUpdateCallback(bool result, void* param) {
event_.Signal(); bool_result_ = result;
} event_.Signal();
}
void SignalEvent() {
event_.Signal(); void SwapCacheCallback(bool result, void* param) {
} bool_result_ = result;
event_.Signal();
private: }
friend class base::RefCountedThreadSafe<BrowserBackendProxy>;
void SignalEvent() {
~BrowserBackendProxy() {} event_.Signal();
}
BrowserAppCacheSystem* system_;
base::WaitableEvent event_; private:
bool bool_result_; friend class base::RefCountedThreadSafe<BrowserBackendProxy>;
appcache::Status status_result_;
scoped_ptr<appcache::GetStatusCallback> get_status_callback_; ~BrowserBackendProxy() {}
scoped_ptr<appcache::StartUpdateCallback> start_update_callback_;
scoped_ptr<appcache::SwapCacheCallback> swap_cache_callback_; BrowserAppCacheSystem* system_;
}; base::WaitableEvent event_;
bool bool_result_;
appcache::Status status_result_;
// BrowserAppCacheSystem -------------------------------------------------------- scoped_ptr<appcache::GetStatusCallback> get_status_callback_;
scoped_ptr<appcache::StartUpdateCallback> start_update_callback_;
// This class only works for a single process browser. scoped_ptr<appcache::SwapCacheCallback> swap_cache_callback_;
static const int kSingleProcessId = 1; };
// A not so thread safe singleton, but should work for test_shell.
BrowserAppCacheSystem* BrowserAppCacheSystem::instance_ = NULL; // BrowserAppCacheSystem --------------------------------------------------------
BrowserAppCacheSystem::BrowserAppCacheSystem() // This class only works for a single process browser.
: io_message_loop_(NULL), ui_message_loop_(NULL), static const int kSingleProcessId = 1;
ALLOW_THIS_IN_INITIALIZER_LIST(
backend_proxy_(new BrowserBackendProxy(this))), // A not so thread safe singleton, but should work for test_shell.
ALLOW_THIS_IN_INITIALIZER_LIST( BrowserAppCacheSystem* BrowserAppCacheSystem::instance_ = NULL;
frontend_proxy_(new BrowserFrontendProxy(this))),
backend_impl_(NULL), service_(NULL), db_thread_("AppCacheDBThread"), BrowserAppCacheSystem::BrowserAppCacheSystem()
thread_provider_(NULL) { : io_message_loop_(NULL), ui_message_loop_(NULL),
DCHECK(!instance_); ALLOW_THIS_IN_INITIALIZER_LIST(
instance_ = this; backend_proxy_(new BrowserBackendProxy(this))),
} ALLOW_THIS_IN_INITIALIZER_LIST(
frontend_proxy_(new BrowserFrontendProxy(this))),
static void SignalEvent(base::WaitableEvent* event) { backend_impl_(NULL), service_(NULL), db_thread_("AppCacheDBThread"),
event->Signal(); thread_provider_(NULL) {
} DCHECK(!instance_);
instance_ = this;
BrowserAppCacheSystem::~BrowserAppCacheSystem() { }
DCHECK(!io_message_loop_ && !backend_impl_ && !service_);
frontend_proxy_->clear_appcache_system(); // in case a task is in transit static void SignalEvent(base::WaitableEvent* event) {
instance_ = NULL; event->Signal();
}
if (db_thread_.IsRunning()) {
// We pump a task thru the db thread to ensure any tasks previously BrowserAppCacheSystem::~BrowserAppCacheSystem() {
// scheduled on that thread have been performed prior to return. DCHECK(!io_message_loop_ && !backend_impl_ && !service_);
base::WaitableEvent event(false, false); frontend_proxy_->clear_appcache_system(); // in case a task is in transit
db_thread_.message_loop()->PostTask(FROM_HERE, instance_ = NULL;
NewRunnableFunction(&SignalEvent, &event));
event.Wait(); if (db_thread_.IsRunning()) {
} // We pump a task thru the db thread to ensure any tasks previously
} // scheduled on that thread have been performed prior to return.
base::WaitableEvent event(false, false);
void BrowserAppCacheSystem::InitOnUIThread( db_thread_.message_loop()->PostTask(FROM_HERE,
const FilePath& cache_directory) { NewRunnableFunction(&SignalEvent, &event));
DCHECK(!ui_message_loop_); event.Wait();
AppCacheThread::Init(DB_THREAD_ID, IO_THREAD_ID); }
ui_message_loop_ = MessageLoop::current(); }
cache_directory_ = cache_directory;
} void BrowserAppCacheSystem::InitOnUIThread(const FilePath& cache_directory) {
DCHECK(!ui_message_loop_);
void BrowserAppCacheSystem::InitOnIOThread(URLRequestContext* request_context) { AppCacheThread::Init(DB_THREAD_ID, IO_THREAD_ID);
if (!is_initailized_on_ui_thread()) ui_message_loop_ = MessageLoop::current();
return; cache_directory_ = cache_directory;
}
DCHECK(!io_message_loop_);
io_message_loop_ = MessageLoop::current(); void BrowserAppCacheSystem::InitOnIOThread(URLRequestContext* request_context) {
io_message_loop_->AddDestructionObserver(this); if (!is_initailized_on_ui_thread())
return;
if (!db_thread_.IsRunning())
db_thread_.Start(); DCHECK(!io_message_loop_);
io_message_loop_ = MessageLoop::current();
// Recreate and initialize per each IO thread. io_message_loop_->AddDestructionObserver(this);
service_ = new appcache::AppCacheService();
backend_impl_ = new appcache::AppCacheBackendImpl(); if (!db_thread_.IsRunning())
service_->Initialize(cache_directory_, db_thread_.Start();
BrowserResourceLoaderBridge::GetCacheThread());
service_->set_request_context(request_context); // Recreate and initialize per each IO thread.
backend_impl_->Initialize(service_, frontend_proxy_.get(), kSingleProcessId); service_ = new appcache::AppCacheService();
backend_impl_ = new appcache::AppCacheBackendImpl();
AppCacheInterceptor::EnsureRegistered(); service_->Initialize(cache_directory_,
} BrowserResourceLoaderBridge::GetCacheThread());
service_->set_request_context(request_context);
WebApplicationCacheHost* BrowserAppCacheSystem::CreateCacheHostForWebKit( backend_impl_->Initialize(service_, frontend_proxy_.get(), kSingleProcessId);
WebApplicationCacheHostClient* client) {
if (!is_initailized_on_ui_thread()) AppCacheInterceptor::EnsureRegistered();
return NULL; }
DCHECK(is_ui_thread()); WebApplicationCacheHost* BrowserAppCacheSystem::CreateCacheHostForWebKit(
WebApplicationCacheHostClient* client) {
if (!is_initialized()) if (!is_initailized_on_ui_thread())
return NULL; return NULL;
return new WebApplicationCacheHostImpl(client, backend_proxy_.get());
} DCHECK(is_ui_thread());
void BrowserAppCacheSystem::SetExtraRequestBits( if (!is_initialized())
URLRequest* request, int host_id, ResourceType::Type resource_type) { return NULL;
if (is_initialized()) { return new WebApplicationCacheHostImpl(client, backend_proxy_.get());
DCHECK(is_io_thread()); }
AppCacheInterceptor::SetExtraRequestInfo(
request, service_, kSingleProcessId, host_id, resource_type); void BrowserAppCacheSystem::SetExtraRequestBits(
} URLRequest* request, int host_id, ResourceType::Type resource_type) {
} if (is_initialized()) {
DCHECK(is_io_thread());
void BrowserAppCacheSystem::GetExtraResponseBits( AppCacheInterceptor::SetExtraRequestInfo(
URLRequest* request, int64* cache_id, GURL* manifest_url) { request, service_, kSingleProcessId, host_id, resource_type);
if (is_initialized()) { }
DCHECK(is_io_thread()); }
AppCacheInterceptor::GetExtraResponseInfo(
request, cache_id, manifest_url); void BrowserAppCacheSystem::GetExtraResponseBits(
} URLRequest* request, int64* cache_id, GURL* manifest_url) {
} if (is_initialized()) {
DCHECK(is_io_thread());
void BrowserAppCacheSystem::WillDestroyCurrentMessageLoop() { AppCacheInterceptor::GetExtraResponseInfo(
DCHECK(is_io_thread()); request, cache_id, manifest_url);
}
delete backend_impl_; }
delete service_;
backend_impl_ = NULL; void BrowserAppCacheSystem::WillDestroyCurrentMessageLoop() {
service_ = NULL; DCHECK(is_io_thread());
io_message_loop_ = NULL;
delete backend_impl_;
// Just in case the main thread is waiting on it. delete service_;
backend_proxy_->SignalEvent(); backend_impl_ = NULL;
} service_ = NULL;
io_message_loop_ = NULL;
// Just in case the main thread is waiting on it.
backend_proxy_->SignalEvent();
}

View File

@@ -4,17 +4,12 @@
#include "browser_database_system.h" #include "browser_database_system.h"
#if defined(USE_SYSTEM_SQLITE)
#include <sqlite3.h>
#else
#include "third_party/sqlite/preprocessed/sqlite3.h"
#endif
#include "base/auto_reset.h" #include "base/auto_reset.h"
#include "base/file_util.h" #include "base/file_util.h"
#include "base/message_loop.h" #include "base/message_loop.h"
#include "base/platform_thread.h" #include "base/platform_thread.h"
#include "base/process_util.h" #include "base/process_util.h"
#include "third_party/sqlite/preprocessed/sqlite3.h"
#include "third_party/WebKit/WebKit/chromium/public/WebDatabase.h" #include "third_party/WebKit/WebKit/chromium/public/WebDatabase.h"
#include "third_party/WebKit/WebKit/chromium/public/WebString.h" #include "third_party/WebKit/WebKit/chromium/public/WebString.h"
#include "webkit/database/database_util.h" #include "webkit/database/database_util.h"

View File

@@ -917,10 +917,8 @@ void CefBrowserImpl::UIT_Find(int identifier, const std::wstring& search_text,
// Just navigate back/forward. // Just navigate back/forward.
delegate->SelectFindResult(options.forward); delegate->SelectFindResult(options.forward);
} else { } else {
if (delegate->SupportsFind()) { if (delegate->StartFind(search_text.c_str(), options.matchCase,
delegate->StartFind(UTF16ToUTF8(search_text), identifier)) {
options.matchCase,
identifier);
} else { } else {
// No find results. // No find results.
UIT_NotifyFindStatus(identifier, 0, gfx::Rect(), 0, true); UIT_NotifyFindStatus(identifier, 0, gfx::Rect(), 0, true);

View File

@@ -54,10 +54,6 @@ LRESULT CALLBACK CefBrowserImpl::WndProc(HWND hwnd, UINT message,
} }
browser->GetWebViewDelegate()->RevokeDragDrop(); browser->GetWebViewDelegate()->RevokeDragDrop();
// Call GC twice to clean up garbage.
browser->GetWebView()->mainFrame()->collectGarbage();
browser->GetWebView()->mainFrame()->collectGarbage();
// Clean up anything associated with the WebViewHost widget. // Clean up anything associated with the WebViewHost widget.
browser->GetWebViewHost()->webwidget()->close(); browser->GetWebViewHost()->webwidget()->close();
@@ -129,7 +125,7 @@ void CefBrowserImpl::UIT_CreateBrowser(const std::wstring& url)
// Create the webview host object // Create the webview host object
webviewhost_.reset( webviewhost_.reset(
WebViewHost::Create(window_info_.m_hWnd, delegate_.get(), WebViewHost::Create(window_info_.m_hWnd, delegate_.get(), NULL,
*_Context->web_preferences())); *_Context->web_preferences()));
delegate_->RegisterDragDrop(); delegate_->RegisterDragDrop();

View File

@@ -43,9 +43,11 @@ void BrowserRequestContext::Init(
// Use the system proxy settings. // Use the system proxy settings.
scoped_ptr<net::ProxyConfigService> proxy_config_service( scoped_ptr<net::ProxyConfigService> proxy_config_service(
net::ProxyService::CreateSystemProxyConfigService(NULL, NULL)); net::ProxyService::CreateSystemProxyConfigService(
host_resolver_ = net::CreateSystemHostResolver(NULL); MessageLoop::current(), NULL));
proxy_service_ = net::ProxyService::Create(proxy_config_service.release(), host_resolver_ =
net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism);
proxy_service_ = net::ProxyService::Create(proxy_config_service.release(),
false, NULL, NULL, NULL, NULL); false, NULL, NULL, NULL, NULL);
ssl_config_service_ = net::SSLConfigService::CreateSystemSSLConfigService(); ssl_config_service_ = net::SSLConfigService::CreateSystemSSLConfigService();
@@ -56,9 +58,8 @@ void BrowserRequestContext::Init(
cache_path, 0, BrowserResourceLoaderBridge::GetCacheThread()); cache_path, 0, BrowserResourceLoaderBridge::GetCacheThread());
net::HttpCache* cache = net::HttpCache* cache =
new net::HttpCache(NULL, host_resolver_, proxy_service_, new net::HttpCache(host_resolver_, proxy_service_, ssl_config_service_,
ssl_config_service_, http_auth_handler_factory_, http_auth_handler_factory_, NULL, NULL, backend);
NULL, NULL, backend);
cache->set_mode(cache_mode); cache->set_mode(cache_mode);
http_transaction_factory_ = cache; http_transaction_factory_ = cache;

View File

@@ -73,8 +73,8 @@ bool IsProtocolSupportedForMedia(const GURL& url) {
return false; return false;
} }
std::wstring GetWebKitLocale() { std::string GetWebKitLocale() {
return L"en-US"; return "en-US";
} }
void InitializeTextEncoding() { void InitializeTextEncoding() {
@@ -111,5 +111,20 @@ std::string GetProductVersion() {
return std::string("CEF/0.0.0.0"); return std::string("CEF/0.0.0.0");
} }
bool IsSingleProcess() {
return true;
}
#if defined(OS_LINUX)
int MatchFontWithFallback(const std::string& face, bool bold,
bool italic, int charset) {
return -1;
}
bool GetFontTable(int fd, uint32_t table, uint8_t* output,
size_t* output_length) {
return false;
}
#endif
} // namespace webkit_glue } // namespace webkit_glue

View File

@@ -87,7 +87,7 @@ void CaptureWebViewBitmap(HWND mainWnd, WebView* webview, HBITMAP& bitmap,
skia::PlatformCanvas canvas(size.cx, size.cy, true); skia::PlatformCanvas canvas(size.cx, size.cy, true);
canvas.drawARGB(255, 255, 255, 255, SkXfermode::kSrc_Mode); canvas.drawARGB(255, 255, 255, 255, SkXfermode::kSrc_Mode);
PlatformContextSkia context(&canvas); WebCore::PlatformContextSkia context(&canvas);
WebKit::WebRect rect(0, 0, size.cx, size.cy); WebKit::WebRect rect(0, 0, size.cx, size.cy);
webview->layout(); webview->layout();
webview->paint(&canvas, rect); webview->paint(&canvas, rect);

View File

@@ -24,7 +24,7 @@
#include "third_party/WebKit/WebKit/chromium/public/WebSecurityPolicy.h" #include "third_party/WebKit/WebKit/chromium/public/WebSecurityPolicy.h"
#include "third_party/WebKit/WebKit/chromium/public/WebStorageArea.h" #include "third_party/WebKit/WebKit/chromium/public/WebStorageArea.h"
#include "third_party/WebKit/WebKit/chromium/public/WebStorageEventDispatcher.h" #include "third_party/WebKit/WebKit/chromium/public/WebStorageEventDispatcher.h"
#include "third_party/WebKit/WebKit/chromium/public/WebIndexedDatabase.h" #include "third_party/WebKit/WebKit/chromium/public/WebIDBFactory.h"
#include "third_party/WebKit/WebKit/chromium/public/WebStorageNamespace.h" #include "third_party/WebKit/WebKit/chromium/public/WebStorageNamespace.h"
#include "third_party/WebKit/WebKit/chromium/public/WebString.h" #include "third_party/WebKit/WebKit/chromium/public/WebString.h"
#include "webkit/glue/simple_webmimeregistry_impl.h" #include "webkit/glue/simple_webmimeregistry_impl.h"
@@ -58,6 +58,11 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
WebKit::WebRuntimeFeatures::enableTouch(true); WebKit::WebRuntimeFeatures::enableTouch(true);
WebKit::WebRuntimeFeatures::enableIndexedDatabase(true); WebKit::WebRuntimeFeatures::enableIndexedDatabase(true);
WebKit::WebRuntimeFeatures::enableGeolocation(false); WebKit::WebRuntimeFeatures::enableGeolocation(false);
WebKit::WebRuntimeFeatures::enableSpeechInput(true);
// TODO(hwennborg): Enable this once the implementation supports it.
WebKit::WebRuntimeFeatures::enableDeviceMotion(false);
WebKit::WebRuntimeFeatures::enableDeviceOrientation(false);
// Load libraries for media and enable the media player. // Load libraries for media and enable the media player.
FilePath module_path; FilePath module_path;
@@ -178,8 +183,8 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
WebKit::WebStorageNamespace::m_localStorageQuota); WebKit::WebStorageNamespace::m_localStorageQuota);
} }
virtual WebKit::WebIndexedDatabase* indexedDatabase() { virtual WebKit::WebIDBFactory* idbFactory() {
return WebKit::WebIndexedDatabase::create(); return WebKit::WebIDBFactory::create();
} }
private: private:

View File

@@ -16,13 +16,14 @@
#include "v8_impl.h" #include "v8_impl.h"
#include "base/file_util.h" #include "base/file_util.h"
#include "gfx/point.h"
#include "base/message_loop.h" #include "base/message_loop.h"
#include "base/process_util.h" #include "base/process_util.h"
#include "base/string_util.h"
#include "base/trace_event.h" #include "base/trace_event.h"
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
#include "gfx/gdi_util.h" #include "gfx/gdi_util.h"
#include "gfx/native_widget_types.h" #include "gfx/native_widget_types.h"
#include "gfx/point.h"
#include "net/base/net_errors.h" #include "net/base/net_errors.h"
#include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h"
#include "third_party/WebKit/WebKit/chromium/public/WebContextMenuData.h" #include "third_party/WebKit/WebKit/chromium/public/WebContextMenuData.h"
@@ -663,8 +664,8 @@ void BrowserWebViewDelegate::didFailProvisionalLoad(
if(rv == RV_HANDLED && !error_str.empty()) if(rv == RV_HANDLED && !error_str.empty())
error_text = WideToUTF8(error_str); error_text = WideToUTF8(error_str);
} else { } else {
error_text = StringPrintf("Error %d when loading url %s", error.reason, error_text = StringPrintf("Error %d when loading url %s",
failed_ds->request().url().spec().data()); error.reason, failed_ds->request().url().spec().data());
} }
// Make sure we never show errors in view source mode. // Make sure we never show errors in view source mode.

View File

@@ -15,6 +15,7 @@
#include "base/i18n/icu_util.h" #include "base/i18n/icu_util.h"
#include "base/rand_util.h" #include "base/rand_util.h"
#include "base/stats_table.h" #include "base/stats_table.h"
#include "base/string_number_conversions.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "net/base/net_module.h" #include "net/base/net_module.h"
#if defined(OS_WIN) #if defined(OS_WIN)
@@ -108,13 +109,13 @@ void CefProcessUIThread::Init() {
// Load and initialize the stats table. Attempt to construct a somewhat // Load and initialize the stats table. Attempt to construct a somewhat
// unique name to isolate separate instances from each other. // unique name to isolate separate instances from each other.
statstable_ = new StatsTable( statstable_ = new StatsTable(
kStatsFilePrefix + Uint64ToString(base::RandUint64()), kStatsFilePrefix + base::Uint64ToString(base::RandUint64()),
kStatsFileThreads, kStatsFileThreads,
kStatsFileCounters); kStatsFileCounters);
StatsTable::set_current(statstable_); StatsTable::set_current(statstable_);
// CEF always exposes the GC. // CEF always exposes the GC.
webkit_glue::SetJavaScriptFlags(L"--expose-gc"); webkit_glue::SetJavaScriptFlags("--expose-gc");
// Expose GCController to JavaScript. // Expose GCController to JavaScript.
WebKit::WebScriptController::registerExtension( WebKit::WebScriptController::registerExtension(
extensions_v8::GCExtension::Get()); extensions_v8::GCExtension::Get());

View File

@@ -1,54 +1,71 @@
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. // Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "webkit/glue/webkit_glue.h" #include "webkit/glue/webkit_glue.h"
#include <string> #include <string>
#include "app/clipboard/clipboard.h" #include "app/clipboard/clipboard.h"
#include "base/lazy_instance.h" #include "base/lazy_instance.h"
#include "base/string16.h" #include "base/string16.h"
#include "googleurl/src/gurl.h" #include "googleurl/src/gurl.h"
#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkBitmap.h"
#include "webkit/glue/scoped_clipboard_writer_glue.h" #include "webkit/glue/scoped_clipboard_writer_glue.h"
// Clipboard glue // Clipboard glue
void ScopedClipboardWriterGlue::WriteBitmapFromPixels( void ScopedClipboardWriterGlue::WriteBitmapFromPixels(
const void* pixels, const gfx::Size& size) { const void* pixels, const gfx::Size& size) {
ScopedClipboardWriter::WriteBitmapFromPixels(pixels, size); ScopedClipboardWriter::WriteBitmapFromPixels(pixels, size);
} }
ScopedClipboardWriterGlue::~ScopedClipboardWriterGlue() { ScopedClipboardWriterGlue::~ScopedClipboardWriterGlue() {
} }
namespace webkit_glue { namespace webkit_glue {
base::LazyInstance<Clipboard> clipboard(base::LINKER_INITIALIZED); base::LazyInstance<Clipboard> clipboard(base::LINKER_INITIALIZED);
Clipboard* ClipboardGetClipboard() { Clipboard* ClipboardGetClipboard() {
return clipboard.Pointer(); return clipboard.Pointer();
} }
bool ClipboardIsFormatAvailable(const Clipboard::FormatType& format, bool ClipboardIsFormatAvailable(const Clipboard::FormatType& format,
Clipboard::Buffer buffer) { Clipboard::Buffer buffer) {
return ClipboardGetClipboard()->IsFormatAvailable(format, buffer); return ClipboardGetClipboard()->IsFormatAvailable(format, buffer);
} }
void ClipboardReadText(Clipboard::Buffer buffer, string16* result) { void ClipboardReadText(Clipboard::Buffer buffer, string16* result) {
ClipboardGetClipboard()->ReadText(buffer, result); ClipboardGetClipboard()->ReadText(buffer, result);
} }
void ClipboardReadAsciiText(Clipboard::Buffer buffer, std::string* result) { void ClipboardReadAsciiText(Clipboard::Buffer buffer, std::string* result) {
ClipboardGetClipboard()->ReadAsciiText(buffer, result); ClipboardGetClipboard()->ReadAsciiText(buffer, result);
} }
void ClipboardReadHTML(Clipboard::Buffer buffer, string16* markup, GURL* url) { void ClipboardReadHTML(Clipboard::Buffer buffer, string16* markup, GURL* url) {
std::string url_str; std::string url_str;
ClipboardGetClipboard()->ReadHTML(buffer, markup, url ? &url_str : NULL); ClipboardGetClipboard()->ReadHTML(buffer, markup, url ? &url_str : NULL);
if (url) if (url)
*url = GURL(url_str); *url = GURL(url_str);
} }
} // namespace webkit_glue // TODO(dcheng): Implement.
bool ClipboardReadAvailableTypes(Clipboard::Buffer buffer,
std::vector<string16>* types,
bool* contains_filenames) {
return false;
}
bool ClipboardReadData(Clipboard::Buffer buffer, const string16& type,
string16* data, string16* metadata) {
return false;
}
bool ClipboardReadFilenames(Clipboard::Buffer buffer,
std::vector<string16>* filenames) {
return false;
}
} // namespace webkit_glue

View File

@@ -18,6 +18,7 @@ static const wchar_t kWindowClassName[] = L"WebViewHost";
/*static*/ /*static*/
WebViewHost* WebViewHost::Create(HWND parent_view, WebViewHost* WebViewHost::Create(HWND parent_view,
BrowserWebViewDelegate* delegate, BrowserWebViewDelegate* delegate,
WebDevToolsAgentClient* dev_tools_client,
const WebPreferences& prefs) { const WebPreferences& prefs) {
WebViewHost* host = new WebViewHost(); WebViewHost* host = new WebViewHost();
@@ -40,7 +41,7 @@ WebViewHost* WebViewHost::Create(HWND parent_view,
GetModuleHandle(NULL), NULL); GetModuleHandle(NULL), NULL);
win_util::SetWindowUserData(host->view_, host); win_util::SetWindowUserData(host->view_, host);
host->webwidget_ = WebView::create(delegate); host->webwidget_ = WebView::create(delegate, dev_tools_client);
prefs.Apply(host->webview()); prefs.Apply(host->webview());
host->webview()->initializeMainFrame(delegate); host->webview()->initializeMainFrame(delegate);

View File

@@ -14,6 +14,7 @@ struct WebPreferences;
class BrowserWebViewDelegate; class BrowserWebViewDelegate;
namespace WebKit { namespace WebKit {
class WebDevToolsAgentClient;
class WebView; class WebView;
} }
@@ -25,6 +26,7 @@ class WebViewHost : public WebWidgetHost {
// MoveWindow (or equivalent) function. // MoveWindow (or equivalent) function.
static WebViewHost* Create(gfx::NativeView parent_window, static WebViewHost* Create(gfx::NativeView parent_window,
BrowserWebViewDelegate* delegate, BrowserWebViewDelegate* delegate,
WebKit::WebDevToolsAgentClient* devtools_client,
const WebPreferences& prefs); const WebPreferences& prefs);
WebKit::WebView* webview() const; WebKit::WebView* webview() const;

View File

@@ -1,8 +1,8 @@
Index: common.gypi Index: common.gypi
=================================================================== ===================================================================
--- common.gypi (revision 50325) --- common.gypi (revision 55388)
+++ common.gypi (working copy) +++ common.gypi (working copy)
@@ -18,6 +18,9 @@ @@ -23,6 +23,9 @@
# Variables expected to be overriden on the GYP command line (-D) or by # Variables expected to be overriden on the GYP command line (-D) or by
# ~/.gyp/include.gypi. # ~/.gyp/include.gypi.
@@ -14,7 +14,7 @@ Index: common.gypi
# variables within the outer variables dict here. This is necessary # variables within the outer variables dict here. This is necessary
Index: win/system.gyp Index: win/system.gyp
=================================================================== ===================================================================
--- win/system.gyp (revision 50325) --- win/system.gyp (revision 55388)
+++ win/system.gyp (working copy) +++ win/system.gyp (working copy)
@@ -22,6 +22,13 @@ @@ -22,6 +22,13 @@
'action': ['', '<@(_inputs)'], 'action': ['', '<@(_inputs)'],