From 04c948fd51dfd3bd637efb3106b7fb85f0913998 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Thu, 20 Oct 2011 20:34:13 +0000 Subject: [PATCH] Update to Chromium revision 106500. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@329 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- CHROMIUM_BUILD_COMPATIBILITY.txt | 2 +- libcef/browser_appcache_system.cc | 12 +- libcef/browser_drag_delegate_win.cc | 2 +- libcef/browser_persistent_cookie_store.cc | 289 +++++++++++++++++----- libcef/browser_persistent_cookie_store.h | 8 +- libcef/browser_resource_loader_bridge.cc | 2 +- libcef/browser_webblobregistry_impl.cc | 84 ++----- libcef/browser_webblobregistry_impl.h | 15 +- libcef/browser_webkit_init.cc | 2 +- libcef/browser_webview_delegate.cc | 1 + libcef/dom_storage_context.cc | 7 +- libcef/download_util.cc | 2 +- libcef/web_drag_source_mac.mm | 2 +- patch/patches/base.patch | 8 +- 14 files changed, 283 insertions(+), 153 deletions(-) diff --git a/CHROMIUM_BUILD_COMPATIBILITY.txt b/CHROMIUM_BUILD_COMPATIBILITY.txt index 5c3d44251..8db649da0 100644 --- a/CHROMIUM_BUILD_COMPATIBILITY.txt +++ b/CHROMIUM_BUILD_COMPATIBILITY.txt @@ -17,5 +17,5 @@ { 'chromium_url': 'http://src.chromium.org/svn/trunk/src', - 'chromium_revision': '105051', + 'chromium_revision': '106500', } diff --git a/libcef/browser_appcache_system.cc b/libcef/browser_appcache_system.cc index 7aceff8de..aeace3d42 100644 --- a/libcef/browser_appcache_system.cc +++ b/libcef/browser_appcache_system.cc @@ -267,8 +267,8 @@ class BrowserBackendProxy status_result_ = appcache::UNCACHED; event_.Reset(); system_->io_message_loop()->PostTask( - FROM_HERE, - NewRunnableMethod(this, &BrowserBackendProxy::GetStatus, host_id)); + FROM_HERE, base::IgnoreReturn( + base::Bind(&BrowserBackendProxy::GetStatus, this, host_id))); event_.Wait(); } else if (system_->is_io_thread()) { system_->backend_impl_->GetStatusWithCallback( @@ -284,8 +284,8 @@ class BrowserBackendProxy bool_result_ = false; event_.Reset(); system_->io_message_loop()->PostTask( - FROM_HERE, - NewRunnableMethod(this, &BrowserBackendProxy::StartUpdate, host_id)); + FROM_HERE, base::IgnoreReturn( + base::Bind(&BrowserBackendProxy::StartUpdate, this, host_id))); event_.Wait(); } else if (system_->is_io_thread()) { system_->backend_impl_->StartUpdateWithCallback( @@ -301,8 +301,8 @@ class BrowserBackendProxy bool_result_ = false; event_.Reset(); system_->io_message_loop()->PostTask( - FROM_HERE, - NewRunnableMethod(this, &BrowserBackendProxy::SwapCache, host_id)); + FROM_HERE, base::IgnoreReturn( + base::Bind(&BrowserBackendProxy::SwapCache, this, host_id))); event_.Wait(); } else if (system_->is_io_thread()) { system_->backend_impl_->SwapCacheWithCallback( diff --git a/libcef/browser_drag_delegate_win.cc b/libcef/browser_drag_delegate_win.cc index 2597b7aba..92e0301dd 100644 --- a/libcef/browser_drag_delegate_win.cc +++ b/libcef/browser_drag_delegate_win.cc @@ -236,7 +236,7 @@ void BrowserDragDelegate::PrepareDragForFileContents( if (file_name.value().empty()) { // Retrieve the name from the URL. file_name = FilePath( - net::GetSuggestedFilename(drop_data.url, "", "", "", "", string16())); + net::GetSuggestedFilename(drop_data.url, "", "", "", "", "")); if (file_name.value().size() + drop_data.file_extension.size() + 1 > MAX_PATH) { file_name = FilePath(file_name.value().substr( diff --git a/libcef/browser_persistent_cookie_store.cc b/libcef/browser_persistent_cookie_store.cc index 192d0e0cb..f0cef6d03 100644 --- a/libcef/browser_persistent_cookie_store.cc +++ b/libcef/browser_persistent_cookie_store.cc @@ -1,4 +1,5 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Embedded Framework Authors. +// Portions 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,6 +7,9 @@ #include "cef_thread.h" #include +#include +#include +#include #include "base/basictypes.h" #include "base/bind.h" @@ -16,9 +20,11 @@ #include "base/memory/scoped_ptr.h" #include "base/metrics/histogram.h" #include "base/string_util.h" +#include "base/synchronization/lock.h" #include "base/threading/thread.h" #include "base/threading/thread_restrictions.h" #include "googleurl/src/gurl.h" +#include "net/base/registry_controlled_domain.h" #include "sql/meta_table.h" #include "sql/statement.h" #include "sql/transaction.h" @@ -26,10 +32,24 @@ using base::Time; // This class is designed to be shared between any calling threads and the -// database thread. It batches operations and commits them on a timer. -// This class expects to be Load()'ed once on any thread. Loading occurs -// asynchronously on the DB thread and the caller will be notified on the IO -// thread. Subsequent to loading, mutations may be queued by any thread using +// database thread. It batches operations and commits them on a timer. +// +// BrowserPersistentCookieStore::Load is called to load all cookies. It +// delegates to Backend::Load, which posts a Backend::LoadAndNotifyOnDBThread +// task to the DB thread. This task calls Backend::ChainLoadCookies(), which +// repeatedly posts itself to the DB thread to load each eTLD+1's cookies in +// separate tasks. When this is complete, Backend::NotifyOnIOThread is posted +// to the IO thread, which notifies the caller of BrowserPersistentCookieStore:: +// Load that the load is complete. +// +// If a priority load request is invoked via BrowserPersistentCookieStore:: +// LoadCookiesForKey, it is delegated to Backend::LoadCookiesForKey, which posts +// Backend::LoadKeyAndNotifyOnDBThread to the DB thread. That routine loads just +// that single domain key (eTLD+1)'s cookies, and posts a Backend:: +// NotifyOnIOThread to the IO thread to notify the caller of +// BrowserPersistentCookieStore::LoadCookiesForKey that that load is complete. +// +// Subsequent to loading, mutations may be queued by any thread using // AddCookie, UpdateCookieAccessTime, and DeleteCookie. These are flushed to // disk on the DB thread every 30 seconds, 512 operations, or call to Flush(), // whichever occurs first. @@ -40,11 +60,16 @@ class BrowserPersistentCookieStore::Backend : path_(path), db_(NULL), num_pending_(0), - clear_local_state_on_exit_(false) { + clear_local_state_on_exit_(false), + initialized_(false) { } - // Creates or load the SQLite database. - bool Load(const LoadedCallback& loaded_callback); + // Creates or loads the SQLite database. + void Load(const LoadedCallback& loaded_callback); + + // Loads cookies for the domain key (eTLD+1). + void LoadCookiesForKey(const std::string& domain, + const LoadedCallback& loaded_callback); // Batch a cookie addition. void AddCookie(const net::CookieMonster::CanonicalCookie& cc); @@ -97,17 +122,30 @@ class BrowserPersistentCookieStore::Backend }; private: - // Creates or load the SQLite database on DB thread. + // Creates or loads the SQLite database on DB thread. void LoadAndNotifyOnDBThread(const LoadedCallback& loaded_callback); - // Notify the CookieMonster when loading complete. + + // Loads cookies for the domain key (eTLD+1) on DB thread. + void LoadKeyAndNotifyOnDBThread(const std::string& domains, + const LoadedCallback& loaded_callback); + + // Notifies the CookieMonster when loading completes for a specific domain key + // or for all domain keys. Triggers the callback and passes it all cookies + // that have been loaded from DB since last IO notification. void NotifyOnIOThread( const LoadedCallback& loaded_callback, - bool load_success, - const std::vector& cookies); + bool load_success); + // Initialize the data base. bool InitializeDatabase(); - // Load cookies to the data base, and read cookies. - bool LoadInternal(std::vector* cookies); + + // Loads cookies for the next domain key from the DB, then either reschedules + // itself or schedules the provided callback to run on the IO thread (if all + // domains are loaded). + void ChainLoadCookies(const LoadedCallback& loaded_callback); + + // Load all cookies for a set of domains/hosts + bool LoadCookiesForDomains(const std::set& key); // Batch a cookie operation (add or delete) void BatchOperation(PendingOperation::OperationType op, @@ -126,9 +164,21 @@ class BrowserPersistentCookieStore::Backend PendingOperationsList::size_type num_pending_; // True if the persistent store should be deleted upon destruction. bool clear_local_state_on_exit_; - // Guard |pending_|, |num_pending_| and |clear_local_state_on_exit_|. + // Guard |cookies_|, |pending_|, |num_pending_| and + // |clear_local_state_on_exit_|. base::Lock lock_; + // Temporary buffer for cookies loaded from DB. Accumulates cookies to reduce + // the number of messages sent to the IO thread. Sent back in response to + // individual load requests for domain keys or when all loading completes. + std::vector cookies_; + + // Map of domain keys(eTLD+1) to domains/hosts that are to be loaded from DB. + std::map > keys_to_load_; + + // Indicates if DB has been initialized. + bool initialized_; + DISALLOW_COPY_AND_ASSIGN(Backend); }; @@ -166,43 +216,91 @@ bool InitTable(sql::Connection* db) { // so we want those people to get it. Ignore errors, since it may exist. db->Execute("CREATE INDEX IF NOT EXISTS cookie_times ON cookies" " (creation_utc)"); + + db->Execute("CREATE INDEX IF NOT EXISTS domain ON cookies(host_key)"); + return true; } } // namespace -bool BrowserPersistentCookieStore::Backend::Load( +void BrowserPersistentCookieStore::Backend::Load( const LoadedCallback& loaded_callback) { // This function should be called only once per instance. DCHECK(!db_.get()); CefThread::PostTask( CefThread::FILE, FROM_HERE, - base::Bind(&Backend::LoadAndNotifyOnDBThread, base::Unretained(this), - loaded_callback)); - return true; + base::Bind(&Backend::LoadAndNotifyOnDBThread, this, loaded_callback)); +} + +void BrowserPersistentCookieStore::Backend::LoadCookiesForKey( + const std::string& key, + const LoadedCallback& loaded_callback) { + CefThread::PostTask( + CefThread::FILE, FROM_HERE, + base::Bind(&Backend::LoadKeyAndNotifyOnDBThread, this, + key, + loaded_callback)); } void BrowserPersistentCookieStore::Backend::LoadAndNotifyOnDBThread( const LoadedCallback& loaded_callback) { DCHECK(CefThread::CurrentlyOn(CefThread::FILE)); - std::vector cookies; - bool load_success = LoadInternal(&cookies); + if (!InitializeDatabase()) { + CefThread::PostTask( + CefThread::IO, FROM_HERE, + base::Bind(&BrowserPersistentCookieStore::Backend::NotifyOnIOThread, + this, loaded_callback, false)); + } else { + ChainLoadCookies(loaded_callback); + } +} - CefThread::PostTask(CefThread::IO, FROM_HERE, base::Bind( - &BrowserPersistentCookieStore::Backend::NotifyOnIOThread, - base::Unretained(this), loaded_callback, load_success, cookies)); +void BrowserPersistentCookieStore::Backend::LoadKeyAndNotifyOnDBThread( + const std::string& key, + const LoadedCallback& loaded_callback) { + DCHECK(CefThread::CurrentlyOn(CefThread::FILE)); + + bool success = false; + if (InitializeDatabase()) { + std::map >::iterator + it = keys_to_load_.find(key); + if (it != keys_to_load_.end()) { + success = LoadCookiesForDomains(it->second); + keys_to_load_.erase(it); + } else { + success = true; + } + } + + CefThread::PostTask( + CefThread::IO, FROM_HERE, + base::Bind(&BrowserPersistentCookieStore::Backend::NotifyOnIOThread, + this, loaded_callback, success)); } void BrowserPersistentCookieStore::Backend::NotifyOnIOThread( const LoadedCallback& loaded_callback, - bool load_success, - const std::vector& cookies) { + bool load_success) { DCHECK(CefThread::CurrentlyOn(CefThread::IO)); + + std::vector cookies; + { + base::AutoLock locked(lock_); + cookies.swap(cookies_); + } + loaded_callback.Run(cookies); } bool BrowserPersistentCookieStore::Backend::InitializeDatabase() { + DCHECK(CefThread::CurrentlyOn(CefThread::FILE)); + + if (initialized_) { + return true; + } + const FilePath dir = path_.DirName(); if (!file_util::PathExists(dir) && !file_util::CreateDirectory(dir)) { return false; @@ -224,47 +322,108 @@ bool BrowserPersistentCookieStore::Backend::InitializeDatabase() { } db_->Preload(); - return true; -} -bool BrowserPersistentCookieStore::Backend::LoadInternal( - std::vector* cookies) { - if (!InitializeDatabase()) { - return false; - } - - // Slurp all the cookies into the out-vector. + // Retrieve all the domains sql::Statement smt(db_->GetUniqueStatement( - "SELECT creation_utc, host_key, name, value, path, expires_utc, secure, " - "httponly, last_access_utc FROM cookies")); + "SELECT DISTINCT host_key FROM cookies")); + if (!smt) { NOTREACHED() << "select statement prep failed"; db_.reset(); return false; } + // Build a map of domain keys (always eTLD+1) to domains. 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 - smt.ColumnString(4), // path - std::string(), // TODO(abarth): Persist mac_key - std::string(), // TODO(abarth): Persist mac_algorithm - Time::FromInternalValue(smt.ColumnInt64(0)), // creation_utc - Time::FromInternalValue(smt.ColumnInt64(5)), // expires_utc - Time::FromInternalValue(smt.ColumnInt64(8)), // last_access_utc - smt.ColumnInt(6) != 0, // secure - smt.ColumnInt(7) != 0, // httponly - true)); // has_expires - DLOG_IF(WARNING, - cc->CreationDate() > Time::Now()) << L"CreationDate too recent"; - cookies->push_back(cc.release()); + std::string domain = smt.ColumnString(0); + std::string key = + net::RegistryControlledDomainService::GetDomainAndRegistry(domain); + + std::map >::iterator it = + keys_to_load_.find(key); + if (it == keys_to_load_.end()) + it = keys_to_load_.insert(std::make_pair + (key, std::set())).first; + it->second.insert(domain); } + initialized_ = true; + return true; +} + +void BrowserPersistentCookieStore::Backend::ChainLoadCookies( + const LoadedCallback& loaded_callback) { + DCHECK(CefThread::CurrentlyOn(CefThread::FILE)); + + bool load_success = true; + + if (keys_to_load_.size() > 0) { + // Load cookies for the first domain key. + std::map >::iterator + it = keys_to_load_.begin(); + load_success = LoadCookiesForDomains(it->second); + keys_to_load_.erase(it); + } + + // If load is successful and there are more domain keys to be loaded, + // then post a DB task to continue chain-load; + // Otherwise notify on IO thread. + if (load_success && keys_to_load_.size() > 0) { + CefThread::PostTask( + CefThread::FILE, FROM_HERE, + base::Bind(&Backend::ChainLoadCookies, this, loaded_callback)); + } else { + CefThread::PostTask( + CefThread::IO, FROM_HERE, + base::Bind(&BrowserPersistentCookieStore::Backend::NotifyOnIOThread, + this, loaded_callback, load_success)); + } +} + +bool BrowserPersistentCookieStore::Backend::LoadCookiesForDomains( + const std::set& domains) { + DCHECK(CefThread::CurrentlyOn(CefThread::FILE)); + + sql::Statement smt(db_->GetCachedStatement(SQL_FROM_HERE, + "SELECT creation_utc, host_key, name, value, path, expires_utc, secure, " + "httponly, last_access_utc FROM cookies WHERE host_key = ?")); + if (!smt) { + NOTREACHED() << "select statement prep failed"; + db_.reset(); + return false; + } + + std::vector cookies; + std::set::const_iterator it = domains.begin(); + for (; it != domains.end(); ++it) { + smt.BindString(0, *it); + 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 + smt.ColumnString(4), // path + std::string(), // TODO(abarth): Persist mac_key + std::string(), // TODO(abarth): Persist mac_algorithm + Time::FromInternalValue(smt.ColumnInt64(0)), // creation_utc + Time::FromInternalValue(smt.ColumnInt64(5)), // expires_utc + Time::FromInternalValue(smt.ColumnInt64(8)), // last_access_utc + smt.ColumnInt(6) != 0, // secure + smt.ColumnInt(7) != 0, // httponly + true)); // has_expires + DLOG_IF(WARNING, + cc->CreationDate() > Time::Now()) << L"CreationDate too recent"; + cookies.push_back(cc.release()); + } + smt.Reset(); + } + { + base::AutoLock locked(lock_); + cookies_.insert(cookies_.end(), cookies.begin(), cookies.end()); + } return true; } @@ -379,13 +538,13 @@ void BrowserPersistentCookieStore::Backend::BatchOperation( if (num_pending == 1) { // We've gotten our first entry for this batch, fire off the timer. CefThread::PostDelayedTask( - CefThread::FILE, FROM_HERE, - NewRunnableMethod(this, &Backend::Commit), kCommitIntervalMs); + CefThread::FILE, FROM_HERE, + NewRunnableMethod(this, &Backend::Commit), kCommitIntervalMs); } else if (num_pending == kCommitAfterBatchSize) { // We've reached a big enough batch, fire off a commit now. CefThread::PostTask( - CefThread::FILE, FROM_HERE, - NewRunnableMethod(this, &Backend::Commit)); + CefThread::FILE, FROM_HERE, + NewRunnableMethod(this, &Backend::Commit)); } } @@ -531,8 +690,14 @@ BrowserPersistentCookieStore::~BrowserPersistentCookieStore() { } } -bool BrowserPersistentCookieStore::Load(const LoadedCallback& loaded_callback) { - return backend_->Load(loaded_callback); +void BrowserPersistentCookieStore::Load(const LoadedCallback& loaded_callback) { + backend_->Load(loaded_callback); +} + +void BrowserPersistentCookieStore::LoadCookiesForKey( + const std::string& key, + const LoadedCallback& loaded_callback) { + backend_->LoadCookiesForKey(key, loaded_callback); } void BrowserPersistentCookieStore::AddCookie( diff --git a/libcef/browser_persistent_cookie_store.h b/libcef/browser_persistent_cookie_store.h index ae5eaaf68..cd03555b8 100644 --- a/libcef/browser_persistent_cookie_store.h +++ b/libcef/browser_persistent_cookie_store.h @@ -1,5 +1,4 @@ // Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Portions copyright (c) 2010 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. @@ -17,10 +16,12 @@ #include #include +#include "base/compiler_specific.h" #include "base/memory/ref_counted.h" #include "net/base/cookie_monster.h" class FilePath; +class Task; // Implements the PersistentCookieStore interface in terms of a SQLite database. // For documentation about the actual member functions consult the documentation @@ -31,7 +32,10 @@ class BrowserPersistentCookieStore explicit BrowserPersistentCookieStore(const FilePath& path); virtual ~BrowserPersistentCookieStore(); - virtual bool Load(const LoadedCallback& loaded_callback) OVERRIDE; + virtual void Load(const LoadedCallback& loaded_callback) OVERRIDE; + + virtual void LoadCookiesForKey(const std::string& key, + const LoadedCallback& callback) OVERRIDE; virtual void AddCookie( const net::CookieMonster::CanonicalCookie& cc) OVERRIDE; diff --git a/libcef/browser_resource_loader_bridge.cc b/libcef/browser_resource_loader_bridge.cc index 0edd11baf..594f00b20 100644 --- a/libcef/browser_resource_loader_bridge.cc +++ b/libcef/browser_resource_loader_bridge.cc @@ -243,7 +243,7 @@ class RequestProxy : public net::URLRequest::Delegate, webkit_glue::ShouldDownload(content_disposition, info.mime_type)) { string16 filename = net::GetSuggestedFilename(url, content_disposition, info.charset, "", info.mime_type, - ASCIIToUTF16("download")); + "download"); CefRefPtr dl_handler; if (handler->GetDownloadHandler(browser_, info.mime_type, filename, info.content_length, diff --git a/libcef/browser_webblobregistry_impl.cc b/libcef/browser_webblobregistry_impl.cc index 3d24d5d8a..001824e1d 100644 --- a/libcef/browser_webblobregistry_impl.cc +++ b/libcef/browser_webblobregistry_impl.cc @@ -4,36 +4,23 @@ #include "browser_webblobregistry_impl.h" +#include "base/bind.h" #include "base/message_loop.h" -#include "base/task.h" #include "googleurl/src/gurl.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebBlobData.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" #include "webkit/blob/blob_data.h" #include "webkit/blob/blob_storage_controller.h" using WebKit::WebBlobData; -using WebKit::WebString; using WebKit::WebURL; +using webkit_blob::BlobData; namespace { MessageLoop* g_io_thread; webkit_blob::BlobStorageController* g_blob_storage_controller; -// WebURL contains a WebCString object that is ref-counted, -// but not thread-safe ref-counted. -// "Normal" copying of WebURL results in a copy that is not thread-safe. -// This method creates a deep copy of WebURL. -WebURL GetWebURLThreadsafeCopy(const WebURL& source) { - const WebKit::WebCString spec(source.spec().data(), source.spec().length()); - const url_parse::Parsed& parsed(source.parsed()); - const bool is_valid = source.isValid(); - return WebURL(spec, parsed, is_valid); -} - } // namespace /* static */ @@ -55,70 +42,43 @@ BrowserWebBlobRegistryImpl::BrowserWebBlobRegistryImpl() { void BrowserWebBlobRegistryImpl::registerBlobURL( const WebURL& url, WebBlobData& data) { DCHECK(g_io_thread); - CancelableTask* task; - { - scoped_refptr blob_data( - new webkit_blob::BlobData(data)); - WebURL url_copy = GetWebURLThreadsafeCopy(url); - task = - NewRunnableMethod( - this, &BrowserWebBlobRegistryImpl::DoRegisterBlobUrl, url_copy, - blob_data); - // After this block exits, url_copy is disposed, and - // the underlying WebCString will have a refcount=1 and will - // only be accessible from the task object. - } - g_io_thread->PostTask(FROM_HERE, task); + GURL thread_safe_url = url; // WebURL uses refcounted strings. + g_io_thread->PostTask(FROM_HERE, base::Bind( + &BrowserWebBlobRegistryImpl::AddFinishedBlob, this, + thread_safe_url, make_scoped_refptr(new BlobData(data)))); } void BrowserWebBlobRegistryImpl::registerBlobURL( const WebURL& url, const WebURL& src_url) { DCHECK(g_io_thread); - CancelableTask* task; - { - WebURL url_copy = GetWebURLThreadsafeCopy(url); - WebURL src_url_copy = GetWebURLThreadsafeCopy(src_url); - task = - NewRunnableMethod(this, - &BrowserWebBlobRegistryImpl::DoRegisterBlobUrlFrom, - url_copy, - src_url_copy); - // After this block exits, url_copy and src_url_copy are disposed, and - // the underlying WebCStrings will have a refcount=1 and will - // only be accessible from the task object. - } - g_io_thread->PostTask(FROM_HERE, task); + GURL thread_safe_url = url; + GURL thread_safe_src_url = src_url; + g_io_thread->PostTask(FROM_HERE, base::Bind( + &BrowserWebBlobRegistryImpl::CloneBlob, this, + thread_safe_url, thread_safe_src_url)); } void BrowserWebBlobRegistryImpl::unregisterBlobURL(const WebURL& url) { DCHECK(g_io_thread); - CancelableTask* task; - { - WebURL url_copy = GetWebURLThreadsafeCopy(url); - task = - NewRunnableMethod(this, - &BrowserWebBlobRegistryImpl::DoUnregisterBlobUrl, - url_copy); - // After this block exits, url_copy is disposed, and - // the underlying WebCString will have a refcount=1 and will - // only be accessible from the task object. - } - g_io_thread->PostTask(FROM_HERE, task); + GURL thread_safe_url = url; + g_io_thread->PostTask(FROM_HERE, base::Bind( + &BrowserWebBlobRegistryImpl::RemoveBlob, this, + thread_safe_url)); } -void BrowserWebBlobRegistryImpl::DoRegisterBlobUrl( - const GURL& url, webkit_blob::BlobData* blob_data) { +void BrowserWebBlobRegistryImpl::AddFinishedBlob( + const GURL& url, BlobData* blob_data) { DCHECK(g_blob_storage_controller); - g_blob_storage_controller->RegisterBlobUrl(url, blob_data); + g_blob_storage_controller->AddFinishedBlob(url, blob_data); } -void BrowserWebBlobRegistryImpl::DoRegisterBlobUrlFrom( +void BrowserWebBlobRegistryImpl::CloneBlob( const GURL& url, const GURL& src_url) { DCHECK(g_blob_storage_controller); - g_blob_storage_controller->RegisterBlobUrlFrom(url, src_url); + g_blob_storage_controller->CloneBlob(url, src_url); } -void BrowserWebBlobRegistryImpl::DoUnregisterBlobUrl(const GURL& url) { +void BrowserWebBlobRegistryImpl::RemoveBlob(const GURL& url) { DCHECK(g_blob_storage_controller); - g_blob_storage_controller->UnregisterBlobUrl(url); + g_blob_storage_controller->RemoveBlob(url); } diff --git a/libcef/browser_webblobregistry_impl.h b/libcef/browser_webblobregistry_impl.h index 49a2f5868..dea64c91c 100644 --- a/libcef/browser_webblobregistry_impl.h +++ b/libcef/browser_webblobregistry_impl.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. @@ -32,15 +32,14 @@ class BrowserWebBlobRegistryImpl const WebKit::WebURL& src_url); virtual void unregisterBlobURL(const WebKit::WebURL& url); - // Run on I/O thread. - void DoRegisterBlobUrl(const GURL& url, webkit_blob::BlobData* blob_data); - void DoRegisterBlobUrlFrom(const GURL& url, const GURL& src_url); - void DoUnregisterBlobUrl(const GURL& url); - - protected: + private: friend class base::RefCountedThreadSafe; - private: + // Run on I/O thread. + void AddFinishedBlob(const GURL& url, webkit_blob::BlobData* blob_data); + void CloneBlob(const GURL& url, const GURL& src_url); + void RemoveBlob(const GURL& url); + DISALLOW_COPY_AND_ASSIGN(BrowserWebBlobRegistryImpl); }; diff --git a/libcef/browser_webkit_init.cc b/libcef/browser_webkit_init.cc index 5fe1ee9ed..c31016e5e 100644 --- a/libcef/browser_webkit_init.cc +++ b/libcef/browser_webkit_init.cc @@ -225,7 +225,7 @@ WebKit::WebGraphicsContext3D* BrowserWebKitInit::createGraphicsContext3D() { return new webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl(); } else { return new webkit::gpu::WebGraphicsContext3DInProcessImpl( - gfx::kNullPluginWindow); + gfx::kNullPluginWindow, NULL); } } diff --git a/libcef/browser_webview_delegate.cc b/libcef/browser_webview_delegate.cc index 350524d16..d3cf7c7ef 100644 --- a/libcef/browser_webview_delegate.cc +++ b/libcef/browser_webview_delegate.cc @@ -683,6 +683,7 @@ WebMediaPlayer* BrowserWebViewDelegate::createMediaPlayer( scoped_ptr result( new webkit_glue::WebMediaPlayerImpl(client, + NULL, collection.release(), message_loop_factory.release(), NULL, diff --git a/libcef/dom_storage_context.cc b/libcef/dom_storage_context.cc index f0070fcb1..5e1fd6e38 100644 --- a/libcef/dom_storage_context.cc +++ b/libcef/dom_storage_context.cc @@ -8,6 +8,7 @@ #include +#include "base/bind.h" #include "base/file_path.h" #include "base/file_util.h" #include "base/string_util.h" @@ -59,9 +60,9 @@ int64 DOMStorageContext::CloneSessionStorage(int64 original_id) { DCHECK(!CefThread::CurrentlyOn(CefThread::UI)); int64 clone_id = AllocateSessionStorageNamespaceId(); CefThread::PostTask( - CefThread::UI, FROM_HERE, NewRunnableFunction( - &DOMStorageContext::CompleteCloningSessionStorage, - this, original_id, clone_id)); + CefThread::UI, FROM_HERE, + base::Bind(&DOMStorageContext::CompleteCloningSessionStorage, this, + original_id, clone_id)); return clone_id; } diff --git a/libcef/download_util.cc b/libcef/download_util.cc index 82333778f..d7d13ba93 100644 --- a/libcef/download_util.cc +++ b/libcef/download_util.cc @@ -169,7 +169,7 @@ void GenerateFileName(const GURL& url, referrer_charset, suggested_name, mime_type, - ASCIIToUTF16("download")); + "download"); // TODO(evan): this code is totally wrong -- we should just generate // Unicode filenames and do all this encoding switching at the end. diff --git a/libcef/web_drag_source_mac.mm b/libcef/web_drag_source_mac.mm index 5a27ede09..59ec06c41 100644 --- a/libcef/web_drag_source_mac.mm +++ b/libcef/web_drag_source_mac.mm @@ -65,7 +65,7 @@ FilePath GetFileNameFromDragData(const WebDropData& drop_data) { if (file_name.empty()) { // Retrieve the name from the URL. string16 suggested_filename = - net::GetSuggestedFilename(drop_data.url, "", "", "", "", string16()); + net::GetSuggestedFilename(drop_data.url, "", "", "", "", ""); file_name = FilePathFromFilename(suggested_filename); } diff --git a/patch/patches/base.patch b/patch/patches/base.patch index ac46156f5..c7f2467c2 100644 --- a/patch/patches/base.patch +++ b/patch/patches/base.patch @@ -1,8 +1,8 @@ Index: message_loop.cc =================================================================== ---- message_loop.cc (revision 105051) +--- message_loop.cc (revision 106500) +++ message_loop.cc (working copy) -@@ -394,9 +394,13 @@ +@@ -400,9 +400,13 @@ } void MessageLoop::AssertIdle() const { @@ -19,9 +19,9 @@ Index: message_loop.cc //------------------------------------------------------------------------------ Index: message_loop.h =================================================================== ---- message_loop.h (revision 105051) +--- message_loop.h (revision 106500) +++ message_loop.h (working copy) -@@ -363,6 +363,9 @@ +@@ -367,6 +367,9 @@ // Asserts that the MessageLoop is "idle". void AssertIdle() const;