From a3e0935ce36969a0c5908a75993fc863528740d7 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Fri, 17 Feb 2012 14:51:20 +0000 Subject: [PATCH] Update to Chromium revision 119867. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@504 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- CHROMIUM_BUILD_COMPATIBILITY.txt | 2 +- libcef/browser_appcache_system.cc | 16 ++- libcef/browser_database_system.cc | 4 +- libcef/browser_devtools_agent.h | 1 - libcef/browser_devtools_client.h | 1 - libcef/browser_drag_delegate_win.cc | 23 +-- libcef/browser_file_system.cc | 82 ++++++----- libcef/browser_file_system.h | 8 +- libcef/browser_file_writer.cc | 29 ++-- libcef/browser_file_writer.h | 8 +- libcef/browser_impl.cc | 174 +++++++++++++---------- libcef/browser_resource_loader_bridge.cc | 2 +- libcef/browser_settings.cc | 1 + libcef/browser_webview_delegate.cc | 21 ++- libcef/cef_context.cc | 8 +- libcef/cef_thread.cc | 96 ------------- libcef/cef_thread.h | 56 ++------ libcef/cookie_impl.cc | 5 +- libcef/dom_storage_area.cc | 2 +- libcef/dom_storage_area.h | 5 + libcef/drag_download_file.cc | 8 +- libcef/drag_download_util.cc | 6 +- libcef/nplugin_impl.cc | 7 +- libcef/origin_whitelist_impl.cc | 15 +- libcef/scheme_impl.cc | 17 +-- libcef/task_impl.cc | 16 +-- libcef/v8_impl.cc | 6 +- libcef/web_drag_source_mac.mm | 51 ++----- libcef/web_drag_source_win.cc | 8 +- libcef/web_urlrequest_impl.cc | 6 +- libcef/webwidget_host.h | 1 - patch/patch.cfg | 5 - patch/patches/base.patch | 8 +- patch/patches/webcore_v8_custom.patch | 17 --- 34 files changed, 284 insertions(+), 431 deletions(-) delete mode 100644 patch/patches/webcore_v8_custom.patch diff --git a/CHROMIUM_BUILD_COMPATIBILITY.txt b/CHROMIUM_BUILD_COMPATIBILITY.txt index 560ad4132..d9729c47a 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': '115967', + 'chromium_revision': '119867', } diff --git a/libcef/browser_appcache_system.cc b/libcef/browser_appcache_system.cc index 5ae63ffff..5d39cf6d0 100644 --- a/libcef/browser_appcache_system.cc +++ b/libcef/browser_appcache_system.cc @@ -11,7 +11,6 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/callback.h" -#include "base/task.h" #include "base/synchronization/waitable_event.h" #include "webkit/appcache/appcache_interceptor.h" #include "webkit/appcache/web_application_cache_host_impl.h" @@ -267,8 +266,9 @@ class BrowserBackendProxy status_result_ = appcache::UNCACHED; event_.Reset(); system_->io_message_loop()->PostTask( - FROM_HERE, base::IgnoreReturn( - base::Bind(&BrowserBackendProxy::GetStatus, this, host_id))); + FROM_HERE, + base::Bind(base::IgnoreResult(&BrowserBackendProxy::GetStatus), + this, host_id)); event_.Wait(); } else if (system_->is_io_thread()) { system_->backend_impl_->GetStatusWithCallback( @@ -284,8 +284,9 @@ class BrowserBackendProxy bool_result_ = false; event_.Reset(); system_->io_message_loop()->PostTask( - FROM_HERE, base::IgnoreReturn( - base::Bind(&BrowserBackendProxy::StartUpdate, this, host_id))); + FROM_HERE, + base::Bind(base::IgnoreResult(&BrowserBackendProxy::StartUpdate), + this, host_id)); event_.Wait(); } else if (system_->is_io_thread()) { system_->backend_impl_->StartUpdateWithCallback( @@ -301,8 +302,9 @@ class BrowserBackendProxy bool_result_ = false; event_.Reset(); system_->io_message_loop()->PostTask( - FROM_HERE, base::IgnoreReturn( - base::Bind(&BrowserBackendProxy::SwapCache, this, host_id))); + FROM_HERE, + base::Bind(base::IgnoreResult(&BrowserBackendProxy::SwapCache), + this, host_id)); event_.Wait(); } else if (system_->is_io_thread()) { system_->backend_impl_->SwapCacheWithCallback( diff --git a/libcef/browser_database_system.cc b/libcef/browser_database_system.cc index 1849282c2..06cee2fb0 100644 --- a/libcef/browser_database_system.cc +++ b/libcef/browser_database_system.cc @@ -248,7 +248,9 @@ void BrowserDatabaseSystem::VfsDeleteFile( *result = VfsBackend::DeleteFile(file_name, sync_dir); } while ((++num_retries < kNumDeleteRetries) && (*result == SQLITE_IOERR_DELETE) && - (base::PlatformThread::Sleep(10), 1)); + (base::PlatformThread::Sleep( + base::TimeDelta::FromMilliseconds(10)), + 1)); done_event->Signal(); } diff --git a/libcef/browser_devtools_agent.h b/libcef/browser_devtools_agent.h index 95d9a9d88..efc6bb7e6 100644 --- a/libcef/browser_devtools_agent.h +++ b/libcef/browser_devtools_agent.h @@ -9,7 +9,6 @@ #include #include "base/memory/weak_ptr.h" -#include "base/task.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsAgentClient.h" diff --git a/libcef/browser_devtools_client.h b/libcef/browser_devtools_client.h index b53c2ff7b..0e733da95 100644 --- a/libcef/browser_devtools_client.h +++ b/libcef/browser_devtools_client.h @@ -8,7 +8,6 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" -#include "base/task.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h" diff --git a/libcef/browser_drag_delegate_win.cc b/libcef/browser_drag_delegate_win.cc index f559f8a7c..075e4c939 100644 --- a/libcef/browser_drag_delegate_win.cc +++ b/libcef/browser_drag_delegate_win.cc @@ -18,6 +18,7 @@ #include "libcef/web_drag_utils_win.h" #include "libcef/web_drop_target_win.h" +#include "base/bind.h" #include "base/utf_string_conversions.h" #include "net/base/file_stream.h" #include "net/base/net_util.h" @@ -142,14 +143,14 @@ void BrowserDragDelegate::StartDragging(const WebDropData& drop_data, if (drag_drop_thread_->StartWithOptions(options)) { drag_drop_thread_->message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, - &BrowserDragDelegate::StartBackgroundDragging, - drop_data, - ops, - page_url, - page_encoding, - image, - image_offset)); + base::Bind(&BrowserDragDelegate::StartBackgroundDragging, + this, + drop_data, + ops, + page_url, + page_encoding, + image, + image_offset)); } // Install a hook procedure to monitor the messages so that we can forward @@ -179,7 +180,7 @@ void BrowserDragDelegate::StartBackgroundDragging( DoDragging(drop_data, ops, page_url, page_encoding, image, image_offset); CefThread::PostTask( CefThread::UI, FROM_HERE, - NewRunnableMethod(this, &BrowserDragDelegate::EndDragging, true)); + base::Bind(&BrowserDragDelegate::EndDragging, this, true)); } void BrowserDragDelegate::PrepareDragForDownload( @@ -343,7 +344,7 @@ void BrowserDragDelegate::OnWaitForData() { // mode so that it can start to process the normal input events. CefThread::PostTask( CefThread::UI, FROM_HERE, - NewRunnableMethod(this, &BrowserDragDelegate::EndDragging, true)); + base::Bind(&BrowserDragDelegate::EndDragging, this, true)); } void BrowserDragDelegate::OnDataObjectDisposed() { @@ -353,5 +354,5 @@ void BrowserDragDelegate::OnDataObjectDisposed() { // DataObjectImpl. CefThread::PostTask( CefThread::UI, FROM_HERE, - NewRunnableMethod(this, &BrowserDragDelegate::CloseThread)); + base::Bind(&BrowserDragDelegate::CloseThread, this)); } diff --git a/libcef/browser_file_system.cc b/libcef/browser_file_system.cc index a8d59696c..6563d67c5 100644 --- a/libcef/browser_file_system.cc +++ b/libcef/browser_file_system.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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,7 +7,6 @@ #include "libcef/cef_thread.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/time.h" @@ -23,10 +22,11 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" #include "webkit/fileapi/file_system_callback_dispatcher.h" #include "webkit/fileapi/file_system_context.h" -#include "webkit/fileapi/file_system_operation.h" -#include "webkit/fileapi/file_system_path_manager.h" +#include "webkit/fileapi/file_system_operation_interface.h" #include "webkit/fileapi/file_system_types.h" +#include "webkit/fileapi/mock_file_system_options.h" #include "webkit/glue/webkit_glue.h" +#include "webkit/tools/test_shell/simple_file_writer.h" using base::WeakPtr; @@ -44,18 +44,20 @@ using WebKit::WebVector; using fileapi::FileSystemCallbackDispatcher; using fileapi::FileSystemContext; -using fileapi::FileSystemOperation; +using fileapi::FileSystemOperationInterface; namespace { class BrowserFileSystemCallbackDispatcher : public FileSystemCallbackDispatcher { public: - BrowserFileSystemCallbackDispatcher( + // An instance of this class must be created by Create() + // (so that we do not leak ownerships). + static scoped_ptr Create( const WeakPtr& file_system, - WebFileSystemCallbacks* callbacks) - : file_system_(file_system), - callbacks_(callbacks) { + WebFileSystemCallbacks* callbacks) { + return scoped_ptr( + new BrowserFileSystemCallbackDispatcher(file_system, callbacks)); } ~BrowserFileSystemCallbackDispatcher() { @@ -116,6 +118,13 @@ class BrowserFileSystemCallbackDispatcher } private: + BrowserFileSystemCallbackDispatcher( + const WeakPtr& file_system, + WebFileSystemCallbacks* callbacks) + : file_system_(file_system), + callbacks_(callbacks) { + } + WeakPtr file_system_; WebFileSystemCallbacks* callbacks_; }; @@ -133,15 +142,18 @@ void BrowserFileSystem::CreateContext() { return; if (file_system_dir_.CreateUniqueTempDir()) { + std::vector additional_allowed_schemes; + additional_allowed_schemes.push_back("file"); + file_system_context_ = new FileSystemContext( CefThread::GetMessageLoopProxyForThread(CefThread::FILE), CefThread::GetMessageLoopProxyForThread(CefThread::IO), NULL /* special storage policy */, NULL /* quota manager */, file_system_dir_.path(), - false /* incognito */, - true /* allow_file_access */, - NULL); + fileapi::FileSystemOptions( + fileapi::FileSystemOptions::PROFILE_MODE_NORMAL, + additional_allowed_schemes)); } else { LOG(WARNING) << "Failed to create a temp dir for the filesystem." "FileSystem feature will be disabled."; @@ -159,72 +171,74 @@ void BrowserFileSystem::OpenFileSystem( } fileapi::FileSystemType type; - if (web_filesystem_type == WebFileSystem::TypeTemporary) { + if (web_filesystem_type == WebFileSystem::TypeTemporary) type = fileapi::kFileSystemTypeTemporary; - } else if (web_filesystem_type == WebFileSystem::TypePersistent) { + else if (web_filesystem_type == WebFileSystem::TypePersistent) type = fileapi::kFileSystemTypePersistent; - } else if (web_filesystem_type == WebFileSystem::TypeExternal) { + else if (web_filesystem_type == WebFileSystem::TypeExternal) type = fileapi::kFileSystemTypeExternal; - } else { + else { // Unknown type filesystem is requested. callbacks->didFail(WebKit::WebFileErrorSecurity); return; } GURL origin_url(frame->document().securityOrigin().toString()); - GetNewOperation(callbacks)->OpenFileSystem(origin_url, type, create); + file_system_context_->OpenFileSystem( + origin_url, type, create, + BrowserFileSystemCallbackDispatcher::Create(AsWeakPtr(), callbacks)); } void BrowserFileSystem::move( const WebURL& src_path, const WebURL& dest_path, WebFileSystemCallbacks* callbacks) { - GetNewOperation(callbacks)->Move(GURL(src_path), GURL(dest_path)); + GetNewOperation(src_path, callbacks)->Move(GURL(src_path), GURL(dest_path)); } void BrowserFileSystem::copy( const WebURL& src_path, const WebURL& dest_path, WebFileSystemCallbacks* callbacks) { - GetNewOperation(callbacks)->Copy(GURL(src_path), GURL(dest_path)); + GetNewOperation(src_path, callbacks)->Copy(GURL(src_path), GURL(dest_path)); } void BrowserFileSystem::remove( const WebURL& path, WebFileSystemCallbacks* callbacks) { - GetNewOperation(callbacks)->Remove(path, false /* recursive */); + GetNewOperation(path, callbacks)->Remove(path, false /* recursive */); } void BrowserFileSystem::removeRecursively( const WebURL& path, WebFileSystemCallbacks* callbacks) { - GetNewOperation(callbacks)->Remove(path, true /* recursive */); + GetNewOperation(path, callbacks)->Remove(path, true /* recursive */); } void BrowserFileSystem::readMetadata( const WebURL& path, WebFileSystemCallbacks* callbacks) { - GetNewOperation(callbacks)->GetMetadata(path); + GetNewOperation(path, callbacks)->GetMetadata(path); } void BrowserFileSystem::createFile( const WebURL& path, bool exclusive, WebFileSystemCallbacks* callbacks) { - GetNewOperation(callbacks)->CreateFile(path, exclusive); + GetNewOperation(path, callbacks)->CreateFile(path, exclusive); } void BrowserFileSystem::createDirectory( const WebURL& path, bool exclusive, WebFileSystemCallbacks* callbacks) { - GetNewOperation(callbacks)->CreateDirectory(path, exclusive, false); + GetNewOperation(path, callbacks)->CreateDirectory(path, exclusive, false); } void BrowserFileSystem::fileExists( const WebURL& path, WebFileSystemCallbacks* callbacks) { - GetNewOperation(callbacks)->FileExists(path); + GetNewOperation(path, callbacks)->FileExists(path); } void BrowserFileSystem::directoryExists( const WebURL& path, WebFileSystemCallbacks* callbacks) { - GetNewOperation(callbacks)->DirectoryExists(path); + GetNewOperation(path, callbacks)->DirectoryExists(path); } void BrowserFileSystem::readDirectory( const WebURL& path, WebFileSystemCallbacks* callbacks) { - GetNewOperation(callbacks)->ReadDirectory(path); + GetNewOperation(path, callbacks)->ReadDirectory(path); } WebFileWriter* BrowserFileSystem::createFileWriter( @@ -232,12 +246,10 @@ WebFileWriter* BrowserFileSystem::createFileWriter( return new BrowserFileWriter(path, client, file_system_context_.get()); } -FileSystemOperation* BrowserFileSystem::GetNewOperation( - WebFileSystemCallbacks* callbacks) { - BrowserFileSystemCallbackDispatcher* dispatcher = - new BrowserFileSystemCallbackDispatcher(AsWeakPtr(), callbacks); - FileSystemOperation* operation = new FileSystemOperation( - dispatcher, base::MessageLoopProxy::current(), - file_system_context_.get()); - return operation; +FileSystemOperationInterface* BrowserFileSystem::GetNewOperation( + const WebURL& url, WebFileSystemCallbacks* callbacks) { + return file_system_context_->CreateFileSystemOperation( + GURL(url), + BrowserFileSystemCallbackDispatcher::Create(AsWeakPtr(), callbacks), + base::MessageLoopProxy::current()); } diff --git a/libcef/browser_file_system.h b/libcef/browser_file_system.h index 87e13812e..aec3d6f3f 100644 --- a/libcef/browser_file_system.h +++ b/libcef/browser_file_system.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -23,7 +23,7 @@ class WebURL; namespace fileapi { class FileSystemContext; -class FileSystemOperation; +class FileSystemOperationInterface; } class BrowserFileSystem @@ -85,8 +85,8 @@ class BrowserFileSystem private: // Helpers. - fileapi::FileSystemOperation* GetNewOperation( - WebKit::WebFileSystemCallbacks* callbacks); + fileapi::FileSystemOperationInterface* GetNewOperation( + const WebKit::WebURL& path, WebKit::WebFileSystemCallbacks* callbacks); // A temporary directory for FileSystem API. ScopedTempDir file_system_dir_; diff --git a/libcef/browser_file_writer.cc b/libcef/browser_file_writer.cc index c1d5a6c50..71cb35309 100644 --- a/libcef/browser_file_writer.cc +++ b/libcef/browser_file_writer.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -11,12 +11,12 @@ #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_operation.h" +#include "webkit/fileapi/file_system_operation_interface.h" #include "webkit/glue/webkit_glue.h" using fileapi::FileSystemCallbackDispatcher; using fileapi::FileSystemContext; -using fileapi::FileSystemOperation; +using fileapi::FileSystemOperationInterface; using fileapi::WebFileWriterBase; using WebKit::WebFileWriterClient; using WebKit::WebString; @@ -50,7 +50,7 @@ class BrowserFileWriter::IOThreadProxy return; } DCHECK(!operation_); - operation_ = GetNewOperation(); + operation_ = GetNewOperation(path); operation_->Truncate(path, offset); } @@ -63,7 +63,7 @@ class BrowserFileWriter::IOThreadProxy } DCHECK(request_context_); DCHECK(!operation_); - operation_ = GetNewOperation(); + operation_ = GetNewOperation(path); operation_->Write(request_context_, path, blob_url, offset); } @@ -78,14 +78,19 @@ class BrowserFileWriter::IOThreadProxy DidFail(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); return; } - operation_->Cancel(GetNewOperation()); + operation_->Cancel(CallbackDispatcher::Create(this)); } private: // Inner class to receive callbacks from FileSystemOperation. class CallbackDispatcher : public FileSystemCallbackDispatcher { public: - explicit CallbackDispatcher(IOThreadProxy* proxy) : proxy_(proxy) { + // An instance of this class must be created by Create() + // (so that we do not leak ownerships). + static scoped_ptr Create( + IOThreadProxy* proxy) { + return scoped_ptr( + new CallbackDispatcher(proxy)); } ~CallbackDispatcher() { @@ -122,13 +127,15 @@ class BrowserFileWriter::IOThreadProxy NOTREACHED(); } + private: + explicit CallbackDispatcher(IOThreadProxy* proxy) : proxy_(proxy) {} scoped_refptr proxy_; }; - FileSystemOperation* GetNewOperation() { + FileSystemOperationInterface* GetNewOperation(const GURL& path) { // The FileSystemOperation takes ownership of the CallbackDispatcher. - return new FileSystemOperation(new CallbackDispatcher(this), - io_thread_, file_system_context_.get()); + return file_system_context_->CreateFileSystemOperation( + path, CallbackDispatcher::Create(this), io_thread_); } void DidSucceed() { @@ -176,7 +183,7 @@ class BrowserFileWriter::IOThreadProxy base::WeakPtr simple_writer_; // Only used on the io thread. - FileSystemOperation* operation_; + FileSystemOperationInterface* operation_; scoped_refptr file_system_context_; }; diff --git a/libcef/browser_file_writer.h b/libcef/browser_file_writer.h index 99c020727..869301430 100644 --- a/libcef/browser_file_writer.h +++ b/libcef/browser_file_writer.h @@ -20,7 +20,7 @@ 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 GURL& path, @@ -38,10 +38,10 @@ class BrowserFileWriter : public fileapi::WebFileWriterBase, protected: // WebFileWriterBase overrides - virtual void DoTruncate(const GURL& path, int64 offset); + virtual void DoTruncate(const GURL& path, int64 offset) OVERRIDE; virtual void DoWrite(const GURL& path, const GURL& blob_url, - int64 offset); - virtual void DoCancel(); + int64 offset) OVERRIDE; + virtual void DoCancel() OVERRIDE; private: class IOThreadProxy; diff --git a/libcef/browser_impl.cc b/libcef/browser_impl.cc index 5dedb879f..06330ee0a 100644 --- a/libcef/browser_impl.cc +++ b/libcef/browser_impl.cc @@ -13,6 +13,7 @@ #include "libcef/stream_impl.h" #include "libcef/v8_impl.h" +#include "base/bind.h" #include "base/file_path.h" #include "base/path_service.h" #include "base/stringprintf.h" @@ -116,8 +117,8 @@ bool CefBrowser::CreateBrowser(CefWindowInfo& windowInfo, // Create the browser on the UI thread. CreateBrowserHelper* helper = new CreateBrowserHelper(windowInfo, client, url, settings); - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableFunction( - UIT_CreateBrowserWithHelper, helper)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(UIT_CreateBrowserWithHelper, helper)); return true; } @@ -187,41 +188,46 @@ CefBrowserImpl::CefBrowserImpl(const CefWindowInfo& windowInfo, } void CefBrowserImpl::CloseBrowser() { - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_CloseBrowser)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_CloseBrowser, this)); } void CefBrowserImpl::GoBack() { - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_HandleActionView, MENU_ID_NAV_BACK)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_HandleActionView, this, + MENU_ID_NAV_BACK)); } void CefBrowserImpl::GoForward() { - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_HandleActionView, MENU_ID_NAV_FORWARD)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_HandleActionView, this, + MENU_ID_NAV_FORWARD)); } void CefBrowserImpl::Reload() { - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_HandleActionView, MENU_ID_NAV_RELOAD)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_HandleActionView, this, + MENU_ID_NAV_RELOAD)); } void CefBrowserImpl::ReloadIgnoreCache() { - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_HandleActionView, MENU_ID_NAV_RELOAD_NOCACHE)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_HandleActionView, this, + MENU_ID_NAV_RELOAD_NOCACHE)); } void CefBrowserImpl::StopLoad() { - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_HandleActionView, MENU_ID_NAV_STOP)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_HandleActionView, this, + MENU_ID_NAV_STOP)); } void CefBrowserImpl::SetFocus(bool enable) { if (CefThread::CurrentlyOn(CefThread::UI)) { UIT_SetFocus(UIT_GetWebViewHost(), enable); } else { - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::SetFocus, enable)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::SetFocus, this, enable)); } } @@ -283,19 +289,20 @@ void CefBrowserImpl::Find(int identifier, const CefString& searchText, options.findNext = findNext; // Execute the request on the UI thread. - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_Find, identifier, searchText, options)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_Find, this, identifier, searchText, + options)); } void CefBrowserImpl::StopFinding(bool clearSelection) { // Execute the request on the UI thread. - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_StopFinding, clearSelection)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_StopFinding, this, clearSelection)); } void CefBrowserImpl::SetZoomLevel(double zoomLevel) { - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_SetZoomLevel, zoomLevel)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_SetZoomLevel, this, zoomLevel)); } void CefBrowserImpl::ClearHistory() { @@ -315,19 +322,19 @@ void CefBrowserImpl::ClearHistory() { } } } else { - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::ClearHistory)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::ClearHistory, this)); } } void CefBrowserImpl::ShowDevTools() { - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_ShowDevTools)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_ShowDevTools, this)); } void CefBrowserImpl::CloseDevTools() { - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_CloseDevTools)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_CloseDevTools, this)); } bool CefBrowserImpl::GetSize(PaintElementType type, int& width, int& height) { @@ -357,8 +364,8 @@ bool CefBrowserImpl::GetSize(PaintElementType type, int& width, int& height) { void CefBrowserImpl::SetSize(PaintElementType type, int width, int height) { // Intentially post event tasks in all cases so that painting tasks can be // handled at sane times. - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_SetSize, type, width, height)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_SetSize, this, type, width, height)); } bool CefBrowserImpl::IsPopupVisible() { @@ -373,15 +380,15 @@ bool CefBrowserImpl::IsPopupVisible() { void CefBrowserImpl::HidePopup() { // Intentially post event tasks in all cases so that painting tasks can be // handled at sane times. - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_ClosePopupWidget)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_ClosePopupWidget, this)); } void CefBrowserImpl::Invalidate(const CefRect& dirtyRect) { // Intentially post event tasks in all cases so that painting tasks can be // handled at sane times. - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_Invalidate, dirtyRect)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_Invalidate, this, dirtyRect)); } bool CefBrowserImpl::GetImage(PaintElementType type, int width, int height, @@ -407,92 +414,98 @@ void CefBrowserImpl::SendKeyEvent(KeyType type, int key, int modifiers, bool sysChar, bool imeChar) { // Intentially post event tasks in all cases so that painting tasks can be // handled at sane times. - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_SendKeyEvent, type, key, modifiers, sysChar, - imeChar)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_SendKeyEvent, this, type, key, modifiers, + sysChar, imeChar)); } void CefBrowserImpl::SendMouseClickEvent(int x, int y, MouseButtonType type, bool mouseUp, int clickCount) { // Intentially post event tasks in all cases so that painting tasks can be // handled at sane times. - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_SendMouseClickEvent, x, y, type, mouseUp, - clickCount)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_SendMouseClickEvent, this, x, y, type, + mouseUp, clickCount)); } void CefBrowserImpl::SendMouseMoveEvent(int x, int y, bool mouseLeave) { // Intentially post event tasks in all cases so that painting tasks can be // handled at sane times. - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_SendMouseMoveEvent, x, y, mouseLeave)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_SendMouseMoveEvent, this, x, y, + mouseLeave)); } void CefBrowserImpl::SendMouseWheelEvent(int x, int y, int delta) { // Intentially post event tasks in all cases so that painting tasks can be // handled at sane times. - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_SendMouseWheelEvent, x, y, delta)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_SendMouseWheelEvent, this, x, y, delta)); } void CefBrowserImpl::SendFocusEvent(bool setFocus) { // Intentially post event tasks in all cases so that painting tasks can be // handled at sane times. - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_SendFocusEvent, setFocus)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_SendFocusEvent, this, setFocus)); } void CefBrowserImpl::SendCaptureLostEvent() { // Intentially post event tasks in all cases so that painting tasks can be // handled at sane times. - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_SendCaptureLostEvent)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_SendCaptureLostEvent, this)); } void CefBrowserImpl::Undo(CefRefPtr frame) { - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_HandleAction, MENU_ID_UNDO, frame)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_HandleAction, this, MENU_ID_UNDO, frame)); } void CefBrowserImpl::Redo(CefRefPtr frame) { - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_HandleAction, MENU_ID_REDO, frame)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_HandleAction, this, MENU_ID_REDO, frame)); } void CefBrowserImpl::Cut(CefRefPtr frame) { - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_HandleAction, MENU_ID_CUT, frame)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_HandleAction, this, MENU_ID_CUT, frame)); } void CefBrowserImpl::Copy(CefRefPtr frame) { - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_HandleAction, MENU_ID_COPY, frame)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_HandleAction, this, MENU_ID_COPY, frame)); } void CefBrowserImpl::Paste(CefRefPtr frame) { - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_HandleAction, MENU_ID_PASTE, frame)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_HandleAction, this, MENU_ID_PASTE, + frame)); } void CefBrowserImpl::Delete(CefRefPtr frame) { - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_HandleAction, MENU_ID_DELETE, frame)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_HandleAction, this, MENU_ID_DELETE, + frame)); } void CefBrowserImpl::SelectAll(CefRefPtr frame) { - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_HandleAction, MENU_ID_SELECTALL, frame)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_HandleAction, this, MENU_ID_SELECTALL, + frame)); } void CefBrowserImpl::Print(CefRefPtr frame) { - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_HandleAction, MENU_ID_PRINT, frame)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_HandleAction, this, MENU_ID_PRINT, + frame)); } void CefBrowserImpl::ViewSource(CefRefPtr frame) { - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_HandleAction, MENU_ID_VIEWSOURCE, frame)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_HandleAction, this, MENU_ID_VIEWSOURCE, + frame)); } CefString CefBrowserImpl::GetSource(CefRefPtr frame) { @@ -526,38 +539,40 @@ CefString CefBrowserImpl::GetText(CefRefPtr frame) { void CefBrowserImpl::LoadRequest(CefRefPtr frame, CefRefPtr request) { DCHECK(request.get() != NULL); - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_LoadURLForRequestRef, frame, request)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_LoadURLForRequestRef, this, frame, + request)); } void CefBrowserImpl::LoadURL(CefRefPtr frame, const CefString& url) { - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_LoadURL, frame, url)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_LoadURL, this, frame, url)); } void CefBrowserImpl::LoadString(CefRefPtr frame, const CefString& string, const CefString& url) { - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_LoadHTML, frame, string, url)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_LoadHTML, this, frame, string, url)); } void CefBrowserImpl::LoadStream(CefRefPtr frame, CefRefPtr stream, const CefString& url) { DCHECK(stream.get() != NULL); - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_LoadHTMLForStreamRef, frame, stream, url)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_LoadHTMLForStreamRef, this, frame, stream, + url)); } void CefBrowserImpl::ExecuteJavaScript(CefRefPtr frame, const CefString& jsCode, const CefString& scriptUrl, int startLine) { - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this, - &CefBrowserImpl::UIT_ExecuteJavaScript, frame, jsCode, scriptUrl, - startLine)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_ExecuteJavaScript, this, frame, jsCode, + scriptUrl, startLine)); } int64 CefBrowserImpl::GetIdentifier(CefRefPtr frame) { @@ -1565,8 +1580,9 @@ void CefFrameImpl::VisitDOM(CefRefPtr visitor) { return; } CefRefPtr framePtr(this); - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod( - browser_.get(), &CefBrowserImpl::UIT_VisitDOM, framePtr, visitor)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&CefBrowserImpl::UIT_VisitDOM, browser_.get(), framePtr, + visitor)); } CefRefPtr CefFrameImpl::GetV8Context() { diff --git a/libcef/browser_resource_loader_bridge.cc b/libcef/browser_resource_loader_bridge.cc index a3111c5d1..b191950d1 100644 --- a/libcef/browser_resource_loader_bridge.cc +++ b/libcef/browser_resource_loader_bridge.cc @@ -777,7 +777,7 @@ class RequestProxy : public net::URLRequest::Delegate, virtual void OnSSLCertificateError(net::URLRequest* request, const net::SSLInfo& ssl_info, - bool is_hsts_host) OVERRIDE { + bool fatal) OVERRIDE { // Allow all certificate errors. request->ContinueDespiteLastError(); } diff --git a/libcef/browser_settings.cc b/libcef/browser_settings.cc index 1dcd7a05b..49641116f 100644 --- a/libcef/browser_settings.cc +++ b/libcef/browser_settings.cc @@ -127,6 +127,7 @@ void BrowserToWebSettings(const CefBrowserSettings& cef, WebPreferences& web) { web.accelerated_compositing_enabled = cef.accelerated_compositing_enabled; web.threaded_compositing_enabled = cef.threaded_compositing_enabled; web.accelerated_layers_enabled = !cef.accelerated_layers_disabled; + web.accelerated_animation_enabled = !cef.accelerated_layers_disabled; web.accelerated_video_enabled = !cef.accelerated_video_disabled; web.accelerated_2d_canvas_enabled = !cef.accelerated_2d_canvas_disabled; web.accelerated_painting_enabled = !cef.accelerated_painting_disabled; diff --git a/libcef/browser_webview_delegate.cc b/libcef/browser_webview_delegate.cc index 1eb1704b1..3edb1a1bb 100644 --- a/libcef/browser_webview_delegate.cc +++ b/libcef/browser_webview_delegate.cc @@ -69,7 +69,6 @@ #include "webkit/glue/weburlrequest_extradata_impl.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/window_open_disposition.h" -#include "webkit/media/video_renderer_impl.h" #include "webkit/media/webmediaplayer_impl.h" #include "webkit/plugins/npapi/plugin_list.h" #include "webkit/plugins/npapi/webplugin_delegate_impl.h" @@ -665,17 +664,15 @@ WebMediaPlayer* BrowserWebViewDelegate::createMediaPlayer( collection->AddAudioRenderer(new media::ReferenceAudioRenderer( _Context->process()->ui_thread()->audio_manager())); - scoped_ptr result( - new webkit_media::WebMediaPlayerImpl( - client, - base::WeakPtr(), - collection.release(), - message_loop_factory.release(), - NULL, - new media::MediaLog())); - if (!result->Initialize(frame, false)) - return NULL; - return result.release(); + return new webkit_media::WebMediaPlayerImpl( + frame, + client, + base::WeakPtr(), + collection.release(), + NULL, + message_loop_factory.release(), + NULL, + new media::MediaLog()); } WebApplicationCacheHost* BrowserWebViewDelegate::createApplicationCacheHost( diff --git a/libcef/cef_context.cc b/libcef/cef_context.cc index 289c1c256..2af49b29b 100644 --- a/libcef/cef_context.cc +++ b/libcef/cef_context.cc @@ -204,8 +204,8 @@ void CefContext::Shutdown() { // Finish shutdown on the UI thread. CefThread::PostTask(CefThread::UI, FROM_HERE, - NewRunnableMethod(this, &CefContext::UIT_FinishShutdown, - &browser_shutdown_event, &uithread_shutdown_event)); + base::Bind(&CefContext::UIT_FinishShutdown, this, + &browser_shutdown_event, &uithread_shutdown_event)); // Block until browser shutdown is complete. browser_shutdown_event.Wait(); @@ -273,7 +273,7 @@ bool CefContext::RemoveBrowser(CefRefPtr browser) { webkit_glue::ClearCache(); } else { CefThread::PostTask(CefThread::UI, FROM_HERE, - NewRunnableFunction(webkit_glue::ClearCache)); + base::Bind(webkit_glue::ClearCache)); } } @@ -318,7 +318,7 @@ void CefContext::InitializeResourceBundle() { std::string locale_str = locale(); const std::string loaded_locale = - ui::ResourceBundle::InitSharedInstance(locale_str); + ui::ResourceBundle::InitSharedInstanceWithLocale(locale_str); CHECK(!loaded_locale.empty()) << "Locale could not be found for " << locale_str; diff --git a/libcef/cef_thread.cc b/libcef/cef_thread.cc index 628aac792..f3fb610c5 100644 --- a/libcef/cef_thread.cc +++ b/libcef/cef_thread.cc @@ -31,29 +31,6 @@ class CefThreadMessageLoopProxy : public MessageLoopProxy { } // MessageLoopProxy implementation. - virtual bool PostTask(const tracked_objects::Location& from_here, - Task* task) OVERRIDE { - return CefThread::PostTask(id_, from_here, task); - } - - virtual bool PostDelayedTask(const tracked_objects::Location& from_here, - Task* task, int64 delay_ms) OVERRIDE { - return CefThread::PostDelayedTask(id_, from_here, task, delay_ms); - } - - virtual bool PostNonNestableTask(const tracked_objects::Location& from_here, - Task* task) OVERRIDE { - return CefThread::PostNonNestableTask(id_, from_here, task); - } - - virtual bool PostNonNestableDelayedTask( - const tracked_objects::Location& from_here, - Task* task, - int64 delay_ms) OVERRIDE { - return CefThread::PostNonNestableDelayedTask(id_, from_here, task, - delay_ms); - } - virtual bool PostTask(const tracked_objects::Location& from_here, const base::Closure& task) OVERRIDE { return CefThread::PostTask(id_, from_here, task); @@ -168,38 +145,6 @@ bool CefThread::CurrentlyOn(ID identifier) { cef_threads_[identifier]->message_loop() == MessageLoop::current(); } -// static -bool CefThread::PostTask(ID identifier, - const tracked_objects::Location& from_here, - Task* task) { - return PostTaskHelper(identifier, from_here, task, 0, true); -} - -// static -bool CefThread::PostDelayedTask(ID identifier, - const tracked_objects::Location& from_here, - Task* task, - int64 delay_ms) { - return PostTaskHelper(identifier, from_here, task, delay_ms, true); -} - -// static -bool CefThread::PostNonNestableTask( - ID identifier, - const tracked_objects::Location& from_here, - Task* task) { - return PostTaskHelper(identifier, from_here, task, 0, false); -} - -// static -bool CefThread::PostNonNestableDelayedTask( - ID identifier, - const tracked_objects::Location& from_here, - Task* task, - int64 delay_ms) { - return PostTaskHelper(identifier, from_here, task, delay_ms, false); -} - // static bool CefThread::PostTask(ID identifier, const tracked_objects::Location& from_here, @@ -254,47 +199,6 @@ scoped_refptr CefThread::GetMessageLoopProxyForThread( return proxy; } -// static -bool CefThread::PostTaskHelper( - ID identifier, - const tracked_objects::Location& from_here, - Task* task, - int64 delay_ms, - bool nestable) { - DCHECK(identifier >= 0 && identifier < ID_COUNT); - // Optimization: to avoid unnecessary locks, we listed the ID enumeration in - // order of lifetime. So no need to lock if we know that the other thread - // outlives this one. - // Note: since the array is so small, ok to loop instead of creating a map, - // which would require a lock because std::map isn't thread safe, defeating - // the whole purpose of this optimization. - ID current_thread; - bool guaranteed_to_outlive_target_thread = - GetCurrentThreadIdentifier(¤t_thread) && - current_thread >= identifier; - - if (!guaranteed_to_outlive_target_thread) - lock_.Acquire(); - - MessageLoop* message_loop = cef_threads_[identifier] ? - cef_threads_[identifier]->message_loop() : NULL; - if (message_loop) { - if (nestable) { - message_loop->PostDelayedTask(from_here, task, delay_ms); - } else { - message_loop->PostNonNestableDelayedTask(from_here, task, delay_ms); - } - } else { - delete task; - } - - if (!guaranteed_to_outlive_target_thread) - lock_.Release(); - - return !!message_loop; -} - - // static bool CefThread::PostTaskHelper( ID identifier, diff --git a/libcef/cef_thread.h b/libcef/cef_thread.h index 6c932541f..2e1ec9756 100644 --- a/libcef/cef_thread.h +++ b/libcef/cef_thread.h @@ -9,7 +9,6 @@ #include "base/memory/scoped_ptr.h" #include "base/synchronization/lock.h" -#include "base/task.h" #include "base/threading/thread.h" #if defined(OS_MACOSX) @@ -71,37 +70,11 @@ class CefThread : public base::Thread { virtual ~CefThread(); - // These methods are the same as in message_loop.h, but are guaranteed to - // either post the Task to the MessageLoop (if it's still alive), or to - // delete the Task otherwise. - // They return true if the thread existed and the task was posted. Note that - // even if the task is posted, there's no guarantee that it will run; for - // example the target loop may already be quitting, or in the case of a - // delayed task a Quit message may preempt it in the message loop queue. - // Conversely, a return value of false is a guarantee the task will not run. - static bool PostTask(ID identifier, - const tracked_objects::Location& from_here, - Task* task); - static bool PostDelayedTask(ID identifier, - const tracked_objects::Location& from_here, - Task* task, - int64 delay_ms); - static bool PostNonNestableTask(ID identifier, - const tracked_objects::Location& from_here, - Task* task); - static bool PostNonNestableDelayedTask( - ID identifier, - const tracked_objects::Location& from_here, - Task* task, - int64 delay_ms); - - // TODO(ajwong): Remove the functions above once the Task -> Closure migration - // is complete. - // - // There are 2 sets of Post*Task functions, one which takes the older Task* - // function object representation, and one that takes the newer base::Closure. - // We have this overload to allow a staged transition between the two systems. - // Once the transition is done, the functions above should be deleted. + // These are the same methods in message_loop.h, but are guaranteed to either + // get posted to the MessageLoop if it's still alive, or be deleted otherwise. + // They return true iff the thread existed and the task was posted. Note that + // even if the task is posted, there's no guarantee that it will run, since + // the target thread may already have a Quit message in its queue. static bool PostTask(ID identifier, const tracked_objects::Location& from_here, const base::Closure& task); @@ -121,17 +94,17 @@ class CefThread : public base::Thread { template static bool DeleteSoon(ID identifier, const tracked_objects::Location& from_here, - T* object) { - return PostNonNestableTask( - identifier, from_here, new DeleteTask(object)); + const T* object) { + return GetMessageLoopProxyForThread(identifier)->DeleteSoon( + from_here, object); } template static bool ReleaseSoon(ID identifier, const tracked_objects::Location& from_here, - T* object) { - return PostNonNestableTask( - identifier, from_here, new ReleaseTask(object)); + const T* object) { + return GetMessageLoopProxyForThread(identifier)->ReleaseSoon( + from_here, object); } // Callable on any thread. Returns whether the given ID corresponds to a well @@ -193,13 +166,6 @@ class CefThread : public base::Thread { // Common initialization code for the constructors. void Initialize(); - static bool PostTaskHelper( - ID identifier, - const tracked_objects::Location& from_here, - Task* task, - int64 delay_ms, - bool nestable); - static bool PostTaskHelper( ID identifier, const tracked_objects::Location& from_here, diff --git a/libcef/cookie_impl.cc b/libcef/cookie_impl.cc index 1ff22257a..a420285a4 100644 --- a/libcef/cookie_impl.cc +++ b/libcef/cookie_impl.cc @@ -7,6 +7,7 @@ #include "libcef/cef_thread.h" #include "libcef/cef_time_util.h" +#include "base/bind.h" #include "net/base/cookie_monster.h" namespace { @@ -115,7 +116,7 @@ bool CefVisitAllCookies(CefRefPtr visitor) { } return CefThread::PostTask(CefThread::IO, FROM_HERE, - NewRunnableFunction(IOT_VisitAllCookies, visitor)); + base::Bind(IOT_VisitAllCookies, visitor)); } bool CefVisitUrlCookies(const CefString& url, bool includeHttpOnly, @@ -132,7 +133,7 @@ bool CefVisitUrlCookies(const CefString& url, bool includeHttpOnly, return false; return CefThread::PostTask(CefThread::IO, FROM_HERE, - NewRunnableFunction(IOT_VisitUrlCookies, gurl, includeHttpOnly, visitor)); + base::Bind(IOT_VisitUrlCookies, gurl, includeHttpOnly, visitor)); } bool CefSetCookie(const CefString& url, const CefCookie& cookie) { diff --git a/libcef/dom_storage_area.cc b/libcef/dom_storage_area.cc index f4b528854..33fd438a3 100644 --- a/libcef/dom_storage_area.cc +++ b/libcef/dom_storage_area.cc @@ -6,7 +6,7 @@ #include "libcef/dom_storage_context.h" #include "libcef/dom_storage_namespace.h" -#include "base/task.h" +#include "base/logging.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageArea.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" diff --git a/libcef/dom_storage_area.h b/libcef/dom_storage_area.h index b49a0d131..797ad4fa1 100644 --- a/libcef/dom_storage_area.h +++ b/libcef/dom_storage_area.h @@ -60,7 +60,12 @@ class DOMStorageArea { }; #if defined(COMPILER_GCC) +#if defined(OS_ANDROID) +// Android stlport uses std namespace +namespace std { +#else namespace __gnu_cxx { +#endif template<> struct hash { diff --git a/libcef/drag_download_file.cc b/libcef/drag_download_file.cc index c09d232a0..5e979a8f9 100644 --- a/libcef/drag_download_file.cc +++ b/libcef/drag_download_file.cc @@ -7,6 +7,7 @@ #include "libcef/browser_impl.h" #include "libcef/cef_thread.h" +#include "base/bind.h" #include "base/file_util.h" #include "base/message_loop.h" #include "net/base/file_stream.h" @@ -91,8 +92,7 @@ void DragDownloadFile::InitiateDownload() { if (!CefThread::CurrentlyOn(CefThread::UI)) { CefThread::PostTask( CefThread::UI, FROM_HERE, - NewRunnableMethod(this, - &DragDownloadFile::InitiateDownload)); + base::Bind(&DragDownloadFile::InitiateDownload, this)); return; } #endif @@ -111,9 +111,7 @@ void DragDownloadFile::DownloadCompleted(bool is_successful) { if (drag_message_loop_ != MessageLoop::current()) { drag_message_loop_->PostTask( FROM_HERE, - NewRunnableMethod(this, - &DragDownloadFile::DownloadCompleted, - is_successful)); + base::Bind(&DragDownloadFile::DownloadCompleted, this, is_successful)); return; } #endif diff --git a/libcef/drag_download_util.cc b/libcef/drag_download_util.cc index 66534e233..7f3a376bb 100644 --- a/libcef/drag_download_util.cc +++ b/libcef/drag_download_util.cc @@ -5,11 +5,11 @@ #include "libcef/cef_thread.h" #include "libcef/drag_download_util.h" +#include "base/bind.h" #include "base/string_util.h" #include "base/file_path.h" #include "base/file_util.h" #include "base/memory/scoped_ptr.h" -#include "base/task.h" #include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "googleurl/src/gurl.h" @@ -101,13 +101,13 @@ void PromiseFileFinalizer::Cleanup() { void PromiseFileFinalizer::OnDownloadCompleted(const FilePath& file_path) { CefThread::PostTask( CefThread::UI, FROM_HERE, - NewRunnableMethod(this, &PromiseFileFinalizer::Cleanup)); + base::Bind(&PromiseFileFinalizer::Cleanup, this)); } void PromiseFileFinalizer::OnDownloadAborted() { CefThread::PostTask( CefThread::UI, FROM_HERE, - NewRunnableMethod(this, &PromiseFileFinalizer::Cleanup)); + base::Bind(&PromiseFileFinalizer::Cleanup, this)); } } // namespace drag_download_util diff --git a/libcef/nplugin_impl.cc b/libcef/nplugin_impl.cc index 86bad53bf..326e20089 100644 --- a/libcef/nplugin_impl.cc +++ b/libcef/nplugin_impl.cc @@ -6,6 +6,7 @@ #include "libcef/cef_context.h" #include "libcef/cef_thread.h" +#include "base/bind.h" #include "base/string_split.h" #include "base/utf_string_conversions.h" #include "webkit/plugins/npapi/plugin_list.h" @@ -56,8 +57,8 @@ void UIT_RegisterPlugin(CefPluginInfo* plugin_info) { entry_points.np_initialize = plugin_info->np_initialize; entry_points.np_shutdown = plugin_info->np_shutdown; - webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin( - info, entry_points, true); + webkit::npapi::PluginList::Singleton()->RegisterInternalPluginWithEntryPoints( + info, true, entry_points); delete plugin_info; } @@ -72,7 +73,7 @@ bool CefRegisterPlugin(const CefPluginInfo& plugin_info) { } CefThread::PostTask(CefThread::UI, FROM_HERE, - NewRunnableFunction(UIT_RegisterPlugin, new CefPluginInfo(plugin_info))); + base::Bind(UIT_RegisterPlugin, new CefPluginInfo(plugin_info))); return true; } diff --git a/libcef/origin_whitelist_impl.cc b/libcef/origin_whitelist_impl.cc index c31a72d08..548a09d72 100644 --- a/libcef/origin_whitelist_impl.cc +++ b/libcef/origin_whitelist_impl.cc @@ -6,6 +6,7 @@ #include "libcef/cef_context.h" #include "libcef/cef_thread.h" +#include "base/bind.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" @@ -40,9 +41,9 @@ bool CefAddCrossOriginWhitelistEntry(const CefString& source_origin, allow_target_subdomains); } else { CefThread::PostTask(CefThread::UI, FROM_HERE, - NewRunnableFunction(&CefAddCrossOriginWhitelistEntry, source_origin, - target_protocol, target_domain, - allow_target_subdomains)); + base::Bind(base::IgnoreResult(&CefAddCrossOriginWhitelistEntry), + source_origin, target_protocol, target_domain, + allow_target_subdomains)); } return true; @@ -75,9 +76,9 @@ bool CefRemoveCrossOriginWhitelistEntry(const CefString& source_origin, allow_target_subdomains); } else { CefThread::PostTask(CefThread::UI, FROM_HERE, - NewRunnableFunction(&CefRemoveCrossOriginWhitelistEntry, source_origin, - target_protocol, target_domain, - allow_target_subdomains)); + base::Bind(base::IgnoreResult(&CefRemoveCrossOriginWhitelistEntry), + source_origin, target_protocol, target_domain, + allow_target_subdomains)); } return true; @@ -94,7 +95,7 @@ bool CefClearCrossOriginWhitelist() { WebSecurityPolicy::resetOriginAccessWhitelists(); } else { CefThread::PostTask(CefThread::UI, FROM_HERE, - NewRunnableFunction(&CefClearCrossOriginWhitelist)); + base::Bind(base::IgnoreResult(&CefClearCrossOriginWhitelist))); } return true; diff --git a/libcef/scheme_impl.cc b/libcef/scheme_impl.cc index b22c3df92..2711c4045 100644 --- a/libcef/scheme_impl.cc +++ b/libcef/scheme_impl.cc @@ -14,6 +14,7 @@ #include "libcef/request_impl.h" #include "libcef/response_impl.h" +#include "base/bind.h" #include "base/lazy_instance.h" #include "base/logging.h" #include "base/message_loop.h" @@ -285,7 +286,7 @@ class CefUrlRequestJob : public net::URLRequestJob { } else { // Execute this method on the IO thread. CefThread::PostTask(CefThread::IO, FROM_HERE, - NewRunnableMethod(this, &Callback::HeadersAvailable)); + base::Bind(&Callback::HeadersAvailable, this)); } } @@ -315,7 +316,7 @@ class CefUrlRequestJob : public net::URLRequestJob { } else { // Execute this method on the IO thread. CefThread::PostTask(CefThread::IO, FROM_HERE, - NewRunnableMethod(this, &Callback::BytesAvailable)); + base::Bind(&Callback::BytesAvailable, this)); } } @@ -327,7 +328,7 @@ class CefUrlRequestJob : public net::URLRequestJob { } else { // Execute this method on the IO thread. CefThread::PostTask(CefThread::IO, FROM_HERE, - NewRunnableMethod(this, &Callback::Cancel)); + base::Bind(&Callback::Cancel, this)); } } @@ -604,8 +605,8 @@ bool CefRegisterCustomScheme(const CefString& scheme_name, } CefThread::PostTask(CefThread::UI, FROM_HERE, - NewRunnableFunction(&CefRegisterCustomScheme, scheme_name, is_standard, - is_local, is_display_isolated)); + base::Bind(base::IgnoreResult(&CefRegisterCustomScheme), scheme_name, + is_standard, is_local, is_display_isolated)); return true; } } @@ -626,8 +627,8 @@ bool CefRegisterSchemeHandlerFactory( factory); } else { CefThread::PostTask(CefThread::IO, FROM_HERE, - NewRunnableFunction(&CefRegisterSchemeHandlerFactory, scheme_name, - domain_name, factory)); + base::Bind(base::IgnoreResult(&CefRegisterSchemeHandlerFactory), + scheme_name, domain_name, factory)); return true; } } @@ -646,7 +647,7 @@ bool CefClearSchemeHandlerFactories() { RegisterDevToolsSchemeHandler(false); } else { CefThread::PostTask(CefThread::IO, FROM_HERE, - NewRunnableFunction(&CefClearSchemeHandlerFactories)); + base::Bind(base::IgnoreResult(&CefClearSchemeHandlerFactories))); } return true; diff --git a/libcef/task_impl.cc b/libcef/task_impl.cc index a8cd804f0..bce6348a4 100644 --- a/libcef/task_impl.cc +++ b/libcef/task_impl.cc @@ -4,6 +4,7 @@ #include "include/cef_task.h" #include "libcef/cef_thread.h" +#include "base/bind.h" namespace { @@ -27,24 +28,13 @@ bool CefCurrentlyOn(CefThreadId threadId) { return CefThread::CurrentlyOn(static_cast(id)); } -class CefTaskHelper : public Task { - public: - CefTaskHelper(CefRefPtr task, CefThreadId threadId) - : task_(task), thread_id_(threadId) {} - virtual void Run() { task_->Execute(thread_id_); } - private: - CefRefPtr task_; - CefThreadId thread_id_; - DISALLOW_COPY_AND_ASSIGN(CefTaskHelper); -}; - bool CefPostTask(CefThreadId threadId, CefRefPtr task) { int id = GetThreadId(threadId); if (id < 0) return false; return CefThread::PostTask(static_cast(id), FROM_HERE, - new CefTaskHelper(task, threadId)); + base::Bind(&CefTask::Execute, task, threadId)); } bool CefPostDelayedTask(CefThreadId threadId, CefRefPtr task, @@ -54,5 +44,5 @@ bool CefPostDelayedTask(CefThreadId threadId, CefRefPtr task, return false; return CefThread::PostDelayedTask(static_cast(id), FROM_HERE, - new CefTaskHelper(task, threadId), delay_ms); + base::Bind(&CefTask::Execute, task, threadId), delay_ms); } diff --git a/libcef/v8_impl.cc b/libcef/v8_impl.cc index d43c4914b..3720d8889 100644 --- a/libcef/v8_impl.cc +++ b/libcef/v8_impl.cc @@ -9,6 +9,8 @@ #include "libcef/browser_impl.h" #include "libcef/cef_context.h" #include "libcef/tracker.h" + +#include "base/bind.h" #include "base/lazy_instance.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" @@ -345,8 +347,8 @@ bool CefRegisterExtension(const CefString& extension_name, ExtensionWrapper* wrapper = new ExtensionWrapper(name->GetString(), code->GetString(), handler.get()); - CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(wrapper, - &ExtensionWrapper::UIT_RegisterExtension)); + CefThread::PostTask(CefThread::UI, FROM_HERE, + base::Bind(&ExtensionWrapper::UIT_RegisterExtension, wrapper)); return true; } diff --git a/libcef/web_drag_source_mac.mm b/libcef/web_drag_source_mac.mm index d98e22453..1d70cb2f2 100644 --- a/libcef/web_drag_source_mac.mm +++ b/libcef/web_drag_source_mac.mm @@ -15,7 +15,6 @@ #include "base/file_path.h" #include "base/string_util.h" #include "base/sys_string_conversions.h" -#include "base/task.h" #include "base/threading/thread.h" #include "base/threading/thread_restrictions.h" #include "base/utf_string_conversions.h" @@ -74,45 +73,17 @@ FilePath GetFileNameFromDragData(const WebDropData& drop_data) { return file_name; } -// This class's sole task is to write out data for a promised file; the caller -// is responsible for opening the file. -class PromiseWriterTask : public Task { - public: - // Assumes ownership of file_stream. - PromiseWriterTask(const WebDropData& drop_data, - FileStream* file_stream); - virtual ~PromiseWriterTask(); - virtual void Run(); +// This helper's sole task is to write out data for a promised file; the caller +// is responsible for opening the file. It takes the drop data and an open file +// stream. +void PromiseWriterHelper(const WebDropData& drop_data, + net::FileStream* file_stream) { + DCHECK(file_stream); + file_stream->Write(drop_data.file_contents.data(), + drop_data.file_contents.length(), + net::CompletionCallback()); - private: - WebDropData drop_data_; - - // This class takes ownership of file_stream_ and will close and delete it. - scoped_ptr file_stream_; -}; - -// Takes the drop data and an open file stream (which it takes ownership of and -// will close and delete). -PromiseWriterTask::PromiseWriterTask(const WebDropData& drop_data, - FileStream* file_stream) : - drop_data_(drop_data) { - file_stream_.reset(file_stream); - DCHECK(file_stream_.get()); -} - -PromiseWriterTask::~PromiseWriterTask() { - DCHECK(file_stream_.get()); - if (file_stream_.get()) - file_stream_->Close(); -} - -void PromiseWriterTask::Run() { - CHECK(file_stream_.get()); - file_stream_->Write(drop_data_.file_contents.data(), - drop_data_.file_contents.length(), - net::CompletionCallback()); - - // Let our destructor take care of business. + file_stream->Close(); } } // namespace @@ -368,7 +339,7 @@ void PromiseWriterTask::Run() { } else { // The writer will take care of closing and deletion. CefThread::PostTask(CefThread::FILE, FROM_HERE, - new PromiseWriterTask(*dropData_, fileStream)); + base::Bind(PromiseWriterHelper, *dropData_, base::Owned(fileStream))); } // Once we've created the file, we should return the file name. diff --git a/libcef/web_drag_source_win.cc b/libcef/web_drag_source_win.cc index 660902264..af307c978 100644 --- a/libcef/web_drag_source_win.cc +++ b/libcef/web_drag_source_win.cc @@ -7,7 +7,7 @@ #include "libcef/web_drag_utils_win.h" #include "libcef/cef_thread.h" -#include "base/task.h" +#include "base/bind.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" @@ -46,7 +46,7 @@ void WebDragSource::OnDragSourceCancel() { if (!CefThread::CurrentlyOn(CefThread::UI)) { CefThread::PostTask( CefThread::UI, FROM_HERE, - NewRunnableMethod(this, &WebDragSource::OnDragSourceCancel)); + base::Bind(&WebDragSource::OnDragSourceCancel, this)); return; } @@ -67,7 +67,7 @@ void WebDragSource::OnDragSourceDrop() { // OnDragSourceDrop after the current task. CefThread::PostTask( CefThread::UI, FROM_HERE, - NewRunnableMethod(this, &WebDragSource::DelayedOnDragSourceDrop)); + base::Bind(&WebDragSource::DelayedOnDragSourceDrop, this)); } void WebDragSource::DelayedOnDragSourceDrop() { @@ -86,7 +86,7 @@ void WebDragSource::OnDragSourceMove() { if (!CefThread::CurrentlyOn(CefThread::UI)) { CefThread::PostTask( CefThread::UI, FROM_HERE, - NewRunnableMethod(this, &WebDragSource::OnDragSourceMove)); + base::Bind(&WebDragSource::OnDragSourceMove, this)); return; } diff --git a/libcef/web_urlrequest_impl.cc b/libcef/web_urlrequest_impl.cc index 70f2d03e8..16c8a30d1 100644 --- a/libcef/web_urlrequest_impl.cc +++ b/libcef/web_urlrequest_impl.cc @@ -8,6 +8,7 @@ #include "libcef/request_impl.h" #include "libcef/response_impl.h" +#include "base/bind.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "googleurl/src/gurl.h" @@ -241,8 +242,7 @@ CefWebURLRequest::CreateWebURLRequest( // Send the request from the UI thread. CefThread::PostTask(CefThread::UI, FROM_HERE, - NewRunnableMethod(requester.get(), &CefWebURLRequestImpl::DoSend, - request)); + base::Bind(&CefWebURLRequestImpl::DoSend, requester.get(), request)); return requester.get(); } @@ -266,7 +266,7 @@ CefWebURLRequestImpl::RequestState CefWebURLRequestImpl::GetState() { void CefWebURLRequestImpl::Cancel() { CefThread::PostTask(CefThread::UI, FROM_HERE, - NewRunnableMethod(this, &CefWebURLRequestImpl::DoCancel)); + base::Bind(&CefWebURLRequestImpl::DoCancel, this)); } void CefWebURLRequestImpl::DoSend(CefRefPtr request) { diff --git a/libcef/webwidget_host.h b/libcef/webwidget_host.h index b0a8c4f5a..13f3ea54e 100644 --- a/libcef/webwidget_host.h +++ b/libcef/webwidget_host.h @@ -16,7 +16,6 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" -#include "base/task.h" #include "base/time.h" #include "skia/ext/platform_canvas.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" diff --git a/patch/patch.cfg b/patch/patch.cfg index c80a94d39..b83254fc9 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -21,11 +21,6 @@ patches = [ 'name': 'tools_gyp', 'path': '../tools/gyp/', }, - { - # https://bugs.webkit.org/show_bug.cgi?id=73273 - 'name': 'webcore_v8_custom', - 'path': '../third_party/WebKit/Source/WebCore/bindings/v8/custom/' - }, { # https://bugs.webkit.org/show_bug.cgi?id=73760 'name': 'webcore_cachedresource', diff --git a/patch/patches/base.patch b/patch/patches/base.patch index f5b4a28d2..cee67dc03 100644 --- a/patch/patches/base.patch +++ b/patch/patches/base.patch @@ -1,8 +1,8 @@ Index: message_loop.cc =================================================================== ---- message_loop.cc (revision 115322) +--- message_loop.cc (revision 119867) +++ message_loop.cc (working copy) -@@ -395,9 +395,13 @@ +@@ -362,9 +362,13 @@ } void MessageLoop::AssertIdle() const { @@ -19,9 +19,9 @@ Index: message_loop.cc bool MessageLoop::is_running() const { Index: message_loop.h =================================================================== ---- message_loop.h (revision 115322) +--- message_loop.h (revision 119867) +++ message_loop.h (working copy) -@@ -353,6 +353,9 @@ +@@ -345,6 +345,9 @@ // Asserts that the MessageLoop is "idle". void AssertIdle() const; diff --git a/patch/patches/webcore_v8_custom.patch b/patch/patches/webcore_v8_custom.patch deleted file mode 100644 index fde952be3..000000000 --- a/patch/patches/webcore_v8_custom.patch +++ /dev/null @@ -1,17 +0,0 @@ -Index: V8DOMWindowCustom.cpp -=================================================================== ---- V8DOMWindowCustom.cpp (revision 103399) -+++ V8DOMWindowCustom.cpp (working copy) -@@ -297,8 +297,11 @@ - static v8::Handle handlePostMessageCallback(const v8::Arguments& args, bool extendedTransfer) - { - DOMWindow* window = V8DOMWindow::toNative(args.Holder()); -+ Frame* frame = V8Proxy::retrieveFrameForCallingContext(); -+ if (!frame) -+ return v8::Undefined(); - -- DOMWindow* source = V8Proxy::retrieveFrameForCallingContext()->domWindow(); -+ DOMWindow* source = frame->domWindow(); - ASSERT(source->frame()); - - // This function has variable arguments and can be: