From 71a6f6548bf6e4cfc92b3d8ab0791b7eb5724504 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Tue, 5 Apr 2011 16:17:33 +0000 Subject: [PATCH] Update to Chromium revision 80310. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@213 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- CHROMIUM_BUILD_COMPATIBILITY.txt | 1 + cef.gyp | 10 +- libcef/browser_appcache_system.cc | 12 + libcef/browser_database_system.cc | 273 +++++++++++++--------- libcef/browser_database_system.h | 79 ++++--- libcef/browser_devtools_agent.cc | 6 - libcef/browser_devtools_agent.h | 1 - libcef/browser_drag_delegate_win.cc | 2 +- libcef/browser_drag_delegate_win.h | 4 +- libcef/browser_file_system.cc | 18 +- libcef/browser_file_system.h | 10 +- libcef/browser_file_writer.cc | 34 ++- libcef/browser_file_writer.h | 18 +- libcef/browser_impl.h | 2 +- libcef/browser_impl_win.cc | 8 +- libcef/browser_navigation_controller.h | 4 +- libcef/browser_persistent_cookie_store.cc | 3 + libcef/browser_persistent_cookie_store.h | 2 +- libcef/browser_request_context.cc | 60 ++--- libcef/browser_request_context.h | 10 + libcef/browser_resource_loader_bridge.cc | 26 +-- libcef/browser_socket_stream_bridge.cc | 2 +- libcef/browser_web_worker.h | 2 +- libcef/browser_webblobregistry_impl.h | 2 +- libcef/browser_webkit_init.h | 14 +- libcef/browser_webview_delegate.h | 2 +- libcef/browser_webview_mac.mm | 2 +- libcef/browser_zoom_map.h | 2 +- libcef/cef_context.h | 2 +- libcef/cef_process.h | 4 +- libcef/cef_process_ui_thread.cc | 47 ++-- libcef/dom_node_impl.cc | 2 +- libcef/dom_storage_area.h | 4 +- libcef/drag_download_file.h | 2 +- libcef/scheme_impl.cc | 8 - libcef/simple_clipboard_impl.cc | 8 +- libcef/web_drop_target_win.cc | 3 +- libcef/web_urlrequest_impl.cc | 27 ++- libcef/web_urlrequest_impl.h | 2 +- libcef/webview_host_gtk.cc | 5 +- libcef/webview_host_mac.mm | 5 +- libcef/webview_host_win.cc | 5 +- patch/patches/base.patch | 14 +- 43 files changed, 456 insertions(+), 291 deletions(-) diff --git a/CHROMIUM_BUILD_COMPATIBILITY.txt b/CHROMIUM_BUILD_COMPATIBILITY.txt index 75cf43317..eeeb2548c 100644 --- a/CHROMIUM_BUILD_COMPATIBILITY.txt +++ b/CHROMIUM_BUILD_COMPATIBILITY.txt @@ -63,3 +63,4 @@ Date | CEF Revision | Chromium Revision 2011-01-07 | /trunk@159 | /trunk@70742 2011-01-11 | /trunk@162 | /trunk@71081 2011-02-15 | /trunk@186 | /trunk@74933 +2011-04-05 | /trunk@213 | /trunk@80310 diff --git a/cef.gyp b/cef.gyp index 47bc24ce1..b3401374f 100644 --- a/cef.gyp +++ b/cef.gyp @@ -267,14 +267,15 @@ '../third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:inspector_resources', '../third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:webkit', '../third_party/zlib/zlib.gyp:zlib', - '../ui/gfx/gfx.gyp:gfx', - '../ui/gfx/gfx.gyp:gfx_resources', + '../ui/ui.gyp:gfx_resources', '../ui/ui.gyp:ui_base', + '../ui/ui.gyp:ui_gfx', '../webkit/support/webkit_support.gyp:appcache', '../webkit/support/webkit_support.gyp:blob', '../webkit/support/webkit_support.gyp:database', '../webkit/support/webkit_support.gyp:fileapi', '../webkit/support/webkit_support.gyp:glue', + '../webkit/support/webkit_support.gyp:quota', '../webkit/support/webkit_support.gyp:webkit_gpu', '../webkit/support/webkit_support.gyp:webkit_resources', '../webkit/support/webkit_support.gyp:webkit_strings', @@ -511,14 +512,15 @@ '../third_party/WebKit/Source/WebCore/WebCore.gyp/WebCore.gyp:webcore', '../third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:webkit', '../third_party/zlib/zlib.gyp:zlib', - '../ui/gfx/gfx.gyp:gfx', - '../ui/gfx/gfx.gyp:gfx_resources', + '../ui/ui.gyp:gfx_resources', '../ui/ui.gyp:ui_base', + '../ui/ui.gyp:ui_gfx', '../webkit/support/webkit_support.gyp:appcache', '../webkit/support/webkit_support.gyp:blob', '../webkit/support/webkit_support.gyp:database', '../webkit/support/webkit_support.gyp:fileapi', '../webkit/support/webkit_support.gyp:glue', + '../webkit/support/webkit_support.gyp:quota', '../webkit/support/webkit_support.gyp:webkit_gpu', '../webkit/support/webkit_support.gyp:webkit_resources', '../webkit/support/webkit_support.gyp:webkit_strings', diff --git a/libcef/browser_appcache_system.cc b/libcef/browser_appcache_system.cc index 1f0954192..73a3a626a 100644 --- a/libcef/browser_appcache_system.cc +++ b/libcef/browser_appcache_system.cc @@ -197,6 +197,18 @@ class BrowserBackendProxy } } + virtual void SetSpawningHostId(int host_id, int spawning_host_id) { + if (system_->is_ui_thread()) { + system_->io_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( + this, &BrowserBackendProxy::SetSpawningHostId, + host_id, spawning_host_id)); + } else if (system_->is_io_thread()) { + system_->backend_impl_->SetSpawningHostId(host_id, spawning_host_id); + } else { + NOTREACHED(); + } + } + virtual void SelectCache(int host_id, const GURL& document_url, const int64 cache_document_was_loaded_from, diff --git a/libcef/browser_database_system.cc b/libcef/browser_database_system.cc index c875b6a85..e95f633ff 100644 --- a/libcef/browser_database_system.cc +++ b/libcef/browser_database_system.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,6 +7,8 @@ #include "base/auto_reset.h" #include "base/file_util.h" #include "base/message_loop.h" +#include "base/message_loop_proxy.h" +#include "base/synchronization/waitable_event.h" #include "base/threading/platform_thread.h" #include "base/utf_string_conversions.h" #include "third_party/sqlite/sqlite3.h" @@ -27,91 +29,138 @@ BrowserDatabaseSystem* BrowserDatabaseSystem::GetInstance() { } BrowserDatabaseSystem::BrowserDatabaseSystem() - : waiting_for_dbs_to_close_(false) { - CHECK(temp_dir_.CreateUniqueTempDir()); - db_tracker_ = new DatabaseTracker(temp_dir_.path(), false); - db_tracker_->AddObserver(this); + : db_thread_("SimpleDBThread"), + open_connections_(new webkit_database::DatabaseConnectionsWrapper) { DCHECK(!instance_); instance_ = this; + CHECK(temp_dir_.CreateUniqueTempDir()); + db_tracker_ = new DatabaseTracker(temp_dir_.path(), false, NULL); + db_tracker_->AddObserver(this); + db_thread_.Start(); + db_thread_proxy_ = db_thread_.message_loop_proxy(); } BrowserDatabaseSystem::~BrowserDatabaseSystem() { - db_tracker_->RemoveObserver(this); + base::WaitableEvent done_event(false, false); + db_thread_proxy_->PostTask(FROM_HERE, + NewRunnableMethod(this, &BrowserDatabaseSystem::ThreadCleanup, + &done_event)); + done_event.Wait(); instance_ = NULL; } +void BrowserDatabaseSystem::databaseOpened(const WebKit::WebDatabase& database) { + string16 origin_identifier = database.securityOrigin().databaseIdentifier(); + string16 database_name = database.name(); + open_connections_->AddOpenConnection(origin_identifier, database_name); + db_thread_proxy_->PostTask(FROM_HERE, + NewRunnableMethod(this, &BrowserDatabaseSystem::DatabaseOpened, + origin_identifier, + database_name, database.displayName(), + database.estimatedSize())); +} + +void BrowserDatabaseSystem::databaseModified( + const WebKit::WebDatabase& database) { + db_thread_proxy_->PostTask(FROM_HERE, + NewRunnableMethod(this, &BrowserDatabaseSystem::DatabaseModified, + database.securityOrigin().databaseIdentifier(), + database.name())); +} + +void BrowserDatabaseSystem::databaseClosed(const WebKit::WebDatabase& database) { + string16 origin_identifier = database.securityOrigin().databaseIdentifier(); + string16 database_name = database.name(); + db_thread_proxy_->PostTask(FROM_HERE, + NewRunnableMethod(this, &BrowserDatabaseSystem::DatabaseClosed, + origin_identifier, database_name)); +} + base::PlatformFile BrowserDatabaseSystem::OpenFile( const string16& vfs_file_name, int desired_flags) { - base::PlatformFile file_handle = base::kInvalidPlatformFileValue; - FilePath file_name = GetFullFilePathForVfsFile(vfs_file_name); - if (file_name.empty()) { - VfsBackend::OpenTempFileInDirectory( - db_tracker_->DatabaseDirectory(), desired_flags, &file_handle); - } else { - VfsBackend::OpenFile(file_name, desired_flags, &file_handle); - } - - return file_handle; + base::PlatformFile result = base::kInvalidPlatformFileValue; + base::WaitableEvent done_event(false, false); + db_thread_proxy_->PostTask(FROM_HERE, + NewRunnableMethod(this, &BrowserDatabaseSystem::VfsOpenFile, + vfs_file_name, desired_flags, + &result, &done_event)); + done_event.Wait(); + return result; } int BrowserDatabaseSystem::DeleteFile( const string16& vfs_file_name, bool sync_dir) { - // We try to delete the file multiple times, because that's what the default - // VFS does (apparently deleting a file can sometimes fail on Windows). - // We sleep for 10ms between retries for the same reason. - const int kNumDeleteRetries = 3; - int num_retries = 0; - int error_code = SQLITE_OK; - FilePath file_name = GetFullFilePathForVfsFile(vfs_file_name); - do { - error_code = VfsBackend::DeleteFile(file_name, sync_dir); - } while ((++num_retries < kNumDeleteRetries) && - (error_code == SQLITE_IOERR_DELETE) && - (base::PlatformThread::Sleep(10), 1)); - - return error_code; + int result = SQLITE_OK; + base::WaitableEvent done_event(false, false); + db_thread_proxy_->PostTask(FROM_HERE, + NewRunnableMethod(this, &BrowserDatabaseSystem::VfsDeleteFile, + vfs_file_name, sync_dir, + &result, &done_event)); + done_event.Wait(); + return result; } -long BrowserDatabaseSystem::GetFileAttributes(const string16& vfs_file_name) { - return VfsBackend::GetFileAttributes( - GetFullFilePathForVfsFile(vfs_file_name)); +uint32 BrowserDatabaseSystem::GetFileAttributes(const string16& vfs_file_name) { + uint32 result = 0; + base::WaitableEvent done_event(false, false); + db_thread_proxy_->PostTask(FROM_HERE, + NewRunnableMethod(this, &BrowserDatabaseSystem::VfsGetFileAttributes, + vfs_file_name, &result, &done_event)); + done_event.Wait(); + return result; } -long long BrowserDatabaseSystem::GetFileSize(const string16& vfs_file_name) { - return VfsBackend::GetFileSize(GetFullFilePathForVfsFile(vfs_file_name)); +int64 BrowserDatabaseSystem::GetFileSize(const string16& vfs_file_name) { + int64 result = 0; + base::WaitableEvent done_event(false, false); + db_thread_proxy_->PostTask(FROM_HERE, + NewRunnableMethod(this, &BrowserDatabaseSystem::VfsGetFileSize, + vfs_file_name, &result, &done_event)); + done_event.Wait(); + return result; +} + +void BrowserDatabaseSystem::ClearAllDatabases() { + open_connections_->WaitForAllDatabasesToClose(); + db_thread_proxy_->PostTask(FROM_HERE, + NewRunnableMethod(this, &BrowserDatabaseSystem::ResetTracker)); +} + +void BrowserDatabaseSystem::SetDatabaseQuota(int64 quota) { + if (!db_thread_proxy_->BelongsToCurrentThread()) { + db_thread_proxy_->PostTask(FROM_HERE, + NewRunnableMethod(this, &BrowserDatabaseSystem::SetDatabaseQuota, + quota)); + return; + } + db_tracker_->SetDefaultQuota(quota); } void BrowserDatabaseSystem::DatabaseOpened(const string16& origin_identifier, const string16& database_name, const string16& description, int64 estimated_size) { + DCHECK(db_thread_proxy_->BelongsToCurrentThread()); int64 database_size = 0; int64 space_available = 0; - database_connections_.AddConnection(origin_identifier, database_name); - db_tracker_->DatabaseOpened(origin_identifier, database_name, description, - estimated_size, &database_size, &space_available); - SetFullFilePathsForVfsFile(origin_identifier, database_name); - + db_tracker_->DatabaseOpened( + origin_identifier, database_name, description, + estimated_size, &database_size, &space_available); OnDatabaseSizeChanged(origin_identifier, database_name, database_size, space_available); } void BrowserDatabaseSystem::DatabaseModified(const string16& origin_identifier, const string16& database_name) { - DCHECK(database_connections_.IsDatabaseOpened( - origin_identifier, database_name)); + DCHECK(db_thread_proxy_->BelongsToCurrentThread()); db_tracker_->DatabaseModified(origin_identifier, database_name); } void BrowserDatabaseSystem::DatabaseClosed(const string16& origin_identifier, const string16& database_name) { - DCHECK(database_connections_.IsDatabaseOpened( - origin_identifier, database_name)); + DCHECK(db_thread_proxy_->BelongsToCurrentThread()); db_tracker_->DatabaseClosed(origin_identifier, database_name); - database_connections_.RemoveConnection(origin_identifier, database_name); - - if (waiting_for_dbs_to_close_ && database_connections_.IsEmpty()) - MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); + open_connections_->RemoveOpenConnection(origin_identifier, database_name); } void BrowserDatabaseSystem::OnDatabaseSizeChanged( @@ -119,83 +168,95 @@ void BrowserDatabaseSystem::OnDatabaseSizeChanged( const string16& database_name, int64 database_size, int64 space_available) { - if (database_connections_.IsOriginUsed(origin_identifier)) { - WebKit::WebDatabase::updateDatabaseSize( - origin_identifier, database_name, database_size, space_available); - } + DCHECK(db_thread_proxy_->BelongsToCurrentThread()); + // We intentionally call into webkit on our background db_thread_ + // to better emulate what happens in chrome where this method is + // invoked on the background ipc thread. + WebKit::WebDatabase::updateDatabaseSize( + origin_identifier, database_name, database_size, space_available); } void BrowserDatabaseSystem::OnDatabaseScheduledForDeletion( const string16& origin_identifier, const string16& database_name) { + DCHECK(db_thread_proxy_->BelongsToCurrentThread()); + // We intentionally call into webkit on our background db_thread_ + // to better emulate what happens in chrome where this method is + // invoked on the background ipc thread. WebKit::WebDatabase::closeDatabaseImmediately( origin_identifier, database_name); } -void BrowserDatabaseSystem::databaseOpened(const WebKit::WebDatabase& database) { - DatabaseOpened(database.securityOrigin().databaseIdentifier(), - database.name(), database.displayName(), - database.estimatedSize()); -} - -void BrowserDatabaseSystem::databaseModified( - const WebKit::WebDatabase& database) { - DatabaseModified(database.securityOrigin().databaseIdentifier(), - database.name()); -} - -void BrowserDatabaseSystem::databaseClosed(const WebKit::WebDatabase& database) { - DatabaseClosed(database.securityOrigin().databaseIdentifier(), - database.name()); -} - -void BrowserDatabaseSystem::ClearAllDatabases() { - // Wait for all databases to be closed. - if (!database_connections_.IsEmpty()) { - AutoReset waiting_for_dbs_auto_reset( - &waiting_for_dbs_to_close_, true); - MessageLoop::ScopedNestableTaskAllower nestable(MessageLoop::current()); - MessageLoop::current()->Run(); +void BrowserDatabaseSystem::VfsOpenFile( + const string16& vfs_file_name, int desired_flags, + base::PlatformFile* file_handle, base::WaitableEvent* done_event ) { + DCHECK(db_thread_proxy_->BelongsToCurrentThread()); + FilePath file_name = GetFullFilePathForVfsFile(vfs_file_name); + if (file_name.empty()) { + VfsBackend::OpenTempFileInDirectory( + db_tracker_->DatabaseDirectory(), desired_flags, file_handle); + } else { + VfsBackend::OpenFile(file_name, desired_flags, file_handle); } - - db_tracker_->CloseTrackerDatabaseAndClearCaches(); - file_util::Delete(db_tracker_->DatabaseDirectory(), true); - file_names_.clear(); + done_event->Signal(); } -void BrowserDatabaseSystem::SetDatabaseQuota(int64 quota) { - db_tracker_->SetDefaultQuota(quota); +void BrowserDatabaseSystem::VfsDeleteFile( + const string16& vfs_file_name, bool sync_dir, + int* result, base::WaitableEvent* done_event) { + DCHECK(db_thread_proxy_->BelongsToCurrentThread()); + // We try to delete the file multiple times, because that's what the default + // VFS does (apparently deleting a file can sometimes fail on Windows). + // We sleep for 10ms between retries for the same reason. + const int kNumDeleteRetries = 3; + int num_retries = 0; + *result = SQLITE_OK; + FilePath file_name = GetFullFilePathForVfsFile(vfs_file_name); + do { + *result = VfsBackend::DeleteFile(file_name, sync_dir); + } while ((++num_retries < kNumDeleteRetries) && + (*result == SQLITE_IOERR_DELETE) && + (base::PlatformThread::Sleep(10), 1)); + + done_event->Signal(); } -void BrowserDatabaseSystem::SetFullFilePathsForVfsFile( - const string16& origin_identifier, - const string16& database_name) { - string16 vfs_file_name = origin_identifier + ASCIIToUTF16("/") + - database_name + ASCIIToUTF16("#"); - FilePath file_name = - DatabaseUtil::GetFullFilePathForVfsFile(db_tracker_, vfs_file_name); +void BrowserDatabaseSystem::VfsGetFileAttributes( + const string16& vfs_file_name, + uint32* result, base::WaitableEvent* done_event) { + DCHECK(db_thread_proxy_->BelongsToCurrentThread()); + *result = VfsBackend::GetFileAttributes( + GetFullFilePathForVfsFile(vfs_file_name)); + done_event->Signal(); +} - base::AutoLock file_names_auto_lock(file_names_lock_); - file_names_[vfs_file_name] = file_name; - file_names_[vfs_file_name + ASCIIToUTF16("-journal")] = - FilePath::FromWStringHack(file_name.ToWStringHack() + - ASCIIToWide("-journal")); +void BrowserDatabaseSystem::VfsGetFileSize( + const string16& vfs_file_name, + int64* result, base::WaitableEvent* done_event) { + DCHECK(db_thread_proxy_->BelongsToCurrentThread()); + *result = VfsBackend::GetFileSize(GetFullFilePathForVfsFile(vfs_file_name)); + done_event->Signal(); } FilePath BrowserDatabaseSystem::GetFullFilePathForVfsFile( const string16& vfs_file_name) { + DCHECK(db_thread_proxy_->BelongsToCurrentThread()); if (vfs_file_name.empty()) // temp file, used for vacuuming return FilePath(); - - base::AutoLock file_names_auto_lock(file_names_lock_); - if(file_names_.find(vfs_file_name) != file_names_.end()) - return file_names_[vfs_file_name]; - - // This method is getting called when an empty localStorage database is - // deleted. In that case, just return the path. -#if defined(OS_WIN) - return FilePath(vfs_file_name); -#else - return FilePath(UTF16ToUTF8(vfs_file_name)); -#endif + return DatabaseUtil::GetFullFilePathForVfsFile( + db_tracker_.get(), vfs_file_name); } + +void BrowserDatabaseSystem::ResetTracker() { + DCHECK(db_thread_proxy_->BelongsToCurrentThread()); + db_tracker_->CloseTrackerDatabaseAndClearCaches(); + file_util::Delete(db_tracker_->DatabaseDirectory(), true); +} + +void BrowserDatabaseSystem::ThreadCleanup(base::WaitableEvent* done_event) { + ResetTracker(); + db_tracker_->RemoveObserver(this); + db_tracker_ = NULL; + done_event->Signal(); +} + diff --git a/libcef/browser_database_system.h b/libcef/browser_database_system.h index 04a185432..bac82d55d 100644 --- a/libcef/browser_database_system.h +++ b/libcef/browser_database_system.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,29 +7,50 @@ #include "base/file_path.h" #include "base/hash_tables.h" +#include "base/memory/ref_counted.h" +#include "base/memory/scoped_temp_dir.h" #include "base/platform_file.h" -#include "base/ref_counted.h" -#include "base/scoped_temp_dir.h" #include "base/string16.h" #include "base/synchronization/lock.h" +#include "base/task.h" +#include "base/threading/thread.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDatabaseObserver.h" #include "webkit/database/database_connections.h" #include "webkit/database/database_tracker.h" +namespace base { +class MessageLoopProxy; +class WaitableEvent; +} + class BrowserDatabaseSystem : public webkit_database::DatabaseTracker::Observer, public WebKit::WebDatabaseObserver { public: static BrowserDatabaseSystem* GetInstance(); + BrowserDatabaseSystem(); ~BrowserDatabaseSystem(); - // VFS functions + // WebDatabaseObserver implementation, these are called on the script + // execution context thread on which the database is opened. This may be + // the main thread or background WebWorker threads. + virtual void databaseOpened(const WebKit::WebDatabase& database); + virtual void databaseModified(const WebKit::WebDatabase& database); + virtual void databaseClosed(const WebKit::WebDatabase& database); + + // SQLite VFS related methods, these are called on webcore's + // background database threads via the WebKitClient impl. base::PlatformFile OpenFile(const string16& vfs_file_name, int desired_flags); int DeleteFile(const string16& vfs_file_name, bool sync_dir); - long GetFileAttributes(const string16& vfs_file_name); - long long GetFileSize(const string16& vfs_file_name); + uint32 GetFileAttributes(const string16& vfs_file_name); + int64 GetFileSize(const string16& vfs_file_name); - // database tracker functions + // For use by LayoutTestController, called on the main thread. + void ClearAllDatabases(); + void SetDatabaseQuota(int64 quota); + + private: + // Used by our WebDatabaseObserver impl, only called on the db_thread void DatabaseOpened(const string16& origin_identifier, const string16& database_name, const string16& description, @@ -47,38 +68,36 @@ class BrowserDatabaseSystem : public webkit_database::DatabaseTracker::Observer, virtual void OnDatabaseScheduledForDeletion(const string16& origin_identifier, const string16& database_name); - // WebDatabaseObserver implementation - virtual void databaseOpened(const WebKit::WebDatabase& database); - virtual void databaseModified(const WebKit::WebDatabase& database); - virtual void databaseClosed(const WebKit::WebDatabase& database); + // Used by our public SQLite VFS methods, only called on the db_thread. + void VfsOpenFile(const string16& vfs_file_name, int desired_flags, + base::PlatformFile* result, base::WaitableEvent* done_event); + void VfsDeleteFile(const string16& vfs_file_name, bool sync_dir, + int* result, base::WaitableEvent* done_event); + void VfsGetFileAttributes(const string16& vfs_file_name, + uint32* result, base::WaitableEvent* done_event); + void VfsGetFileSize(const string16& vfs_file_name, + int64* result, base::WaitableEvent* done_event); - void ClearAllDatabases(); - void SetDatabaseQuota(int64 quota); - - private: - // The calls that come from the database tracker run on the main thread. - // Therefore, we can only call DatabaseUtil::GetFullFilePathForVfsFile() - // on the main thread. However, the VFS calls run on the DB thread and - // they need to crack VFS file paths. To resolve this problem, we store - // a map of vfs_file_names to file_paths. The map is updated on the main - // thread on each DatabaseOpened() call that comes from the database - // tracker, and is read on the DB thread by each VFS call. - void SetFullFilePathsForVfsFile(const string16& origin_identifier, - const string16& database_name); FilePath GetFullFilePathForVfsFile(const string16& vfs_file_name); - static BrowserDatabaseSystem* instance_; - - bool waiting_for_dbs_to_close_; + void ResetTracker(); + void ThreadCleanup(base::WaitableEvent* done_event); + // Where the tracker database file and per origin database files reside. ScopedTempDir temp_dir_; + // All access to the db_tracker (except for its construction) and + // vfs operations are serialized on a background thread. + base::Thread db_thread_; + scoped_refptr db_thread_proxy_; scoped_refptr db_tracker_; - base::Lock file_names_lock_; - base::hash_map file_names_; + // Data members to support waiting for all connections to be closed. + scoped_refptr open_connections_; - webkit_database::DatabaseConnections database_connections_; + static BrowserDatabaseSystem* instance_; }; +DISABLE_RUNNABLE_METHOD_REFCOUNT(BrowserDatabaseSystem); + #endif // _BROWSER_DATABASE_SYSTEM_H diff --git a/libcef/browser_devtools_agent.cc b/libcef/browser_devtools_agent.cc index 36a8f8ae2..4256a3651 100644 --- a/libcef/browser_devtools_agent.cc +++ b/libcef/browser_devtools_agent.cc @@ -80,12 +80,6 @@ void BrowserDevToolsAgent::runtimePropertyChanged( // TODO: Implement. } -WebCString BrowserDevToolsAgent::debuggerScriptSource() { - base::StringPiece debuggerScriptjs = - webkit_glue::GetDataResource(IDR_DEVTOOLS_DEBUGGER_SCRIPT_JS); - return WebCString(debuggerScriptjs.data(), debuggerScriptjs.length()); -} - WebKit::WebDevToolsAgentClient::WebKitClientMessageLoop* BrowserDevToolsAgent::createClientMessageLoop() { return new WebKitClientMessageLoopImpl(); diff --git a/libcef/browser_devtools_agent.h b/libcef/browser_devtools_agent.h index 48fae6b58..10d674516 100644 --- a/libcef/browser_devtools_agent.h +++ b/libcef/browser_devtools_agent.h @@ -34,7 +34,6 @@ class BrowserDevToolsAgent : public WebKit::WebDevToolsAgentClient { virtual int hostIdentifier() { return routing_id_; } virtual void runtimePropertyChanged(const WebKit::WebString& name, const WebKit::WebString& value); - virtual WebKit::WebCString debuggerScriptSource(); virtual WebKit::WebDevToolsAgentClient::WebKitClientMessageLoop* createClientMessageLoop(); diff --git a/libcef/browser_drag_delegate_win.cc b/libcef/browser_drag_delegate_win.cc index d4f971fd5..6a733cb8c 100644 --- a/libcef/browser_drag_delegate_win.cc +++ b/libcef/browser_drag_delegate_win.cc @@ -454,7 +454,7 @@ void BrowserDragDelegate::PrepareDragForFileContents( } } file_name = file_name.ReplaceExtension(drop_data.file_extension); - data->SetFileContents(file_name.value(), drop_data.file_contents); + data->SetFileContents(file_name, drop_data.file_contents); } void BrowserDragDelegate::PrepareDragForUrl(const WebDropData& drop_data, diff --git a/libcef/browser_drag_delegate_win.h b/libcef/browser_drag_delegate_win.h index a9d18e09e..4d0d8e9d0 100644 --- a/libcef/browser_drag_delegate_win.h +++ b/libcef/browser_drag_delegate_win.h @@ -7,8 +7,8 @@ #define _BROWSER_DRAG_DELEGATE_WIN_H #pragma once -#include "base/ref_counted.h" -#include "base/scoped_ptr.h" +#include "base/memory/ref_counted.h" +#include "base/memory/scoped_ptr.h" #include "base/threading/platform_thread.h" #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" diff --git a/libcef/browser_file_system.cc b/libcef/browser_file_system.cc index 98532d459..869892bee 100644 --- a/libcef/browser_file_system.cc +++ b/libcef/browser_file_system.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,9 +6,9 @@ #include "browser_file_writer.h" #include "base/file_path.h" +#include "base/memory/scoped_callback_factory.h" #include "base/message_loop.h" #include "base/message_loop_proxy.h" -#include "base/scoped_callback_factory.h" #include "base/time.h" #include "base/utf_string_conversions.h" #include "googleurl/src/gurl.h" @@ -20,6 +20,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" #include "webkit/fileapi/file_system_callback_dispatcher.h" #include "webkit/fileapi/file_system_context.h" +#include "webkit/fileapi/file_system_file_util.h" #include "webkit/fileapi/file_system_operation.h" #include "webkit/fileapi/file_system_path_manager.h" #include "webkit/fileapi/file_system_types.h" @@ -40,6 +41,7 @@ using WebKit::WebVector; using fileapi::FileSystemCallbackDispatcher; using fileapi::FileSystemContext; +using fileapi::FileSystemFileUtil; using fileapi::FileSystemOperation; namespace { @@ -62,13 +64,16 @@ class BrowserFileSystemCallbackDispatcher callbacks_->didSucceed(); } - virtual void DidReadMetadata(const base::PlatformFileInfo& info) { + virtual void DidReadMetadata(const base::PlatformFileInfo& info, + const FilePath& platform_path) { DCHECK(file_system_); WebFileInfo web_file_info; web_file_info.length = info.size; web_file_info.modificationTime = info.last_modified.ToDoubleT(); web_file_info.type = info.is_directory ? WebFileInfo::TypeDirectory : WebFileInfo::TypeFile; + web_file_info.platformPath = + webkit_glue::FilePathToWebString(platform_path); callbacks_->didReadMetadata(web_file_info); } @@ -121,10 +126,11 @@ BrowserFileSystem::BrowserFileSystem() { file_system_context_ = new FileSystemContext( base::MessageLoopProxy::CreateForCurrentThread(), base::MessageLoopProxy::CreateForCurrentThread(), + NULL /* special storage policy */, file_system_dir_.path(), false /* incognito */, true /* allow_file_access */, - false /* unlimited_quota */); + true /* unlimited_quota */); } else { LOG(WARNING) << "Failed to create a temp dir for the filesystem." "FileSystem feature will be disabled."; @@ -235,7 +241,7 @@ void BrowserFileSystem::readDirectory( WebFileWriter* BrowserFileSystem::createFileWriter( const WebString& path, WebFileWriterClient* client) { - return new BrowserFileWriter(path, client); + return new BrowserFileWriter(path, client, file_system_context_.get()); } FileSystemOperation* BrowserFileSystem::GetNewOperation( @@ -244,6 +250,6 @@ FileSystemOperation* BrowserFileSystem::GetNewOperation( new BrowserFileSystemCallbackDispatcher(AsWeakPtr(), callbacks); FileSystemOperation* operation = new FileSystemOperation( dispatcher, base::MessageLoopProxy::CreateForCurrentThread(), - file_system_context_.get()); + file_system_context_.get(), NULL); return operation; } diff --git a/libcef/browser_file_system.h b/libcef/browser_file_system.h index d56db2c09..bb0adadaf 100644 --- a/libcef/browser_file_system.h +++ b/libcef/browser_file_system.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,8 +8,8 @@ #include #include "base/file_util_proxy.h" #include "base/id_map.h" -#include "base/scoped_temp_dir.h" -#include "base/weak_ptr.h" +#include "base/memory/scoped_temp_dir.h" +#include "base/memory/weak_ptr.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystem.h" #include "webkit/fileapi/file_system_types.h" @@ -36,6 +36,10 @@ class BrowserFileSystem bool create, WebKit::WebFileSystemCallbacks* callbacks); + fileapi::FileSystemContext* file_system_context() { + return file_system_context_.get(); + } + // WebKit::WebFileSystem methods. virtual void move(const WebKit::WebString& src_path, const WebKit::WebString& dest_path, diff --git a/libcef/browser_file_writer.cc b/libcef/browser_file_writer.cc index 6973506bd..25fc51074 100644 --- a/libcef/browser_file_writer.cc +++ b/libcef/browser_file_writer.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,11 +9,15 @@ #include "base/message_loop_proxy.h" #include "net/url_request/url_request_context.h" #include "webkit/fileapi/file_system_callback_dispatcher.h" +#include "webkit/fileapi/file_system_context.h" +#include "webkit/fileapi/file_system_file_util.h" #include "webkit/fileapi/file_system_operation.h" #include "webkit/glue/webkit_glue.h" -using fileapi::FileSystemOperation; using fileapi::FileSystemCallbackDispatcher; +using fileapi::FileSystemContext; +using fileapi::FileSystemFileUtil; +using fileapi::FileSystemOperation; using fileapi::WebFileWriterBase; using WebKit::WebFileWriterClient; using WebKit::WebString; @@ -27,9 +31,11 @@ net::URLRequestContext* BrowserFileWriter::request_context_ = NULL; class BrowserFileWriter::IOThreadProxy : public base::RefCountedThreadSafe { public: - explicit IOThreadProxy(const base::WeakPtr& simple_writer) + explicit IOThreadProxy(const base::WeakPtr& simple_writer, + FileSystemContext* file_system_context) : simple_writer_(simple_writer), - operation_(NULL) { + operation_(NULL), + file_system_context_(file_system_context) { io_thread_ = CefThread::GetMessageLoopProxyForThread(CefThread::IO); main_thread_ = base::MessageLoopProxy::CreateForCurrentThread(); } @@ -96,7 +102,9 @@ class BrowserFileWriter::IOThreadProxy proxy_->DidWrite(bytes, complete); } - virtual void DidReadMetadata(const base::PlatformFileInfo&) { + virtual void DidReadMetadata( + const base::PlatformFileInfo&, + const FilePath&) { NOTREACHED(); } @@ -106,8 +114,9 @@ class BrowserFileWriter::IOThreadProxy NOTREACHED(); } - virtual void DidOpenFileSystem(const std::string& name, - const FilePath& root_path) { + virtual void DidOpenFileSystem( + const std::string& name, + const FilePath& root_path) { NOTREACHED(); } @@ -117,7 +126,8 @@ class BrowserFileWriter::IOThreadProxy FileSystemOperation* GetNewOperation() { // The FileSystemOperation takes ownership of the CallbackDispatcher. return new FileSystemOperation(new CallbackDispatcher(this), - io_thread_, NULL); + io_thread_, file_system_context_.get(), + NULL); } void DidSucceed() { @@ -163,13 +173,17 @@ class BrowserFileWriter::IOThreadProxy // Only used on the io thread. FileSystemOperation* operation_; + + scoped_refptr file_system_context_; }; BrowserFileWriter::BrowserFileWriter( - const WebString& path, WebFileWriterClient* client) + const WebString& path, + WebFileWriterClient* client, + FileSystemContext* file_system_context) : WebFileWriterBase(path, client), - io_thread_proxy_(new IOThreadProxy(AsWeakPtr())) { + io_thread_proxy_(new IOThreadProxy(AsWeakPtr(), file_system_context)) { } BrowserFileWriter::~BrowserFileWriter() { diff --git a/libcef/browser_file_writer.h b/libcef/browser_file_writer.h index f2a056fcf..bf9a79351 100644 --- a/libcef/browser_file_writer.h +++ b/libcef/browser_file_writer.h @@ -1,27 +1,33 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef BROWSER_FILE_WRITER_H_ #define BROWSER_FILE_WRITER_H_ -#include "base/ref_counted.h" -#include "base/weak_ptr.h" +#include "base/memory/ref_counted.h" +#include "base/memory/weak_ptr.h" #include "webkit/fileapi/webfilewriter_base.h" namespace net { class URLRequestContext; +} // namespace net + +namespace fileapi { +class FileSystemContext; } // An implementation of WebFileWriter for use in test_shell and DRT. class BrowserFileWriter : public fileapi::WebFileWriterBase, - public base::SupportsWeakPtr { + public base::SupportsWeakPtr { public: BrowserFileWriter( - const WebKit::WebString& path, WebKit::WebFileWriterClient* client); + const WebKit::WebString& path, + WebKit::WebFileWriterClient* client, + fileapi::FileSystemContext* file_system_context); virtual ~BrowserFileWriter(); - // Called by CefProcessIOThread when the thread is created and destroyed. + // Called by CefProcessIOThread when the context is created and destroyed. static void InitializeOnIOThread(net::URLRequestContext* request_context) { request_context_ = request_context; } diff --git a/libcef/browser_impl.h b/libcef/browser_impl.h index 2bd1bba3a..f30dd82cc 100644 --- a/libcef/browser_impl.h +++ b/libcef/browser_impl.h @@ -19,7 +19,7 @@ #include "printing/win_printing_context.h" #endif -#include "base/scoped_temp_dir.h" +#include "base/memory/scoped_temp_dir.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" namespace base { diff --git a/libcef/browser_impl_win.cc b/libcef/browser_impl_win.cc index b09955892..a40255498 100644 --- a/libcef/browser_impl_win.cc +++ b/libcef/browser_impl_win.cc @@ -9,6 +9,7 @@ #include "printing/units.h" #include "skia/ext/vector_canvas.h" +#include "skia/ext/vector_platform_device_win.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" @@ -261,7 +262,12 @@ void CefBrowserImpl::UIT_PrintPage(int page_number, int total_pages, int saved_state = SaveDC(hDC); DCHECK_NE(saved_state, 0); - skia::VectorCanvas canvas(hDC, dest_size_x, dest_size_y); + skia::PlatformDevice* device = + skia::VectorPlatformDeviceFactory::CreateDevice(dest_size_x, + dest_size_y, + true, hDC); + DCHECK(device); + skia::VectorCanvas canvas(device); // The hDC 0 coord is the left most printeable area and not physical area of // the paper so subtract that out of our canvas translate. diff --git a/libcef/browser_navigation_controller.h b/libcef/browser_navigation_controller.h index a2569b757..42a057804 100644 --- a/libcef/browser_navigation_controller.h +++ b/libcef/browser_navigation_controller.h @@ -10,8 +10,8 @@ #include #include "base/basictypes.h" -#include "base/linked_ptr.h" -#include "base/ref_counted.h" +#include "base/memory/linked_ptr.h" +#include "base/memory/ref_counted.h" #include "googleurl/src/gurl.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebHTTPBody.h" diff --git a/libcef/browser_persistent_cookie_store.cc b/libcef/browser_persistent_cookie_store.cc index ba9385823..9986495ad 100644 --- a/libcef/browser_persistent_cookie_store.cc +++ b/libcef/browser_persistent_cookie_store.cc @@ -13,6 +13,7 @@ #include "app/sql/transaction.h" #include "base/file_path.h" #include "base/file_util.h" +#include "googleurl/src/gurl.h" using base::Time; @@ -178,6 +179,8 @@ bool BrowserPersistentCookieStore::Backend::Load( while (smt.Step()) { scoped_ptr cc( new net::CookieMonster::CanonicalCookie( + // The "source" URL is not used with persisted cookies. + GURL(), // Source smt.ColumnString(2), // name smt.ColumnString(3), // value smt.ColumnString(1), // domain diff --git a/libcef/browser_persistent_cookie_store.h b/libcef/browser_persistent_cookie_store.h index bfc4ea46c..20a80cd72 100644 --- a/libcef/browser_persistent_cookie_store.h +++ b/libcef/browser_persistent_cookie_store.h @@ -17,7 +17,7 @@ #include #include -#include "base/ref_counted.h" +#include "base/memory/ref_counted.h" #include "net/base/cookie_monster.h" class FilePath; diff --git a/libcef/browser_request_context.cc b/libcef/browser_request_context.cc index a52412f0a..c3ce689ed 100644 --- a/libcef/browser_request_context.cc +++ b/libcef/browser_request_context.cc @@ -4,6 +4,7 @@ // found in the LICENSE file. #include "browser_request_context.h" +#include "browser_file_system.h" #include "browser_persistent_cookie_store.h" #include "browser_resource_loader_bridge.h" #include "build/build_config.h" @@ -20,7 +21,10 @@ #include "net/proxy/proxy_config_service.h" #include "net/proxy/proxy_config_service_fixed.h" #include "net/proxy/proxy_service.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebKitClient.h" #include "webkit/blob/blob_storage_controller.h" +#include "webkit/fileapi/file_system_context.h" #include "webkit/glue/webkit_glue.h" #if defined(OS_WIN) @@ -74,12 +78,12 @@ void BrowserRequestContext::Init( persistent_store = new BrowserPersistentCookieStore(cookie_path); } - cookie_store_ = new net::CookieMonster(persistent_store.get(), NULL); - cookie_policy_ = new net::StaticCookiePolicy(); + set_cookie_store(new net::CookieMonster(persistent_store.get(), NULL)); + set_cookie_policy(new net::StaticCookiePolicy()); // hard-code A-L and A-C for test shells - accept_language_ = "en-us,en"; - accept_charset_ = "iso-8859-1,*,utf-8"; + set_accept_language("en-us,en"); + set_accept_charset("iso-8859-1,*,utf-8"); #if defined(OS_WIN) // Using the system proxy resolver on Windows when "Automatically detect @@ -92,8 +96,8 @@ void BrowserRequestContext::Init( WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ie_config = {0}; if (WinHttpGetIEProxyConfigForCurrentUser(&ie_config)) { if (ie_config.fAutoDetect == TRUE) { - proxy_service_ = net::ProxyService::CreateWithoutProxyResolver( - new ProxyConfigServiceNull(), NULL); + set_proxy_service(net::ProxyService::CreateWithoutProxyResolver( + new ProxyConfigServiceNull(), NULL)); } if (ie_config.lpszAutoConfigUrl) @@ -105,20 +109,20 @@ void BrowserRequestContext::Init( } #endif // defined(OS_WIN) - if (!proxy_service_.get()) { + if (!proxy_service()) { // Use the system proxy resolver. scoped_ptr proxy_config_service( net::ProxyService::CreateSystemProxyConfigService( MessageLoop::current(), NULL)); - proxy_service_ = net::ProxyService::CreateUsingSystemProxyResolver( - proxy_config_service.release(), 0, NULL); + set_proxy_service(net::ProxyService::CreateUsingSystemProxyResolver( + proxy_config_service.release(), 0, NULL)); } - host_resolver_ = + set_host_resolver( net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, - NULL, NULL); - cert_verifier_ = new net::CertVerifier; - ssl_config_service_ = net::SSLConfigService::CreateSystemSSLConfigService(); + NULL, NULL)); + set_cert_verifier(new net::CertVerifier); + set_ssl_config_service(net::SSLConfigService::CreateSystemSSLConfigService()); // Add support for single sign-on. url_security_manager_.reset(net::URLSecurityManager::Create(NULL, NULL)); @@ -129,38 +133,40 @@ void BrowserRequestContext::Init( supported_schemes.push_back("ntlm"); supported_schemes.push_back("negotiate"); - http_auth_handler_factory_ = + set_http_auth_handler_factory( net::HttpAuthHandlerRegistryFactory::Create(supported_schemes, url_security_manager_.get(), - host_resolver_, + host_resolver(), std::string(), false, - false); + false)); net::HttpCache::DefaultBackend* backend = new net::HttpCache::DefaultBackend( cache_path_valid ? net::DISK_CACHE : net::MEMORY_CACHE, cache_path, 0, BrowserResourceLoaderBridge::GetCacheThread()); net::HttpCache* cache = - new net::HttpCache(host_resolver_, cert_verifier_, NULL, NULL, - proxy_service_, ssl_config_service_, - http_auth_handler_factory_, NULL, NULL, backend); + new net::HttpCache(host_resolver(), cert_verifier(), NULL, NULL, + proxy_service(), ssl_config_service(), + http_auth_handler_factory(), NULL, NULL, backend); cache->set_mode(cache_mode); - http_transaction_factory_ = cache; + set_http_transaction_factory(cache); - ftp_transaction_factory_ = new net::FtpNetworkLayer(host_resolver_); + set_ftp_transaction_factory(new net::FtpNetworkLayer(host_resolver())); blob_storage_controller_.reset(new webkit_blob::BlobStorageController()); + file_system_context_ = static_cast( + WebKit::webKitClient()->fileSystem())->file_system_context(); } BrowserRequestContext::~BrowserRequestContext() { - delete ftp_transaction_factory_; - delete http_transaction_factory_; - delete http_auth_handler_factory_; - delete static_cast(cookie_policy_); - delete cert_verifier_; - delete host_resolver_; + delete ftp_transaction_factory(); + delete http_transaction_factory(); + delete http_auth_handler_factory(); + delete cookie_policy(); + delete cert_verifier(); + delete host_resolver(); } void BrowserRequestContext::SetAcceptAllCookies(bool accept_all_cookies) { diff --git a/libcef/browser_request_context.h b/libcef/browser_request_context.h index 394cecdf6..f134d56e8 100644 --- a/libcef/browser_request_context.h +++ b/libcef/browser_request_context.h @@ -11,6 +11,11 @@ #include "net/url_request/url_request_context.h" class FilePath; + +namespace fileapi { +class FileSystemContext; +} + namespace webkit_blob { class BlobStorageController; } @@ -36,11 +41,16 @@ class BrowserRequestContext : public net::URLRequestContext { return blob_storage_controller_.get(); } + fileapi::FileSystemContext* file_system_context() const { + return file_system_context_.get(); + } + private: void Init(const FilePath& cache_path, net::HttpCache::Mode cache_mode, bool no_proxy); scoped_ptr blob_storage_controller_; + scoped_refptr file_system_context_; scoped_ptr url_security_manager_; }; diff --git a/libcef/browser_resource_loader_bridge.cc b/libcef/browser_resource_loader_bridge.cc index 6e75b8bfe..c3862ed26 100644 --- a/libcef/browser_resource_loader_bridge.cc +++ b/libcef/browser_resource_loader_bridge.cc @@ -46,12 +46,12 @@ #include "base/file_path.h" #include "base/file_util.h" +#include "base/memory/ref_counted.h" #include "base/message_loop.h" #include "base/message_loop_proxy.h" #if defined(OS_MACOSX) || defined(OS_WIN) #include "base/nss_util.h" #endif -#include "base/ref_counted.h" #include "base/synchronization/waitable_event.h" #include "base/time.h" #include "base/timer.h" @@ -70,13 +70,13 @@ #include "net/http/http_request_headers.h" #include "net/http/http_response_headers.h" #include "net/proxy/proxy_service.h" -#if defined(OS_WIN) -#include "net/socket/ssl_client_socket_nss_factory.h" -#endif #include "net/url_request/url_request.h" #include "webkit/appcache/appcache_interfaces.h" #include "webkit/blob/blob_storage_controller.h" #include "webkit/blob/deletable_file_reference.h" +#include "webkit/fileapi/file_system_context.h" +#include "webkit/fileapi/file_system_dir_url_request_job.h" +#include "webkit/fileapi/file_system_url_request_job.h" #include "webkit/glue/resource_loader_bridge.h" using net::HttpResponseHeaders; @@ -190,7 +190,6 @@ class RequestProxy : public net::URLRequest::Delegate, } void NotifyReceivedResponse(const ResourceResponseInfo& info, - bool content_filtered, const GURL& url, bool allow_download) { if (browser_.get() && info.headers.get()) { @@ -215,7 +214,7 @@ class RequestProxy : public net::URLRequest::Delegate, } if (peer_) - peer_->OnReceivedResponse(info, content_filtered); + peer_->OnReceivedResponse(info); } void NotifyReceivedData(int bytes_read) { @@ -376,7 +375,7 @@ class RequestProxy : public net::URLRequest::Delegate, info.content_length = static_cast(offset); if(!mimeType.empty()) info.mime_type = mimeType; - OnReceivedResponse(info, false); + OnReceivedResponse(info); AsyncReadData(); } @@ -511,8 +510,7 @@ class RequestProxy : public net::URLRequest::Delegate, } virtual void OnReceivedResponse( - const ResourceResponseInfo& info, - bool content_filtered) { + const ResourceResponseInfo& info) { GURL url; bool allow_download(false); if (request_.get()){ @@ -524,8 +522,8 @@ class RequestProxy : public net::URLRequest::Delegate, } owner_loop_->PostTask(FROM_HERE, NewRunnableMethod( - this, &RequestProxy::NotifyReceivedResponse, info, content_filtered, - url, allow_download)); + this, &RequestProxy::NotifyReceivedResponse, info, url, + allow_download)); } virtual void OnReceivedData(int bytes_read) { @@ -567,7 +565,7 @@ class RequestProxy : public net::URLRequest::Delegate, if (request->status().is_success()) { ResourceResponseInfo info; PopulateResponseInfo(request, &info); - OnReceivedResponse(info, false); + OnReceivedResponse(info); AsyncReadData(); // start reading } else { Done(); @@ -745,9 +743,7 @@ class SyncRequestProxy : public RequestProxy { result_->url = new_url; } - virtual void OnReceivedResponse( - const ResourceResponseInfo& info, - bool content_filtered) { + virtual void OnReceivedResponse(const ResourceResponseInfo& info) { *static_cast(result_) = info; } diff --git a/libcef/browser_socket_stream_bridge.cc b/libcef/browser_socket_stream_bridge.cc index 04bb35a04..26e744182 100644 --- a/libcef/browser_socket_stream_bridge.cc +++ b/libcef/browser_socket_stream_bridge.cc @@ -6,8 +6,8 @@ #include "browser_socket_stream_bridge.h" +#include "base/memory/ref_counted.h" #include "base/message_loop.h" -#include "base/ref_counted.h" #include "googleurl/src/gurl.h" #include "net/socket_stream/socket_stream_job.h" #include "net/websockets/websocket_job.h" diff --git a/libcef/browser_web_worker.h b/libcef/browser_web_worker.h index 2dfa0bb6c..e2ae53a48 100644 --- a/libcef/browser_web_worker.h +++ b/libcef/browser_web_worker.h @@ -6,7 +6,7 @@ #define _BROWSER_WEB_WORKER_H #include "base/basictypes.h" -#include "base/ref_counted.h" +#include "base/memory/ref_counted.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebMessagePortChannel.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebWorker.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebWorkerClient.h" diff --git a/libcef/browser_webblobregistry_impl.h b/libcef/browser_webblobregistry_impl.h index 848e9a0a4..49a2f5868 100644 --- a/libcef/browser_webblobregistry_impl.h +++ b/libcef/browser_webblobregistry_impl.h @@ -5,7 +5,7 @@ #ifndef BROWSER_WEBBLOBREGISTRY_IMPL_H_ #define BROWSER_WEBBLOBREGISTRY_IMPL_H_ -#include "base/ref_counted.h" +#include "base/memory/ref_counted.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebBlobRegistry.h" class GURL; diff --git a/libcef/browser_webkit_init.h b/libcef/browser_webkit_init.h index cc4fe2d01..30b01823f 100644 --- a/libcef/browser_webkit_init.h +++ b/libcef/browser_webkit_init.h @@ -15,14 +15,13 @@ #include "browser_webstoragenamespace_impl.h" #include "base/file_util.h" +#include "base/memory/scoped_temp_dir.h" #include "base/metrics/stats_counters.h" #include "base/path_service.h" -#include "base/scoped_temp_dir.h" #include "base/utf_string_conversions.h" #include "media/base/media.h" #include "webkit/appcache/web_application_cache_host_impl.h" #include "webkit/database/vfs_backend.h" -#include "webkit/extensions/v8/gears_extension.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebData.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDatabase.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" @@ -52,12 +51,9 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl { WebKit::initialize(this); WebKit::setLayoutTestMode(false); - WebKit::WebScriptController::registerExtension( - extensions_v8::GearsExtension::Get()); WebKit::WebRuntimeFeatures::enableSockets(true); WebKit::WebRuntimeFeatures::enableApplicationCache(true); WebKit::WebRuntimeFeatures::enableDatabase(true); - WebKit::WebRuntimeFeatures::enableWebGL(true); WebKit::WebRuntimeFeatures::enablePushState(true); WebKit::WebRuntimeFeatures::enableNotifications(false); WebKit::WebRuntimeFeatures::enableTouch(true); @@ -228,6 +224,14 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl { keys_out.swap(keys); } + virtual WebKit::WebSerializedScriptValue injectIDBKeyIntoSerializedValue( + const WebKit::WebIDBKey& key, + const WebKit::WebSerializedScriptValue& value, + const WebKit::WebString& keyPath) { + return WebKit::WebIDBKey::injectIDBKeyIntoSerializedValue( + key, value, WebKit::WebIDBKeyPath::create(keyPath)); + } + virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D() { return new webkit::gpu::WebGraphicsContext3DInProcessImpl(); } diff --git a/libcef/browser_webview_delegate.h b/libcef/browser_webview_delegate.h index 95e4b097c..f45263efa 100644 --- a/libcef/browser_webview_delegate.h +++ b/libcef/browser_webview_delegate.h @@ -14,8 +14,8 @@ #include #include "base/basictypes.h" +#include "base/memory/weak_ptr.h" #include "base/scoped_ptr.h" -#include "base/weak_ptr.h" #include "build/build_config.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams.h" diff --git a/libcef/browser_webview_mac.mm b/libcef/browser_webview_mac.mm index 6c3853ebc..4ef425245 100644 --- a/libcef/browser_webview_mac.mm +++ b/libcef/browser_webview_mac.mm @@ -10,7 +10,7 @@ #include "cef_context.h" #include "webwidget_host.h" -#include "base/scoped_ptr.h" +#include "base/memory/scoped_ptr.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "ui/gfx/rect.h" diff --git a/libcef/browser_zoom_map.h b/libcef/browser_zoom_map.h index 9b5aa7fb5..75c75ab6e 100644 --- a/libcef/browser_zoom_map.h +++ b/libcef/browser_zoom_map.h @@ -6,7 +6,7 @@ #define _BROWSER_ZOOM_MAP_H #include "include/cef_string.h" -#include "base/singleton.h" +#include "base/memory/singleton.h" #include "googleurl/src/gurl.h" #include diff --git a/libcef/cef_context.h b/libcef/cef_context.h index 8263d25de..e477b3cba 100644 --- a/libcef/cef_context.h +++ b/libcef/cef_context.h @@ -13,8 +13,8 @@ #include "base/at_exit.h" #include "base/file_path.h" +#include "base/memory/ref_counted.h" #include "base/message_loop.h" -#include "base/ref_counted.h" #include class BrowserRequestContext; diff --git a/libcef/cef_process.h b/libcef/cef_process.h index b7768b296..c472a7d66 100644 --- a/libcef/cef_process.h +++ b/libcef/cef_process.h @@ -15,9 +15,9 @@ #include #include "base/basictypes.h" +#include "base/memory/ref_counted.h" +#include "base/memory/scoped_ptr.h" #include "base/message_loop.h" -#include "base/ref_counted.h" -#include "base/scoped_ptr.h" #include "base/threading/non_thread_safe.h" #include "ipc/ipc_message.h" diff --git a/libcef/cef_process_ui_thread.cc b/libcef/cef_process_ui_thread.cc index 0727d920d..db15e8a56 100644 --- a/libcef/cef_process_ui_thread.cc +++ b/libcef/cef_process_ui_thread.cc @@ -8,7 +8,6 @@ #include "browser_webkit_init.h" #include "cef_context.h" -#include "app/gfx/gl/gl_implementation.h" #include "base/command_line.h" #include "base/i18n/icu_util.h" #include "base/metrics/stats_table.h" @@ -16,14 +15,15 @@ #include "base/string_number_conversions.h" #include "build/build_config.h" #include "net/base/net_module.h" -#if defined(OS_WIN) -#include "net/socket/ssl_client_socket_nss_factory.h" -#endif +#include "net/url_request/url_request.h" +#include "ui/gfx/gl/gl_implementation.h" #include "webkit/blob/blob_storage_controller.h" #include "webkit/blob/blob_url_request_job.h" #include "webkit/extensions/v8/gc_extension.h" +#include "webkit/fileapi/file_system_context.h" +#include "webkit/fileapi/file_system_dir_url_request_job.h" +#include "webkit/fileapi/file_system_url_request_job.h" #include "webkit/plugins/npapi/plugin_list.h" -#include "net/url_request/url_request.h" #if defined(OS_WIN) #include @@ -44,7 +44,33 @@ net::URLRequestJob* BlobURLRequestJobFactory(net::URLRequest* request, return new webkit_blob::BlobURLRequestJob( request, blob_storage_controller->GetBlobDataFromUrl(request->url()), - NULL); + CefThread::GetMessageLoopProxyForThread(CefThread::FILE)); +} + +net::URLRequestJob* FileSystemURLRequestJobFactory(net::URLRequest* request, + const std::string& scheme) { + fileapi::FileSystemContext* fs_context = + static_cast(request->context()) + ->file_system_context(); + if (!fs_context) { + LOG(WARNING) << "No FileSystemContext found, ignoring filesystem: URL"; + return NULL; + } + + // If the path ends with a /, we know it's a directory. If the path refers + // to a directory and gets dispatched to FileSystemURLRequestJob, that class + // redirects back here, by adding a / to the URL. + const std::string path = request->url().path(); + if (!path.empty() && path[path.size() - 1] == '/') { + return new fileapi::FileSystemDirURLRequestJob( + request, + fs_context->path_manager(), + CefThread::GetMessageLoopProxyForThread(CefThread::FILE)); + } + return new fileapi::FileSystemURLRequestJob( + request, + fs_context->path_manager(), + CefThread::GetMessageLoopProxyForThread(CefThread::FILE)); } } // namespace @@ -122,16 +148,11 @@ void CefProcessUIThread::Init() { WebKit::WebScriptController::registerExtension( extensions_v8::GCExtension::Get()); -#if defined(OS_WIN) - // Use NSS for SSL on Windows. TODO(wtc): this should eventually be hidden - // inside DefaultClientSocketFactory::CreateSSLClientSocket. - net::ClientSocketFactory::SetSSLClientSocketFactory( - net::SSLClientSocketNSSFactory); -#endif - gfx::InitializeGLBindings(gfx::kGLImplementationDesktopGL); net::URLRequest::RegisterProtocolFactory("blob", &BlobURLRequestJobFactory); + net::URLRequest::RegisterProtocolFactory("filesystem", + &FileSystemURLRequestJobFactory); if (!_Context->cache_path().empty()) { // Create the storage context object. diff --git a/libcef/dom_node_impl.cc b/libcef/dom_node_impl.cc index 3bb4184c8..3fb67980c 100644 --- a/libcef/dom_node_impl.cc +++ b/libcef/dom_node_impl.cc @@ -181,7 +181,7 @@ CefString CefDOMNodeImpl::GetValue() node_.to(); webkit_glue::FormField formField(formElement); - str = formField.value(); + str = formField.value; } } diff --git a/libcef/dom_storage_area.h b/libcef/dom_storage_area.h index 3c0953c5c..5793a0849 100644 --- a/libcef/dom_storage_area.h +++ b/libcef/dom_storage_area.h @@ -6,9 +6,9 @@ #define _DOM_STORAGE_AREA_H #include "base/hash_tables.h" +#include "base/memory/ref_counted.h" +#include "base/memory/scoped_ptr.h" #include "base/nullable_string16.h" -#include "base/ref_counted.h" -#include "base/scoped_ptr.h" #include "base/string16.h" #include "googleurl/src/gurl.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageArea.h" diff --git a/libcef/drag_download_file.h b/libcef/drag_download_file.h index b882cc0db..1a03a3993 100644 --- a/libcef/drag_download_file.h +++ b/libcef/drag_download_file.h @@ -8,7 +8,7 @@ #pragma once #include "base/file_path.h" -#include "base/linked_ptr.h" +#include "base/memory/linked_ptr.h" #include "base/message_loop.h" #include "googleurl/src/gurl.h" #include "ui/base/dragdrop/download_file_interface.h" diff --git a/libcef/scheme_impl.cc b/libcef/scheme_impl.cc index e711e6fe5..52fa4ca5b 100644 --- a/libcef/scheme_impl.cc +++ b/libcef/scheme_impl.cc @@ -121,14 +121,6 @@ public: return false; } - virtual bool GetContentEncodings( - std::vector* encoding_types) - { - DCHECK(encoding_types->empty()); - - return !encoding_types->empty(); - } - virtual bool GetMimeType(std::string* mime_type) const { DCHECK(request_); diff --git a/libcef/simple_clipboard_impl.cc b/libcef/simple_clipboard_impl.cc index ef290c711..a61809957 100644 --- a/libcef/simple_clipboard_impl.cc +++ b/libcef/simple_clipboard_impl.cc @@ -53,10 +53,14 @@ void ClipboardReadHTML(ui::Clipboard::Buffer buffer, string16* markup, } // TODO(dcheng): Implement. -bool ClipboardReadAvailableTypes(ui::Clipboard::Buffer buffer, +void ClipboardReadAvailableTypes(ui::Clipboard::Buffer buffer, std::vector* types, bool* contains_filenames) { - return false; + return; +} + +void ClipboardReadImage(ui::Clipboard::Buffer buffer, std::string* data) { + ClipboardGetClipboard()->ReadImage(buffer, data); } bool ClipboardReadData(ui::Clipboard::Buffer buffer, const string16& type, diff --git a/libcef/web_drop_target_win.cc b/libcef/web_drop_target_win.cc index ab6d8bb10..2c7de5030 100644 --- a/libcef/web_drop_target_win.cc +++ b/libcef/web_drop_target_win.cc @@ -62,7 +62,7 @@ DWORD WebDropTarget::OnDragEnter(IDataObject* data_object, // TODO(tc): PopulateWebDropData can be slow depending on what is in the // IDataObject. Maybe we can do this in a background thread. - WebDropData drop_data(GetDragIdentity()); + WebDropData drop_data; WebDropData::PopulateWebDropData(data_object, &drop_data); if (drop_data.url.is_empty()) @@ -74,7 +74,6 @@ DWORD WebDropTarget::OnDragEnter(IDataObject* data_object, ScreenToClient(GetHWND(), &client_pt); WebDragOperation operation = view_->dragTargetDragEnter( drop_data.ToDragData(), - drop_data.identity, WebPoint(client_pt.x, client_pt.y), WebPoint(cursor_position.x, cursor_position.y), web_drag_utils_win::WinDragOpMaskToWebDragOpMask(effects)); diff --git a/libcef/web_urlrequest_impl.cc b/libcef/web_urlrequest_impl.cc index 46acd56f6..214d8aec7 100644 --- a/libcef/web_urlrequest_impl.cc +++ b/libcef/web_urlrequest_impl.cc @@ -75,8 +75,9 @@ public: // Called when following a redirect. |newRequest| contains the request // generated by the redirect. The client may modify |newRequest|. - void willSendRequest(WebKit::WebURLLoader*, WebKit::WebURLRequest& newRequest, - const WebKit::WebURLResponse& redirectResponse) + virtual void willSendRequest(WebKit::WebURLLoader*, + WebKit::WebURLRequest& newRequest, + const WebKit::WebURLResponse& redirectResponse) { REQUIRE_UIT(); if(!context_) @@ -99,8 +100,8 @@ public: // Called to report upload progress. The bytes reported correspond to // the HTTP message body. - void didSendData(WebKit::WebURLLoader*, unsigned long long bytesSent, - unsigned long long totalBytesToBeSent) + virtual void didSendData(WebKit::WebURLLoader*, unsigned long long bytesSent, + unsigned long long totalBytesToBeSent) { REQUIRE_UIT(); if(!context_) @@ -115,8 +116,8 @@ public: } // Called when response headers are received. - void didReceiveResponse(WebKit::WebURLLoader*, - const WebKit::WebURLResponse& response) + virtual void didReceiveResponse(WebKit::WebURLLoader*, + const WebKit::WebURLResponse& response) { REQUIRE_UIT(); if(!context_) @@ -135,13 +136,15 @@ public: // Called when a chunk of response data is downloaded. This is only called // if WebURLRequest's downloadToFile flag was set to true. - void didDownloadData(WebKit::WebURLLoader*, int dataLength) + virtual void didDownloadData(WebKit::WebURLLoader*, int dataLength) { NOTREACHED(); } // Called when a chunk of response data is received. - void didReceiveData(WebKit::WebURLLoader*, const char* data, int dataLength) + // FIXME(vsevik): rename once original didReceiveData() is removed. + virtual void didReceiveData2(WebURLLoader*, const char* data, int dataLength, + int lengthReceived) { REQUIRE_UIT(); if(!context_) @@ -159,14 +162,14 @@ public: // Called when a chunk of renderer-generated metadata is received from // the cache. - void didReceiveCachedMetadata(WebKit::WebURLLoader*, const char* data, - int dataLength) + virtual void didReceiveCachedMetadata(WebKit::WebURLLoader*, const char* data, + int dataLength) { NOTREACHED(); } // Called when the load completes successfully. - void didFinishLoading(WebKit::WebURLLoader*, double finishTime) + virtual void didFinishLoading(WebKit::WebURLLoader*, double finishTime) { REQUIRE_UIT(); if(!context_) @@ -180,7 +183,7 @@ public: } // Called when the load completes with an error. - void didFail(WebKit::WebURLLoader*, const WebKit::WebURLError& error) + virtual void didFail(WebKit::WebURLLoader*, const WebKit::WebURLError& error) { REQUIRE_UIT(); if(!context_) diff --git a/libcef/web_urlrequest_impl.h b/libcef/web_urlrequest_impl.h index e41477e47..a70d52611 100644 --- a/libcef/web_urlrequest_impl.h +++ b/libcef/web_urlrequest_impl.h @@ -6,7 +6,7 @@ #define _WEB_URL_REQUEST_CLIENT_IMPL_H #include "include/cef.h" -#include "base/ref_counted.h" +#include "base/memory/ref_counted.h" class CefWebURLRequestImpl : public CefThreadSafeBase diff --git a/libcef/webview_host_gtk.cc b/libcef/webview_host_gtk.cc index 564512577..5b0a1573a 100644 --- a/libcef/webview_host_gtk.cc +++ b/libcef/webview_host_gtk.cc @@ -31,10 +31,11 @@ WebViewHost* WebViewHost::Create(GtkWidget* parent_view, host->plugin_container_manager_.set_host_widget(host->view_); #if defined(WEBKIT_HAS_WEB_AUTO_FILL_CLIENT) - host->webwidget_ = WebView::create(delegate, dev_tools_client, NULL); + host->webwidget_ = WebView::create(delegate, NULL); #else - host->webwidget_ = WebView::create(delegate, dev_tools_client); + host->webwidget_ = WebView::create(delegate); #endif + host->webview()->setDevToolsAgentClient(dev_tools_client); prefs.Apply(host->webview()); host->webview()->initializeMainFrame(delegate); host->webwidget_->layout(); diff --git a/libcef/webview_host_mac.mm b/libcef/webview_host_mac.mm index 4ad3945f1..3aa898bd0 100644 --- a/libcef/webview_host_mac.mm +++ b/libcef/webview_host_mac.mm @@ -36,10 +36,11 @@ WebViewHost* WebViewHost::Create(NSView* parent_view, [host->view_ release]; #if defined(WEBKIT_HAS_WEB_AUTO_FILL_CLIENT) - host->webwidget_ = WebView::create(delegate, dev_tools_client, NULL); + host->webwidget_ = WebView::create(delegate, NULL); #else - host->webwidget_ = WebView::create(delegate, dev_tools_client); + host->webwidget_ = WebView::create(delegate); #endif + host->webview()->setDevToolsAgentClient(dev_tools_client); prefs.Apply(host->webview()); host->webview()->initializeMainFrame(delegate); host->webwidget_->resize(WebSize(content_rect.size.width, diff --git a/libcef/webview_host_win.cc b/libcef/webview_host_win.cc index 1171bf42d..babce7ae5 100644 --- a/libcef/webview_host_win.cc +++ b/libcef/webview_host_win.cc @@ -49,10 +49,11 @@ WebViewHost* WebViewHost::Create(HWND parent_view, } #if defined(WEBKIT_HAS_WEB_AUTO_FILL_CLIENT) - host->webwidget_ = WebView::create(delegate, dev_tools_client, NULL); + host->webwidget_ = WebView::create(delegate, NULL); #else - host->webwidget_ = WebView::create(delegate, dev_tools_client); + host->webwidget_ = WebView::create(delegate); #endif + host->webview()->setDevToolsAgentClient(dev_tools_client); prefs.Apply(host->webview()); host->webview()->initializeMainFrame(delegate); diff --git a/patch/patches/base.patch b/patch/patches/base.patch index d043e5e0e..2032690b5 100644 --- a/patch/patches/base.patch +++ b/patch/patches/base.patch @@ -1,8 +1,8 @@ Index: message_loop.cc =================================================================== ---- message_loop.cc (revision 74933) +--- message_loop.cc (revision 80310) +++ message_loop.cc (working copy) -@@ -287,9 +287,13 @@ +@@ -295,9 +295,13 @@ } void MessageLoop::AssertIdle() const { @@ -19,15 +19,15 @@ Index: message_loop.cc //------------------------------------------------------------------------------ Index: message_loop.h =================================================================== ---- message_loop.h (revision 74933) +--- message_loop.h (revision 80310) +++ message_loop.h (working copy) -@@ -318,6 +318,9 @@ +@@ -320,6 +320,9 @@ // Asserts that the MessageLoop is "idle". void AssertIdle() const; + // Returns true if the MessageLoop is "idle". + bool IsIdle() const; + - //---------------------------------------------------------------------------- - protected: - struct RunState { + #if defined(OS_WIN) + void set_os_modal_loop(bool os_modal_loop) { + os_modal_loop_ = os_modal_loop;