From da210afca7710a40c8dd7d32053113561818e43f Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Sun, 3 Jul 2011 00:03:30 +0000 Subject: [PATCH] Update to Chromium revision 91424. - Add tools/gyp_cef to satisfy grit_info.py module load requirement. - Add skia_gpu.patch to work around skia/Angle/WebGL bug. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@263 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- CHROMIUM_BUILD_COMPATIBILITY.txt | 1 + libcef/browser_appcache_system.cc | 2 +- libcef/browser_database_system.cc | 42 +++++-- libcef/browser_database_system.h | 11 +- libcef/browser_devtools_agent.cc | 8 -- libcef/browser_devtools_agent.h | 1 - libcef/browser_drag_delegate_win.cc | 9 +- libcef/browser_file_system.cc | 116 +++++++++++++---- libcef/browser_file_system.h | 55 +++++++- libcef/browser_file_writer.cc | 4 - libcef/browser_impl.cc | 4 +- libcef/browser_impl.h | 2 +- libcef/browser_impl_win.cc | 3 +- libcef/browser_request_context.cc | 20 ++- libcef/browser_request_context.h | 2 +- libcef/browser_resource_loader_bridge.cc | 4 +- libcef/browser_webkit_glue.cc | 36 ++---- libcef/browser_webkit_glue_win.cc | 4 - libcef/browser_webkit_init.h | 10 +- libcef/browser_webstoragearea_impl.cc | 3 +- libcef/browser_webstoragearea_impl.h | 2 +- libcef/browser_webview_delegate.cc | 3 +- libcef/browser_webview_delegate.h | 2 +- libcef/cef_process_ui_thread.cc | 52 -------- libcef/printing/win_printing_context.cc | 2 +- libcef/simple_clipboard_impl.cc | 4 + libcef/webwidget_host_gtk.cc | 9 +- libcef/webwidget_host_mac.mm | 12 +- libcef/webwidget_host_win.cc | 30 ++--- patch/patch_source.cfg | 4 +- patch/patches/base.patch | 8 +- patch/patches/skia_gpu.patch | 12 ++ tools/gclient_hook.py | 4 +- tools/gyp_cef | 154 +++++++++++++++++++++++ 34 files changed, 451 insertions(+), 184 deletions(-) create mode 100644 patch/patches/skia_gpu.patch create mode 100644 tools/gyp_cef diff --git a/CHROMIUM_BUILD_COMPATIBILITY.txt b/CHROMIUM_BUILD_COMPATIBILITY.txt index 86895e928..28bbf514d 100644 --- a/CHROMIUM_BUILD_COMPATIBILITY.txt +++ b/CHROMIUM_BUILD_COMPATIBILITY.txt @@ -65,3 +65,4 @@ Date | CEF Revision | Chromium Revision 2011-02-15 | /trunk@186 | /trunk@74933 2011-04-05 | /trunk@213 | /trunk@80310 2011-05-16 | /trunk@233 | /trunk@85305 +2011-07-02 | /trunk@263 | /trunk@91424 diff --git a/libcef/browser_appcache_system.cc b/libcef/browser_appcache_system.cc index 73a3a626a..9094b0aef 100644 --- a/libcef/browser_appcache_system.cc +++ b/libcef/browser_appcache_system.cc @@ -408,7 +408,7 @@ void BrowserAppCacheSystem::InitOnIOThread( db_thread_.Start(); // Recreate and initialize per each IO thread. - service_ = new appcache::AppCacheService(); + service_ = new appcache::AppCacheService(NULL); backend_impl_ = new appcache::AppCacheBackendImpl(); service_->Initialize(cache_directory_, BrowserResourceLoaderBridge::GetCacheThread()); diff --git a/libcef/browser_database_system.cc b/libcef/browser_database_system.cc index b9455272d..c0b69ada7 100644 --- a/libcef/browser_database_system.cc +++ b/libcef/browser_database_system.cc @@ -19,6 +19,7 @@ using webkit_database::DatabaseTracker; using webkit_database::DatabaseUtil; +using webkit_database::OriginInfo; using webkit_database::VfsBackend; BrowserDatabaseSystem* BrowserDatabaseSystem::instance_ = NULL; @@ -30,6 +31,7 @@ BrowserDatabaseSystem* BrowserDatabaseSystem::GetInstance() { BrowserDatabaseSystem::BrowserDatabaseSystem() : db_thread_("BrowserDBThread"), + quota_per_origin_(5 * 1024 * 1024), open_connections_(new webkit_database::DatabaseConnectionsWrapper) { DCHECK(!instance_); instance_ = this; @@ -120,6 +122,17 @@ int64 BrowserDatabaseSystem::GetFileSize(const string16& vfs_file_name) { return result; } +int64 BrowserDatabaseSystem::GetSpaceAvailable( + const string16& origin_identifier) { + int64 result = 0; + base::WaitableEvent done_event(false, false); + db_thread_proxy_->PostTask(FROM_HERE, + NewRunnableMethod(this, &BrowserDatabaseSystem::VfsGetSpaceAvailable, + origin_identifier, &result, &done_event)); + done_event.Wait(); + return result; +} + void BrowserDatabaseSystem::ClearAllDatabases() { open_connections_->WaitForAllDatabasesToClose(); db_thread_proxy_->PostTask(FROM_HERE, @@ -133,7 +146,7 @@ void BrowserDatabaseSystem::SetDatabaseQuota(int64 quota) { quota)); return; } - db_tracker_->SetDefaultQuota(quota); + quota_per_origin_ = quota; } void BrowserDatabaseSystem::DatabaseOpened(const string16& origin_identifier, @@ -142,12 +155,11 @@ void BrowserDatabaseSystem::DatabaseOpened(const string16& origin_identifier, int64 estimated_size) { DCHECK(db_thread_proxy_->BelongsToCurrentThread()); int64 database_size = 0; - int64 space_available = 0; db_tracker_->DatabaseOpened( origin_identifier, database_name, description, - estimated_size, &database_size, &space_available); + estimated_size, &database_size); OnDatabaseSizeChanged(origin_identifier, database_name, - database_size, space_available); + database_size); } void BrowserDatabaseSystem::DatabaseModified(const string16& origin_identifier, @@ -166,14 +178,13 @@ void BrowserDatabaseSystem::DatabaseClosed(const string16& origin_identifier, void BrowserDatabaseSystem::OnDatabaseSizeChanged( const string16& origin_identifier, const string16& database_name, - int64 database_size, - int64 space_available) { + int64 database_size) { 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); + origin_identifier, database_name, database_size); } void BrowserDatabaseSystem::OnDatabaseScheduledForDeletion( @@ -238,6 +249,23 @@ void BrowserDatabaseSystem::VfsGetFileSize( done_event->Signal(); } +void BrowserDatabaseSystem::VfsGetSpaceAvailable( + const string16& origin_identifier, + int64* result, base::WaitableEvent* done_event) { + DCHECK(db_thread_proxy_->BelongsToCurrentThread()); + // This method isn't actually part of the "vfs" interface, but it is + // used from within webcore and handled here in the same fashion. + OriginInfo info; + if (db_tracker_->GetOriginInfo(origin_identifier, &info)) { + int64 space_available = quota_per_origin_ - info.TotalSize(); + *result = space_available < 0 ? 0 : space_available; + } else { + NOTREACHED(); + *result = 0; + } + done_event->Signal(); +} + FilePath BrowserDatabaseSystem::GetFullFilePathForVfsFile( const string16& vfs_file_name) { DCHECK(db_thread_proxy_->BelongsToCurrentThread()); diff --git a/libcef/browser_database_system.h b/libcef/browser_database_system.h index bac82d55d..96e863be3 100644 --- a/libcef/browser_database_system.h +++ b/libcef/browser_database_system.h @@ -8,8 +8,8 @@ #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/scoped_temp_dir.h" #include "base/string16.h" #include "base/synchronization/lock.h" #include "base/task.h" @@ -29,7 +29,7 @@ class BrowserDatabaseSystem : public webkit_database::DatabaseTracker::Observer, static BrowserDatabaseSystem* GetInstance(); BrowserDatabaseSystem(); - ~BrowserDatabaseSystem(); + virtual ~BrowserDatabaseSystem(); // WebDatabaseObserver implementation, these are called on the script // execution context thread on which the database is opened. This may be @@ -44,6 +44,7 @@ class BrowserDatabaseSystem : public webkit_database::DatabaseTracker::Observer, int DeleteFile(const string16& vfs_file_name, bool sync_dir); uint32 GetFileAttributes(const string16& vfs_file_name); int64 GetFileSize(const string16& vfs_file_name); + int64 GetSpaceAvailable(const string16& origin_identifier); // For use by LayoutTestController, called on the main thread. void ClearAllDatabases(); @@ -63,8 +64,7 @@ class BrowserDatabaseSystem : public webkit_database::DatabaseTracker::Observer, // DatabaseTracker::Observer implementation virtual void OnDatabaseSizeChanged(const string16& origin_identifier, const string16& database_name, - int64 database_size, - int64 space_available); + int64 database_size); virtual void OnDatabaseScheduledForDeletion(const string16& origin_identifier, const string16& database_name); @@ -77,6 +77,8 @@ class BrowserDatabaseSystem : public webkit_database::DatabaseTracker::Observer, uint32* result, base::WaitableEvent* done_event); void VfsGetFileSize(const string16& vfs_file_name, int64* result, base::WaitableEvent* done_event); + void VfsGetSpaceAvailable(const string16& origin_identifier, + int64* result, base::WaitableEvent* done_event); FilePath GetFullFilePathForVfsFile(const string16& vfs_file_name); @@ -91,6 +93,7 @@ class BrowserDatabaseSystem : public webkit_database::DatabaseTracker::Observer, base::Thread db_thread_; scoped_refptr db_thread_proxy_; scoped_refptr db_tracker_; + int64 quota_per_origin_; // Data members to support waiting for all connections to be closed. scoped_refptr open_connections_; diff --git a/libcef/browser_devtools_agent.cc b/libcef/browser_devtools_agent.cc index 4256a3651..e28cd1817 100644 --- a/libcef/browser_devtools_agent.cc +++ b/libcef/browser_devtools_agent.cc @@ -137,14 +137,6 @@ void BrowserDevToolsAgent::frontendLoaded() { 0); } -bool BrowserDevToolsAgent::setTimelineProfilingEnabled(bool enabled) { - WebDevToolsAgent* agent = GetWebAgent(); - if (!agent) - return false; - agent->setTimelineProfilingEnabled(enabled); - return true; -} - bool BrowserDevToolsAgent::evaluateInWebInspector( long call_id, const std::string& script) { diff --git a/libcef/browser_devtools_agent.h b/libcef/browser_devtools_agent.h index 10d674516..6af1dec78 100644 --- a/libcef/browser_devtools_agent.h +++ b/libcef/browser_devtools_agent.h @@ -45,7 +45,6 @@ class BrowserDevToolsAgent : public WebKit::WebDevToolsAgentClient { void frontendLoaded(); bool evaluateInWebInspector(long call_id, const std::string& script); - bool setTimelineProfilingEnabled(bool enable); BrowserDevToolsClient* client() { return dev_tools_client_; } diff --git a/libcef/browser_drag_delegate_win.cc b/libcef/browser_drag_delegate_win.cc index 6a733cb8c..b544e4f36 100644 --- a/libcef/browser_drag_delegate_win.cc +++ b/libcef/browser_drag_delegate_win.cc @@ -28,6 +28,7 @@ #include "net/base/file_stream.h" #include "net/base/mime_util.h" #include "net/base/net_util.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "views/drag_utils.h" @@ -259,6 +260,7 @@ void GenerateFileName(const GURL& url, string16 new_name = net::GetSuggestedFilename(GURL(url), content_disposition, referrer_charset, + "", string16(L"download")); // TODO(evan): this code is totally wrong -- we should just generate @@ -332,8 +334,9 @@ void BrowserDragDelegate::StartDragging(const WebDropData& drop_data, drag_source_ = new WebDragSource(browser->UIT_GetWebViewWndHandle(), web_view); - const GURL& page_url = web_view->mainFrame()->url(); - const std::string& page_encoding = web_view->mainFrame()->encoding().utf8(); + const GURL& page_url = web_view->mainFrame()->document().url(); + const std::string& page_encoding = + web_view->mainFrame()->document().encoding().utf8(); // If it is not drag-out, do the drag-and-drop in the current UI thread. if (drop_data.download_metadata.empty()) { @@ -446,7 +449,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, "", "", "", string16())); 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_file_system.cc b/libcef/browser_file_system.cc index 8012701e8..5d61d631b 100644 --- a/libcef/browser_file_system.cc +++ b/libcef/browser_file_system.cc @@ -12,11 +12,13 @@ #include "base/time.h" #include "base/utf_string_conversions.h" #include "googleurl/src/gurl.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileInfo.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallbacks.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemEntry.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" #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" @@ -37,6 +39,7 @@ using WebKit::WebFileWriterClient; using WebKit::WebFrame; using WebKit::WebSecurityOrigin; using WebKit::WebString; +using WebKit::WebURL; using WebKit::WebVector; using fileapi::FileSystemCallbackDispatcher; @@ -64,11 +67,6 @@ class BrowserFileSystemCallbackDispatcher callbacks_->didSucceed(); } - // Callback to report information for a file. - virtual void DidGetLocalPath(const FilePath& local_path) { - NOTREACHED(); - } - virtual void DidReadMetadata(const base::PlatformFileInfo& info, const FilePath& platform_path) { DCHECK(file_system_); @@ -105,8 +103,13 @@ class BrowserFileSystemCallbackDispatcher if (!root.is_valid()) callbacks_->didFail(WebKit::WebFileErrorSecurity); else +// Temporary hack to ease a 4-phase Chromium/WebKit commit. +#ifdef WEBFILESYSTEMCALLBACKS_USE_URL_NOT_STRING + callbacks_->didOpenFileSystem(WebString::fromUTF8(name), root); +#else callbacks_->didOpenFileSystem( WebString::fromUTF8(name), WebString::fromUTF8(root.spec())); +#endif } virtual void DidFail(base::PlatformFileError error_code) { @@ -170,65 +173,124 @@ void BrowserFileSystem::OpenFileSystem( return; } - GURL origin_url(frame->securityOrigin().toString()); + GURL origin_url(frame->document().securityOrigin().toString()); GetNewOperation(callbacks)->OpenFileSystem(origin_url, type, create); } +void BrowserFileSystem::move(const WebString& src_path, + const WebString& dest_path, + WebFileSystemCallbacks* callbacks) { + move(GURL(src_path), GURL(dest_path), callbacks); +} + +void BrowserFileSystem::copy(const WebString& src_path, + const WebString& dest_path, + WebFileSystemCallbacks* callbacks) { + copy(GURL(src_path), GURL(dest_path), callbacks); +} + +void BrowserFileSystem::remove(const WebString& path, + WebFileSystemCallbacks* callbacks) { + remove(GURL(path), callbacks); +} + +void BrowserFileSystem::removeRecursively(const WebString& path, + WebFileSystemCallbacks* callbacks) { + removeRecursively(GURL(path), callbacks); +} + +void BrowserFileSystem::readMetadata(const WebString& path, + WebFileSystemCallbacks* callbacks) { + readMetadata(GURL(path), callbacks); +} + +void BrowserFileSystem::createFile(const WebString& path, + bool exclusive, + WebFileSystemCallbacks* callbacks) { + createFile(GURL(path), exclusive, callbacks); +} + +void BrowserFileSystem::createDirectory(const WebString& path, + bool exclusive, + WebFileSystemCallbacks* callbacks) { + createDirectory(GURL(path), exclusive, callbacks); +} + +void BrowserFileSystem::fileExists(const WebString& path, + WebFileSystemCallbacks* callbacks) { + fileExists(GURL(path), callbacks); +} + +void BrowserFileSystem::directoryExists(const WebString& path, + WebFileSystemCallbacks* callbacks) { + directoryExists(GURL(path), callbacks); +} + +void BrowserFileSystem::readDirectory(const WebString& path, + WebFileSystemCallbacks* callbacks) { + readDirectory(GURL(path), callbacks); +} + +WebKit::WebFileWriter* BrowserFileSystem::createFileWriter( + const WebString& path, WebKit::WebFileWriterClient* client) { + return createFileWriter(GURL(path), client); +} + void BrowserFileSystem::move( - const WebString& src_path, - const WebString& dest_path, WebFileSystemCallbacks* callbacks) { + const WebURL& src_path, + const WebURL& dest_path, WebFileSystemCallbacks* callbacks) { GetNewOperation(callbacks)->Move(GURL(src_path), GURL(dest_path)); } void BrowserFileSystem::copy( - const WebString& src_path, const WebString& dest_path, + const WebURL& src_path, const WebURL& dest_path, WebFileSystemCallbacks* callbacks) { GetNewOperation(callbacks)->Copy(GURL(src_path), GURL(dest_path)); } void BrowserFileSystem::remove( - const WebString& path, WebFileSystemCallbacks* callbacks) { - GetNewOperation(callbacks)->Remove(GURL(path), false /* recursive */); + const WebURL& path, WebFileSystemCallbacks* callbacks) { + GetNewOperation(callbacks)->Remove(path, false /* recursive */); } void BrowserFileSystem::removeRecursively( - const WebString& path, WebFileSystemCallbacks* callbacks) { - GetNewOperation(callbacks)->Remove(GURL(path), true /* recursive */); + const WebURL& path, WebFileSystemCallbacks* callbacks) { + GetNewOperation(callbacks)->Remove(path, true /* recursive */); } void BrowserFileSystem::readMetadata( - const WebString& path, WebFileSystemCallbacks* callbacks) { - GetNewOperation(callbacks)->GetMetadata(GURL(path)); + const WebURL& path, WebFileSystemCallbacks* callbacks) { + GetNewOperation(callbacks)->GetMetadata(path); } void BrowserFileSystem::createFile( - const WebString& path, bool exclusive, WebFileSystemCallbacks* callbacks) { - GetNewOperation(callbacks)->CreateFile(GURL(path), exclusive); + const WebURL& path, bool exclusive, WebFileSystemCallbacks* callbacks) { + GetNewOperation(callbacks)->CreateFile(path, exclusive); } void BrowserFileSystem::createDirectory( - const WebString& path, bool exclusive, WebFileSystemCallbacks* callbacks) { - GetNewOperation(callbacks)->CreateDirectory(GURL(path), exclusive, false); + const WebURL& path, bool exclusive, WebFileSystemCallbacks* callbacks) { + GetNewOperation(callbacks)->CreateDirectory(path, exclusive, false); } void BrowserFileSystem::fileExists( - const WebString& path, WebFileSystemCallbacks* callbacks) { - GetNewOperation(callbacks)->FileExists(GURL(path)); + const WebURL& path, WebFileSystemCallbacks* callbacks) { + GetNewOperation(callbacks)->FileExists(path); } void BrowserFileSystem::directoryExists( - const WebString& path, WebFileSystemCallbacks* callbacks) { - GetNewOperation(callbacks)->DirectoryExists(GURL(path)); + const WebURL& path, WebFileSystemCallbacks* callbacks) { + GetNewOperation(callbacks)->DirectoryExists(path); } void BrowserFileSystem::readDirectory( - const WebString& path, WebFileSystemCallbacks* callbacks) { - GetNewOperation(callbacks)->ReadDirectory(GURL(path)); + const WebURL& path, WebFileSystemCallbacks* callbacks) { + GetNewOperation(callbacks)->ReadDirectory(path); } WebFileWriter* BrowserFileSystem::createFileWriter( - const WebString& path, WebFileWriterClient* client) { - return new BrowserFileWriter(GURL(path), client, file_system_context_.get()); + const WebURL& path, WebFileWriterClient* client) { + return new BrowserFileWriter(path, client, file_system_context_.get()); } FileSystemOperation* BrowserFileSystem::GetNewOperation( diff --git a/libcef/browser_file_system.h b/libcef/browser_file_system.h index bb0adadaf..c2eb4227e 100644 --- a/libcef/browser_file_system.h +++ b/libcef/browser_file_system.h @@ -5,17 +5,18 @@ #ifndef BROWSER_FILE_SYSTEM_H_ #define BROWSER_FILE_SYSTEM_H_ -#include #include "base/file_util_proxy.h" #include "base/id_map.h" -#include "base/memory/scoped_temp_dir.h" #include "base/memory/weak_ptr.h" +#include "base/scoped_temp_dir.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystem.h" #include "webkit/fileapi/file_system_types.h" +#include namespace WebKit { class WebFileSystemCallbacks; class WebFrame; +class WebURL; } namespace fileapi { @@ -40,7 +41,55 @@ class BrowserFileSystem return file_system_context_.get(); } - // WebKit::WebFileSystem methods. + // New WebKit::WebFileSystem overrides. + virtual void move( + const WebKit::WebURL& src_path, + const WebKit::WebURL& dest_path, + WebKit::WebFileSystemCallbacks*); + + virtual void copy( + const WebKit::WebURL& src_path, + const WebKit::WebURL& dest_path, + WebKit::WebFileSystemCallbacks*); + + virtual void remove( + const WebKit::WebURL& path, + WebKit::WebFileSystemCallbacks*); + + virtual void removeRecursively( + const WebKit::WebURL& path, + WebKit::WebFileSystemCallbacks*); + + virtual void readMetadata( + const WebKit::WebURL& path, + WebKit::WebFileSystemCallbacks*); + + virtual void createFile( + const WebKit::WebURL& path, + bool exclusive, + WebKit::WebFileSystemCallbacks*); + + virtual void createDirectory( + const WebKit::WebURL& path, + bool exclusive, + WebKit::WebFileSystemCallbacks*); + + virtual void fileExists( + const WebKit::WebURL& path, + WebKit::WebFileSystemCallbacks*); + + virtual void directoryExists( + const WebKit::WebURL& path, + WebKit::WebFileSystemCallbacks*); + + virtual void readDirectory( + const WebKit::WebURL& path, + WebKit::WebFileSystemCallbacks*); + + virtual WebKit::WebFileWriter* createFileWriter( + const WebKit::WebURL& path, WebKit::WebFileWriterClient*); + + // Old WebKit::WebFileSystem overrides, soon to go away. virtual void move(const WebKit::WebString& src_path, const WebKit::WebString& dest_path, WebKit::WebFileSystemCallbacks* callbacks); diff --git a/libcef/browser_file_writer.cc b/libcef/browser_file_writer.cc index a637878cc..5835a8546 100644 --- a/libcef/browser_file_writer.cc +++ b/libcef/browser_file_writer.cc @@ -94,10 +94,6 @@ class BrowserFileWriter::IOThreadProxy proxy_->DidSucceed(); } - virtual void DidGetLocalPath(const FilePath& local_path) { - NOTREACHED(); - } - virtual void DidFail(base::PlatformFileError error_code) { proxy_->DidFail(error_code); } diff --git a/libcef/browser_impl.cc b/libcef/browser_impl.cc index 472030df4..5dd1c9959 100644 --- a/libcef/browser_impl.cc +++ b/libcef/browser_impl.cc @@ -586,7 +586,7 @@ CefString CefBrowserImpl::GetURL(CefRefPtr frame) WebFrame* web_frame = UIT_GetWebFrame(frame); if(web_frame) - return std::string(web_frame->url().spec()); + return std::string(web_frame->document().url().spec()); return CefString(); } @@ -1411,7 +1411,7 @@ void CefBrowserImpl::UIT_SetZoomLevel(double zoomLevel) WebKit::WebFrame* web_frame = UIT_GetMainWebFrame(); if(web_frame) { web_frame->view()->setZoomLevel(false, zoomLevel); - ZoomMap::GetInstance()->set(web_frame->url(), zoomLevel); + ZoomMap::GetInstance()->set(web_frame->document().url(), zoomLevel); set_zoom_level(zoomLevel); } } diff --git a/libcef/browser_impl.h b/libcef/browser_impl.h index be12f06ec..6d73ff338 100644 --- a/libcef/browser_impl.h +++ b/libcef/browser_impl.h @@ -19,7 +19,7 @@ #include "printing/win_printing_context.h" #endif -#include "base/memory/scoped_temp_dir.h" +#include "base/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 1f5d9e997..994f642c1 100644 --- a/libcef/browser_impl_win.cc +++ b/libcef/browser_impl_win.cc @@ -10,6 +10,7 @@ #include "skia/ext/vector_canvas.h" #include "skia/ext/vector_platform_device_emf_win.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.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" @@ -350,7 +351,7 @@ void CefBrowserImpl::UIT_PrintPage(int page_number, int total_pages, printInfo.m_Rect = rect; printInfo.m_Scale = scale; - CefString url(frame->url().spec()); + CefString url(frame->document().url().spec()); CefString title = title_; CefString topLeft, topCenter, topRight; diff --git a/libcef/browser_request_context.cc b/libcef/browser_request_context.cc index ff2dfc2f6..983a1dd40 100644 --- a/libcef/browser_request_context.cc +++ b/libcef/browser_request_context.cc @@ -7,11 +7,12 @@ #include "browser_file_system.h" #include "browser_persistent_cookie_store.h" #include "browser_resource_loader_bridge.h" -#include "build/build_config.h" +#include "cef_thread.h" #include "base/compiler_specific.h" #include "base/file_path.h" #include "base/file_util.h" +#include "build/build_config.h" #include "net/base/cert_verifier.h" #include "net/base/cookie_monster.h" #include "net/base/host_resolver.h" @@ -21,10 +22,13 @@ #include "net/proxy/proxy_config_service.h" #include "net/proxy/proxy_config_service_fixed.h" #include "net/proxy/proxy_service.h" +#include "net/url_request/url_request_job_factory.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/blob/blob_url_request_job_factory.h" #include "webkit/fileapi/file_system_context.h" +#include "webkit/fileapi/file_system_url_request_job_factory.h" #include "webkit/glue/webkit_glue.h" #if defined(OS_WIN) @@ -126,6 +130,7 @@ void BrowserRequestContext::Init( storage_.set_host_resolver( net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, + net::HostResolver::kDefaultRetryAttempts, NULL)); storage_.set_cert_verifier(new net::CertVerifier); storage_.set_ssl_config_service(new net::SSLConfigServiceDefaults); @@ -165,6 +170,19 @@ void BrowserRequestContext::Init( blob_storage_controller_.reset(new webkit_blob::BlobStorageController()); file_system_context_ = static_cast( WebKit::webKitClient()->fileSystem())->file_system_context(); + + net::URLRequestJobFactory* job_factory = new net::URLRequestJobFactory; + job_factory->SetProtocolHandler( + "blob", + new webkit_blob::BlobProtocolHandler( + blob_storage_controller_.get(), + CefThread::GetMessageLoopProxyForThread(CefThread::FILE))); + job_factory->SetProtocolHandler( + "filesystem", + fileapi::CreateFileSystemProtocolHandler( + file_system_context_.get(), + CefThread::GetMessageLoopProxyForThread(CefThread::FILE))); + storage_.set_job_factory(job_factory); } BrowserRequestContext::~BrowserRequestContext() { diff --git a/libcef/browser_request_context.h b/libcef/browser_request_context.h index 077787bfd..ba06de6c8 100644 --- a/libcef/browser_request_context.h +++ b/libcef/browser_request_context.h @@ -26,7 +26,7 @@ class BrowserRequestContext : public net::URLRequestContext { public: // Use an in-memory cache BrowserRequestContext(); - ~BrowserRequestContext(); + virtual ~BrowserRequestContext(); // Use an on-disk cache at the specified location. Optionally, use the cache // in playback or record mode. diff --git a/libcef/browser_resource_loader_bridge.cc b/libcef/browser_resource_loader_bridge.cc index b6c45a1cb..50bd0b819 100644 --- a/libcef/browser_resource_loader_bridge.cc +++ b/libcef/browser_resource_loader_bridge.cc @@ -227,7 +227,7 @@ class RequestProxy : public net::URLRequest::Delegate, if (allow_download && webkit_glue::ShouldDownload(content_disposition, info.mime_type)) { string16 filename = net::GetSuggestedFilename(url, - content_disposition, info.charset, ASCIIToUTF16("download")); + content_disposition, info.charset, "", ASCIIToUTF16("download")); CefRefPtr dl_handler; if (handler->GetDownloadHandler(browser_, info.mime_type, filename, info.content_length, @@ -714,7 +714,7 @@ class RequestProxy : public net::URLRequest::Delegate, StaticCookiePolicy policy(policy_type); int rv = policy.CanSetCookie( - request->url(), request->first_party_for_cookies(), cookie_line); + request->url(), request->first_party_for_cookies()); return rv == net::OK; } diff --git a/libcef/browser_webkit_glue.cc b/libcef/browser_webkit_glue.cc index c54428d64..345f6a621 100644 --- a/libcef/browser_webkit_glue.cc +++ b/libcef/browser_webkit_glue.cc @@ -31,6 +31,7 @@ MSVC_POP_WARNING(); #include "net/base/mime_util.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" +#include "webkit/glue/user_agent.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/plugins/plugin_list.h" @@ -45,31 +46,11 @@ bool IsMediaPlayerAvailable() { return true; } -bool GetApplicationDirectory(FilePath* path) { - return PathService::Get(base::DIR_EXE, path); -} - -bool GetExeDirectory(FilePath* path) { - return PathService::Get(base::DIR_EXE, path); -} - -bool IsPluginRunningInRendererProcess() { - return true; -} - -bool GetPluginFinderURL(std::string* plugin_finder_url) { - return false; -} - void GetPlugins(bool refresh, std::vector* plugins) { webkit::npapi::PluginList::Singleton()->GetPlugins(refresh, plugins); } -bool IsDefaultPluginEnabled() { - return false; -} - bool IsProtocolSupportedForMedia(const GURL& url) { if (url.SchemeIsFile() || url.SchemeIs("http") || url.SchemeIs("https")) return true; @@ -115,14 +96,19 @@ void ClearCache() WebCore::CrossOriginPreflightResultCache::shared().empty(); } -std::string GetProductVersion() { +std::string BuildUserAgent(bool mimic_windows) { + std::string product_version; + const CefSettings& settings = _Context->settings(); if (settings.product_version.length > 0) { - return CefString(&settings.product_version); + product_version = CefString(&settings.product_version).ToString(); + } else { + // Keep synchronized with the newest Beta Channel release announced at + // http://googlechromereleases.blogspot.com/ + product_version = "Chrome/13.0.782.41"; } - // Keep synchronized with the newest Beta Channel release announced at - // http://googlechromereleases.blogspot.com/ - return "Chrome/12.0.742.53"; + + return webkit_glue::BuildUserAgentHelper(mimic_windows, product_version); } bool IsSingleProcess() { diff --git a/libcef/browser_webkit_glue_win.cc b/libcef/browser_webkit_glue_win.cc index 3b666dfeb..dc300ed01 100644 --- a/libcef/browser_webkit_glue_win.cc +++ b/libcef/browser_webkit_glue_win.cc @@ -45,10 +45,6 @@ string16 GetLocalizedString(int message_id) { return string16(image->achString, image->nLength); } -HCURSOR LoadCursor(int cursor_id) { - return NULL; -} - base::StringPiece GetRawDataResource(HMODULE module, int resource_id) { void* data_ptr; size_t data_size; diff --git a/libcef/browser_webkit_init.h b/libcef/browser_webkit_init.h index f4e72c8ef..a57fb890b 100644 --- a/libcef/browser_webkit_init.h +++ b/libcef/browser_webkit_init.h @@ -15,9 +15,9 @@ #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" @@ -91,7 +91,7 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl { file_utilities_.set_sandbox_enabled(false); } - ~BrowserWebKitInit() { + virtual ~BrowserWebKitInit() { WebKit::shutdown(); } @@ -150,6 +150,12 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl { return BrowserDatabaseSystem::GetInstance()->GetFileSize(vfs_file_name); } + virtual long long databaseGetSpaceAvailableForOrigin( + const WebKit::WebString& origin_identifier) { + return BrowserDatabaseSystem::GetInstance()->GetSpaceAvailable( + origin_identifier); + } + virtual unsigned long long visitedLinkHash(const char* canonicalURL, size_t length) OVERRIDE { return 0; diff --git a/libcef/browser_webstoragearea_impl.cc b/libcef/browser_webstoragearea_impl.cc index d7417623a..7e61c6c2b 100644 --- a/libcef/browser_webstoragearea_impl.cc +++ b/libcef/browser_webstoragearea_impl.cc @@ -40,8 +40,7 @@ WebString BrowserWebStorageAreaImpl::getItem(const WebString& key) { void BrowserWebStorageAreaImpl::setItem( const WebString& key, const WebString& value, const WebURL& url, - WebStorageArea::Result& result, WebString& old_value_webkit, - WebFrame* web_frame) { + WebStorageArea::Result& result, WebString& old_value_webkit) { old_value_webkit = area_->SetItem(key, value, &result); } diff --git a/libcef/browser_webstoragearea_impl.h b/libcef/browser_webstoragearea_impl.h index 094c86417..f054386fa 100644 --- a/libcef/browser_webstoragearea_impl.h +++ b/libcef/browser_webstoragearea_impl.h @@ -23,7 +23,7 @@ class BrowserWebStorageAreaImpl : public WebKit::WebStorageArea { virtual void setItem( const WebKit::WebString& key, const WebKit::WebString& value, const WebKit::WebURL& url, WebStorageArea::Result& result, - WebKit::WebString& old_value, WebKit::WebFrame* web_view); + WebKit::WebString& old_value); virtual void removeItem( const WebKit::WebString& key, const WebKit::WebURL& url, WebKit::WebString& old_value); diff --git a/libcef/browser_webview_delegate.cc b/libcef/browser_webview_delegate.cc index ea8a65de7..d1c0e8ed8 100644 --- a/libcef/browser_webview_delegate.cc +++ b/libcef/browser_webview_delegate.cc @@ -33,6 +33,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebData.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragData.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileError.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallbacks.h" @@ -849,7 +850,7 @@ void BrowserWebViewDelegate::didCommitProvisionalLoad( if (is_main_frame) { // Restore the zoom value that we have for this URL, if any. double zoomLevel = 0.0; - ZoomMap::GetInstance()->get(frame->url(), zoomLevel); + ZoomMap::GetInstance()->get(frame->document().url(), zoomLevel); frame->view()->setZoomLevel(false, zoomLevel); browser_->set_zoom_level(zoomLevel); } diff --git a/libcef/browser_webview_delegate.h b/libcef/browser_webview_delegate.h index 24e14279d..825e0a727 100644 --- a/libcef/browser_webview_delegate.h +++ b/libcef/browser_webview_delegate.h @@ -206,7 +206,7 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient, virtual WebKit::WebCookieJar* GetCookieJar() OVERRIDE; BrowserWebViewDelegate(CefBrowserImpl* browser); - ~BrowserWebViewDelegate(); + virtual ~BrowserWebViewDelegate(); void Reset(); void SetSmartInsertDeleteEnabled(bool enabled); diff --git a/libcef/cef_process_ui_thread.cc b/libcef/cef_process_ui_thread.cc index b428b2e6d..ae8ffd056 100644 --- a/libcef/cef_process_ui_thread.cc +++ b/libcef/cef_process_ui_thread.cc @@ -15,15 +15,9 @@ #include "base/string_number_conversions.h" #include "build/build_config.h" #include "net/base/net_module.h" -#include "net/url_request/url_request.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebNetworkStateNotifier.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" #if defined(OS_WIN) @@ -35,48 +29,6 @@ static const char* kStatsFilePrefix = "libcef_"; static int kStatsFileThreads = 20; static int kStatsFileCounters = 200; -namespace { - -net::URLRequestJob* BlobURLRequestJobFactory(net::URLRequest* request, - const std::string& scheme) { - webkit_blob::BlobStorageController* blob_storage_controller = - static_cast(request->context())-> - blob_storage_controller(); - return new webkit_blob::BlobURLRequestJob( - request, - blob_storage_controller->GetBlobDataFromUrl(request->url()), - 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, - CefThread::GetMessageLoopProxyForThread(CefThread::FILE)); - } - return new fileapi::FileSystemURLRequestJob( - request, - fs_context, - CefThread::GetMessageLoopProxyForThread(CefThread::FILE)); -} - -} // namespace - - CefProcessUIThread::CefProcessUIThread() : CefThread(CefThread::UI), statstable_(NULL), webkit_init_(NULL) {} @@ -155,10 +107,6 @@ void CefProcessUIThread::Init() { gfx::InitializeGLBindings(gfx::kGLImplementationDesktopGL); #endif - net::URLRequest::RegisterProtocolFactory("blob", &BlobURLRequestJobFactory); - net::URLRequest::RegisterProtocolFactory("filesystem", - &FileSystemURLRequestJobFactory); - if (!_Context->cache_path().empty()) { // Create the storage context object. _Context->set_storage_context(new DOMStorageContext()); diff --git a/libcef/printing/win_printing_context.cc b/libcef/printing/win_printing_context.cc index 9fbd20dd4..2688a1541 100644 --- a/libcef/printing/win_printing_context.cc +++ b/libcef/printing/win_printing_context.cc @@ -350,7 +350,7 @@ bool PrintingContext::InitializeSettings(const DEVMODE& dev_mode, int number_ranges, bool selection_only, bool to_file) { - skia::PlatformDevice::InitializeDC(hdc_); + skia::InitializeDC(hdc_); DCHECK(GetDeviceCaps(hdc_, CLIPCAPS)); DCHECK(GetDeviceCaps(hdc_, RASTERCAPS) & RC_STRETCHDIB); DCHECK(GetDeviceCaps(hdc_, RASTERCAPS) & RC_BITMAP64); diff --git a/libcef/simple_clipboard_impl.cc b/libcef/simple_clipboard_impl.cc index 2bb35dfc7..77910d022 100644 --- a/libcef/simple_clipboard_impl.cc +++ b/libcef/simple_clipboard_impl.cc @@ -94,4 +94,8 @@ bool ClipboardReadFilenames(ui::Clipboard::Buffer buffer, return false; } +uint64 ClipboardGetSequenceNumber() { + return 0; +} + } // namespace webkit_glue diff --git a/libcef/webwidget_host_gtk.cc b/libcef/webwidget_host_gtk.cc index 2099f6ce4..c4023218b 100644 --- a/libcef/webwidget_host_gtk.cc +++ b/libcef/webwidget_host_gtk.cc @@ -369,7 +369,11 @@ void WebWidgetHost::Paint() { } } - webwidget_->animate(); +#ifdef WEBWIDGET_HAS_ANIMATE_CHANGES + webwidget_->animate(0.0); +#else + webwidget_->animate(); +#endif // This may result in more invalidation webwidget_->layout(); @@ -406,7 +410,8 @@ void WebWidgetHost::Paint() { gdk_window_begin_paint_rect(window, &grect); // BitBlit to the gdk window. - cairo_t* source_surface = canvas_->beginPlatformPaint(); + skia::ScopedPlatformPaint scoped_platform_paint(canvas_.get()); + cairo_t* source_surface = scoped_platform_paint.GetPlatformSurface(); cairo_t* cairo_drawable = gdk_cairo_create(window); cairo_set_source_surface(cairo_drawable, cairo_get_target(source_surface), 0, 0); diff --git a/libcef/webwidget_host_mac.mm b/libcef/webwidget_host_mac.mm index 63b3b9351..685c5de00 100644 --- a/libcef/webwidget_host_mac.mm +++ b/libcef/webwidget_host_mac.mm @@ -164,12 +164,16 @@ void WebWidgetHost::Paint() { // make sure webkit draws into our bitmap, not the window CGContextRef bitmap_context = - canvas_->getTopPlatformDevice().GetBitmapContext(); + skia::GetBitmapContext(skia::GetTopDevice(*canvas_)); [NSGraphicsContext setCurrentContext: [NSGraphicsContext graphicsContextWithGraphicsPort:bitmap_context flipped:YES]]; - webwidget_->animate(); +#ifdef WEBWIDGET_HAS_ANIMATE_CHANGES + webwidget_->animate(0.0); +#else + webwidget_->animate(); +#endif // This may result in more invalidation webwidget_->layout(); @@ -206,8 +210,8 @@ void WebWidgetHost::Paint() { int bitmap_width = CGBitmapContextGetWidth(bitmap_context); CGRect bitmap_rect = { { 0, 0 }, { bitmap_width, bitmap_height } }; - canvas_->getTopPlatformDevice().DrawToContext( - context, 0, client_rect.height() - bitmap_height, &bitmap_rect); + skia::DrawToNativeContext(canvas_.get(), context, 0, + client_rect.height() - bitmap_height, &bitmap_rect); [view_ unlockFocus]; } diff --git a/libcef/webwidget_host_win.cc b/libcef/webwidget_host_win.cc index fbe5ea7b5..fa33304b9 100644 --- a/libcef/webwidget_host_win.cc +++ b/libcef/webwidget_host_win.cc @@ -366,7 +366,11 @@ void WebWidgetHost::Paint() { paint_rect_.width(), paint_rect_.height(), true)); } - webwidget_->animate(); +#ifdef WEBWIDGET_HAS_ANIMATE_CHANGES + webwidget_->animate(0.0); +#else + webwidget_->animate(); +#endif // This may result in more invalidation webwidget_->layout(); @@ -374,13 +378,13 @@ void WebWidgetHost::Paint() { // Scroll the canvas if necessary scroll_rect_ = client_rect.Intersect(scroll_rect_); if (!scroll_rect_.IsEmpty()) { - HDC hdc = canvas_->beginPlatformPaint(); + skia::ScopedPlatformPaint scoped_platform_paint(canvas_.get()); + HDC hdc = scoped_platform_paint.GetPlatformSurface(); RECT damaged_scroll_rect, r = scroll_rect_.ToRECT(); ScrollDC(hdc, scroll_dx_, scroll_dy_, NULL, &r, NULL, &damaged_scroll_rect); PaintRect(gfx::Rect(damaged_scroll_rect)); - canvas_->endPlatformPaint(); } ResetScrollRect(); @@ -412,7 +416,8 @@ void WebWidgetHost::Paint() { } if (!visible_plugins.empty()) { - HDC drawDC = canvas_->beginPlatformPaint(); + skia::ScopedPlatformPaint scoped_platform_paint(canvas_.get()); + HDC drawDC = scoped_platform_paint.GetPlatformSurface(); HRGN oldRGN, newRGN; POINT oldViewport; @@ -447,8 +452,6 @@ void WebWidgetHost::Paint() { damaged_rect = damaged_rect.Union(geom->window_rect); } - canvas_->endPlatformPaint(); - // Make sure the damaged rectangle is inside the client rectangle. damaged_rect = damaged_rect.Intersect(client_rect); } @@ -458,10 +461,8 @@ void WebWidgetHost::Paint() { // Paint to the window. PAINTSTRUCT ps; BeginPaint(view_, &ps); - canvas_->getTopPlatformDevice().drawToHDC(ps.hdc, - ps.rcPaint.left, - ps.rcPaint.top, - &ps.rcPaint); + skia::DrawToNativeContext(canvas_.get(), ps.hdc, ps.rcPaint.left, + ps.rcPaint.top, &ps.rcPaint); EndPaint(view_, &ps); // Draw children @@ -469,8 +470,7 @@ void WebWidgetHost::Paint() { } else { // Paint to the delegate. DCHECK(paint_delegate_); - const SkBitmap& bitmap = - canvas_->getTopPlatformDevice().accessBitmap(false); + const SkBitmap& bitmap = canvas_->getDevice()->accessBitmap(false); DCHECK(bitmap.config() == SkBitmap::kARGB_8888_Config); const void* pixels = bitmap.getPixels(); paint_delegate_->Paint(popup_, damaged_rect, pixels); @@ -502,10 +502,10 @@ bool WebWidgetHost::GetImage(int width, int height, void* buffer) if (!canvas_.get()) return false; - DCHECK(width == canvas_->getTopPlatformDevice().width()); - DCHECK(height == canvas_->getTopPlatformDevice().height()); + DCHECK(width == canvas_->getDevice()->width()); + DCHECK(height == canvas_->getDevice()->height()); - const SkBitmap& bitmap = canvas_->getTopPlatformDevice().accessBitmap(false); + const SkBitmap& bitmap = canvas_->getDevice()->accessBitmap(false); DCHECK(bitmap.config() == SkBitmap::kARGB_8888_Config); const void* pixels = bitmap.getPixels(); memcpy(buffer, pixels, width * height * 4); diff --git a/patch/patch_source.cfg b/patch/patch_source.cfg index d506f97e2..5bb0376ee 100644 --- a/patch/patch_source.cfg +++ b/patch/patch_source.cfg @@ -4,5 +4,7 @@ # relates to. patches = { # http://codereview.chromium.org/6730028/ - 'base' : '../base/' + 'base' : '../base/', + # http://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/3d1f12409578cbf4 + 'skia_gpu' : '../third_party/skia/gpu/', } diff --git a/patch/patches/base.patch b/patch/patches/base.patch index cd2d58719..dd96a0fbc 100644 --- a/patch/patches/base.patch +++ b/patch/patches/base.patch @@ -1,8 +1,8 @@ Index: message_loop.cc =================================================================== ---- message_loop.cc (revision 85124) +--- message_loop.cc (revision 91424) +++ message_loop.cc (working copy) -@@ -387,9 +387,13 @@ +@@ -401,9 +401,13 @@ } void MessageLoop::AssertIdle() const { @@ -19,9 +19,9 @@ Index: message_loop.cc //------------------------------------------------------------------------------ Index: message_loop.h =================================================================== ---- message_loop.h (revision 85124) +--- message_loop.h (revision 91424) +++ message_loop.h (working copy) -@@ -351,6 +351,9 @@ +@@ -349,6 +349,9 @@ // Asserts that the MessageLoop is "idle". void AssertIdle() const; diff --git a/patch/patches/skia_gpu.patch b/patch/patches/skia_gpu.patch new file mode 100644 index 000000000..49eba85fa --- /dev/null +++ b/patch/patches/skia_gpu.patch @@ -0,0 +1,12 @@ +Index: src/GrGpuGL.cpp +=================================================================== +--- src/GrGpuGL.cpp (revision 1763) ++++ src/GrGpuGL.cpp (working copy) +@@ -707,7 +707,6 @@ + static const StencilFormat esStencilFormats[] = { + {GR_GL_STENCIL_INDEX8, 8, false}, + {GR_GL_DEPTH24_STENCIL8, 8, true }, +- {GR_GL_STENCIL_INDEX4, 4, false}, + }; + + if (GR_GL_SUPPORT_DESKTOP) { diff --git a/tools/gclient_hook.py b/tools/gclient_hook.py index 47fa06d6d..9accbfab5 100644 --- a/tools/gclient_hook.py +++ b/tools/gclient_hook.py @@ -54,7 +54,5 @@ RunAction(cef_dir, patcher); print "\nGenerating CEF project files..." os.environ['CEF_DIRECTORY'] = os.path.basename(cef_dir); -gyper = [ 'python', '../tools/gyp/gyp', 'cef.gyp', '-I', '../build/common.gypi', - '-I', '../build/features_override.gypi', '-I', 'cef.gypi', - '--no-circular-check' ] +gyper = [ 'python', 'tools/gyp_cef', 'cef.gyp', '-I', 'cef.gypi' ] RunAction(cef_dir, gyper); diff --git a/tools/gyp_cef b/tools/gyp_cef new file mode 100644 index 000000000..9e882a16b --- /dev/null +++ b/tools/gyp_cef @@ -0,0 +1,154 @@ +#!/usr/bin/env python + +# 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. + +# This script is wrapper for CEF/Chromium that adds some support for how GYP +# is invoked by Chromium beyond what can be done in the gclient hooks. + +import glob +import os +import shlex +import subprocess +import sys + +# The CEF root directory is the parent directory of _this_ script. +cef_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) + +# The Chromium source directory is the parent directory of CEF. +chrome_src = os.path.abspath(os.path.join(cef_dir, os.pardir)) + +sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib')) +import gyp + +# Add tools/grit so that pymod_do_main(grit_info ...) can find grit_info.py. +sys.path.insert(1, os.path.join(chrome_src, 'tools', 'grit')) + + +# On Windows, Psyco shortens warm runs of build/gyp_chromium by about +# 20 seconds on a z600 machine with 12 GB of RAM, from 90 down to 70 +# seconds. Conversely, memory usage of build/gyp_chromium with Psyco +# maxes out at about 158 MB vs. 132 MB without it. +# +# Psyco uses native libraries, so we need to load a different +# installation depending on which OS we are running under. It has not +# been tested whether using Psyco on our Mac and Linux builds is worth +# it (the GYP running time is a lot shorter, so the JIT startup cost +# may not be worth it). +if sys.platform == 'win32': + try: + sys.path.insert(0, os.path.join(chrome_src, 'third_party', 'psyco_win32')) + import psyco + except: + psyco = None +else: + psyco = None + +def apply_gyp_environment(file_path=None): + """ + Reads in a *.gyp_env file and applies the valid keys to os.environ. + """ + if not file_path or not os.path.exists(file_path): + return + file_contents = open(file_path).read() + try: + file_data = eval(file_contents, {'__builtins__': None}, None) + except SyntaxError, e: + e.filename = os.path.abspath(file_path) + raise + supported_vars = ( 'CHROMIUM_GYP_SYNTAX_CHECK', + 'GYP_DEFINES', + 'GYP_GENERATOR_FLAGS', + 'GYP_GENERATOR_OUTPUT', ) + for var in supported_vars: + val = file_data.get(var) + if val: + if var in os.environ: + print 'INFO: Environment value for "%s" overrides value in %s.' % ( + var, os.path.abspath(file_path) + ) + else: + os.environ[var] = val + +def additional_include_files(args=[]): + """ + Returns a list of additional (.gypi) files to include, without + duplicating ones that are already specified on the command line. + """ + # Determine the include files specified on the command line. + # This doesn't cover all the different option formats you can use, + # but it's mainly intended to avoid duplicating flags on the automatic + # makefile regeneration which only uses this format. + specified_includes = set() + for arg in args: + if arg.startswith('-I') and len(arg) > 2: + specified_includes.add(os.path.realpath(arg[2:])) + + result = [] + def AddInclude(path): + if os.path.realpath(path) not in specified_includes: + result.append(path) + + # Always include common.gypi. + AddInclude(os.path.join(chrome_src, 'build', 'common.gypi')) + + # Optionally add supplemental .gypi files if present. + supplements = glob.glob(os.path.join(chrome_src, '*', 'supplement.gypi')) + for supplement in supplements: + AddInclude(supplement) + + return result + +if __name__ == '__main__': + args = sys.argv[1:] + + # Use the Psyco JIT if available. + if psyco: + psyco.profile() + print "Enabled Psyco JIT." + + # Fall back on hermetic python if we happen to get run under cygwin. + # TODO(bradnelson): take this out once this issue is fixed: + # http://code.google.com/p/gyp/issues/detail?id=177 + if sys.platform == 'cygwin': + python_dir = os.path.join(chrome_src, 'third_party', 'python_26') + env = os.environ.copy() + env['PATH'] = python_dir + os.pathsep + env.get('PATH', '') + p = subprocess.Popen( + [os.path.join(python_dir, 'python.exe')] + sys.argv, + env=env, shell=False) + p.communicate() + sys.exit(p.returncode) + + if 'SKIP_CHROMIUM_GYP_ENV' not in os.environ: + # Update the environment based on chromium.gyp_env + gyp_env_path = os.path.join(os.path.dirname(chrome_src), 'chromium.gyp_env') + apply_gyp_environment(gyp_env_path) + + args.extend(['-I' + i for i in additional_include_files(args)]) + + # There shouldn't be a circular dependency relationship between .gyp files, + # but in Chromium's .gyp files, on non-Mac platforms, circular relationships + # currently exist. The check for circular dependencies is currently + # bypassed on other platforms, but is left enabled on the Mac, where a + # violation of the rule causes Xcode to misbehave badly. + # TODO(mark): Find and kill remaining circular dependencies, and remove this + # option. http://crbug.com/35878. + # TODO(tc): Fix circular dependencies in ChromiumOS then add linux2 to the + # list. + if sys.platform not in ('darwin',): + args.append('--no-circular-check') + + # If CHROMIUM_GYP_SYNTAX_CHECK is set to 1, it will invoke gyp with --check + # to enfore syntax checking. + syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') + if syntax_check and int(syntax_check): + args.append('--check') + + print 'Updating projects from gyp files...' + sys.stdout.flush() + + # Off we go... + sys.exit(gyp.main(args))